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
25 # pnd_run.sh and nub configurator depend on nubs.state format
26 cat -v /proc/pandora/nub0/mode | sed -n '1p' > /etc/pandora/conf/nubs.state
27 cat -v /proc/pandora/nub0/mouse_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
28 cat -v /proc/pandora/nub0/scrollx_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
29 cat -v /proc/pandora/nub0/scrolly_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
30 cat -v /proc/pandora/nub0/scroll_rate| sed -n '1p' >> /etc/pandora/conf/nubs.state
31 cat -v /proc/pandora/nub0/mbutton_threshold | sed -n '1p' >> /etc/pandora/conf/nubs.state
32 cat -v /proc/pandora/nub1/mode | sed -n '1p' >> /etc/pandora/conf/nubs.state
33 cat -v /proc/pandora/nub1/mouse_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
34 cat -v /proc/pandora/nub1/scrollx_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
35 cat -v /proc/pandora/nub1/scrolly_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
36 cat -v /proc/pandora/nub1/scroll_rate | sed -n '1p' >> /etc/pandora/conf/nubs.state
37 cat -v /proc/pandora/nub1/mbutton_threshold | sed -n '1p' >> /etc/pandora/conf/nubs.state
38 cat -v /proc/pandora/nub0/mbutton_delay | sed -n '1p' >> /etc/pandora/conf/nubs.state
39 cat -v /proc/pandora/nub1/mbutton_delay | sed -n '1p' >> /etc/pandora/conf/nubs.state
41 # nub tools want to update this file
42 chmod a+w /etc/pandora/conf/nubs.state
46 # Determine Pandora type
47 pnd_version=$(dmesg | grep OMAP3 | grep ES | awk '{print $3}')
48 echo $pnd_version > /tmp/pnd_version
50 echo "Restoring Pandora specific settings"
53 if [ -f /etc/pandora/conf/tvout.state ]; then
54 /usr/pandora/scripts/op_tvout.sh
58 highpow="$(cat /etc/pandora/conf/led.conf | grep HighPowerLED: | awk -F\: '{print $2}')"
59 echo $highpow > /sys/class/leds/pandora\:\:power/brightness #power LED bright
60 bright=$(cat /etc/pandora/conf/brightness.state)
61 if [ "$bright" -gt "0" ]; then
62 echo $bright > $SYSFS_BACKLIGHT_BRIGHTNESS
66 cat /etc/pandora/conf/dirty_expire_centisecs > /proc/sys/vm/dirty_expire_centisecs
67 cat /etc/pandora/conf/gamma.state > $SYSFS_GAMMA
68 if [ -f /etc/pandora/conf/dssgamma.state ]; then
69 dssgamma=$(cat /etc/pandora/conf/dssgamma.state)
70 dssgamma2=$(echo "scale=2;$dssgamma / 100" | bc)
71 /usr/pandora/scripts/op_gamma.sh $dssgamma2
75 if [ -f /etc/pandora/conf/filter.state ]; then
76 filter=$(cat /etc/pandora/conf/filter.state)
77 /usr/pandora/scripts/op_videofir.sh $filter
80 # Check for unclean shutdown and set CPU Speed
81 cpuspeed="$(cat /etc/pandora/conf/cpu.conf | grep default | awk -F\: '{print $2}')"
82 oppmax="$(cat /etc/pandora/conf/cpu.conf | grep opp | awk -F\: '{print $2}')"
83 echo $oppmax > /proc/pandora/cpu_opp_max
84 if [ -f /etc/pandora/shutdown ]; then
85 rm /etc/pandora/shutdown
88 echo "No clean shutdown - will CPU Speed will be set to safe value."
89 echo "Yes" > /tmp/nocleanwarn
90 chmod 777 /tmp/nocleanwarn
91 if [ "$pnd_version" == "OMAP3630" ]; then
97 /usr/pandora/scripts/op_cpuspeed.sh -n $cpuspeed
101 if [ "$pnd_version" == "OMAP3630" ]; then
106 /usr/pandora/scripts/op_dspspeed.sh -n $dspspeed
109 sed -n '1p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mode
110 sed -n '2p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mouse_sensitivity
111 sed -n '3p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/scrollx_sensitivity
112 sed -n '4p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/scrolly_sensitivity
113 sed -n '5p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/scroll_rate
114 sed -n '6p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mbutton_threshold
115 sed -n '7p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mode
116 sed -n '8p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mouse_sensitivity
117 sed -n '9p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/scrollx_sensitivity
118 sed -n '10p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/scrolly_sensitivity
119 sed -n '11p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/scroll_rate
120 sed -n '12p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mbutton_threshold
121 sed -n '13p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mbutton_delay
122 sed -n '14p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mbutton_delay
124 # Enable ZRAM Swap if user has enabled the module in /etc/modules
125 if [ -e /dev/zram0 ]; then
126 echo "Enabling ZRAM Swap"
128 swapon -p 5 /dev/zram0
131 # set audio powerdown delay (ms)
132 if [ -e /sys/devices/platform/soc-audio/PCM1773/pmdown_time ]; then
133 echo 60000 > /sys/devices/platform/soc-audio/PCM1773/pmdown_time
136 # remove the mmap limit, useful for emulators
137 echo 0 > /proc/sys/vm/mmap_min_addr
139 # reduce watchdog threshold to reduce CPU wakeups - it's a debugging feature
140 # interval = watchdog_thresh * 2 / 5
141 echo 60 > /proc/sys/kernel/watchdog_thresh
146 echo -n "Starting $DESC: $NAME - "
151 echo -n "Stopping $DESC: $NAME - "
156 echo -n "Reloading $DESC: $NAME - "
160 restart|force-reload)
161 echo -n "Restarting $DESC: $NAME - "
168 echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2