4 # Provides: pandora-lcd-state
5 # Required-Start: #adjust
6 # Required-Stop: #adjust
11 DESC="OpenPandora Save and Restore various settings"
14 . /usr/pandora/scripts/op_common.sh
17 echo "Saving Pandora specific settings"
18 bright=$(cat $SYSFS_BACKLIGHT_BRIGHTNESS)
19 if [ $bright != "0" ]; then
20 echo $bright > /etc/pandora/conf/brightness.state
22 touch /etc/pandora/shutdown
23 cat $SYSFS_GAMMA > /etc/pandora/conf/gamma.state
24 cat -v /proc/pandora/nub0/mode | sed -n '1p' > /etc/pandora/conf/nubs.state
25 cat -v /proc/pandora/nub0/mouse_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
26 cat -v /proc/pandora/nub0/scrollx_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
27 cat -v /proc/pandora/nub0/scrolly_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
28 cat -v /proc/pandora/nub0/scroll_rate| sed -n '1p' >> /etc/pandora/conf/nubs.state
29 cat -v /proc/pandora/nub0/mbutton_threshold | sed -n '1p' >> /etc/pandora/conf/nubs.state
30 cat -v /proc/pandora/nub1/mode | sed -n '1p' >> /etc/pandora/conf/nubs.state
31 cat -v /proc/pandora/nub1/mouse_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
32 cat -v /proc/pandora/nub1/scrollx_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
33 cat -v /proc/pandora/nub1/scrolly_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
34 cat -v /proc/pandora/nub1/scroll_rate | sed -n '1p' >> /etc/pandora/conf/nubs.state
35 cat -v /proc/pandora/nub1/mbutton_threshold | sed -n '1p' >> /etc/pandora/conf/nubs.state
36 cat -v /proc/pandora/nub0/mbutton_delay | sed -n '1p' >> /etc/pandora/conf/nubs.state
37 cat -v /proc/pandora/nub1/mbutton_delay | sed -n '1p' >> /etc/pandora/conf/nubs.state
41 # Determine Pandora type
42 pnd_version=$(dmesg | grep OMAP3 | grep ES | awk '{print $3}')
43 echo $pnd_version > /tmp/pnd_version
45 echo "Restoring Pandora specific settings"
48 if [ -f /etc/pandora/conf/tvout.state ]; then
49 /usr/pandora/scripts/op_tvout.sh
53 highpow="$(cat /etc/pandora/conf/led.conf | grep HighPowerLED: | awk -F\: '{print $2}')"
54 echo $highpow > /sys/class/leds/pandora\:\:power/brightness #power LED bright
55 bright=$(cat /etc/pandora/conf/brightness.state)
56 if [ "$bright" -gt "0" ]; then
57 echo $bright > $SYSFS_BACKLIGHT_BRIGHTNESS
61 cat /etc/pandora/conf/dirty_expire_centisecs > /proc/sys/vm/dirty_expire_centisecs
62 cat /etc/pandora/conf/gamma.state > $SYSFS_GAMMA
63 if [ -f /etc/pandora/conf/dssgamma.state ]; then
64 dssgamma=$(cat /etc/pandora/conf/dssgamma.state)
65 dssgamma2=$(echo "scale=2;$dssgamma / 100" | bc)
66 /usr/pandora/scripts/op_gamma.sh $dssgamma2
70 if [ -f /etc/pandora/conf/filter.state ]; then
71 filter=$(cat /etc/pandora/conf/filter.state)
72 /usr/pandora/scripts/op_videofir.sh $filter
75 # Check for unclean shutdown and set CPU Speed
76 cpuspeed="$(cat /etc/pandora/conf/cpu.conf | grep default | awk -F\: '{print $2}')"
77 oppmax="$(cat /etc/pandora/conf/cpu.conf | grep opp | awk -F\: '{print $2}')"
78 echo $oppmax > /proc/pandora/cpu_opp_max
79 if [ -f /etc/pandora/shutdown ]; then
80 rm /etc/pandora/shutdown
83 echo "No clean shutdown - will CPU Speed will be set to safe value."
84 echo "Yes" > /tmp/nocleanwarn
85 chmod 777 /tmp/nocleanwarn
86 if [ "$pnd_version" == "OMAP3630" ]; then
92 /usr/pandora/scripts/op_cpuspeed.sh -n $cpuspeed
96 if [ "$pnd_version" == "OMAP3630" ]; then
101 /usr/pandora/scripts/op_dspspeed.sh -n $dspspeed
104 sed -n '1p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mode
105 sed -n '2p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mouse_sensitivity
106 sed -n '3p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/scrollx_sensitivity
107 sed -n '4p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/scrolly_sensitivity
108 sed -n '5p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/scroll_rate
109 sed -n '6p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mbutton_threshold
110 sed -n '7p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mode
111 sed -n '8p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mouse_sensitivity
112 sed -n '9p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/scrollx_sensitivity
113 sed -n '10p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/scrolly_sensitivity
114 sed -n '11p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/scroll_rate
115 sed -n '12p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mbutton_threshold
116 sed -n '13p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mbutton_delay
117 sed -n '14p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mbutton_delay
120 echo "Enabling ZRAM Swap"
122 swapon -p 5 /dev/zram0
124 # set audio powerdown delay (ms)
125 if [ -e /sys/devices/platform/soc-audio/PCM1773/pmdown_time ]; then
126 echo 60000 > /sys/devices/platform/soc-audio/PCM1773/pmdown_time
132 echo -n "Starting $DESC: $NAME - "
137 echo -n "Stopping $DESC: $NAME - "
142 echo -n "Reloading $DESC: $NAME - "
146 restart|force-reload)
147 echo -n "Restarting $DESC: $NAME - "
154 echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2