exit 1
fi
-if [ "$1" = "0" ]; then
- # set default gamma
- # TODO: we could set some user global setting here instead
- echo 0 > $SYSFS_DSS_GAMMA
- exit 0
+gamma="$@"
+
+if [ "$gamma" = "0" ]; then
+ # set user default gamma
+ gamma="1"
+ if [ -f /etc/pandora/conf/dssgamma.state ]; then
+ dssgamma=$(cat /etc/pandora/conf/dssgamma.state)
+ dssgamma=$(echo "scale=2;$dssgamma / 100" | bc)
+ if [ -n "$dssgamma" ]; then
+ gamma=$dssgamma
+ fi
+ fi
fi
-if [ "$1" = "1" ]; then
+if [ "$gamma" = "1" -o "$gamma" = "1.00" ]; then
# no gamma adjustment
echo 0 > $SYSFS_DSS_GAMMA
exit 0
fi
# just forward args to op_gammatable
-op_gammatable "$@" > /sys/devices/platform/omapdss/display0/dss_gamma
+op_gammatable $gamma > $SYSFS_DSS_GAMMA