DEPENDS = "zenity dbus"
RDEPENDS = "zenity dbus"
-PR = "r78"
+PR = "r79"
SRC_URI = " \
+ file://op_paths.sh \
file://op_bright.sh \
file://op_cpuspeed.sh \
file://op_cpuspeed.pnd \
do_install() {
install -d ${D}${prefix}/pandora/scripts/
+ install -m 0755 ${WORKDIR}/op_paths.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_bright.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_cpuspeed.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_cpusettings.sh ${D}${prefix}/pandora/scripts/
#!/bin/bash
-#get value range
+
+. /usr/pandora/scripts/op_paths.sh
+
+# get value range
minbright=3
-maxbright="$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness)"
-curbright="$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness)"
-device=/sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
+maxbright="$(cat $SYSFS_BACKLIGHT/max_brightness)"
+curbright="$(cat $SYSFS_BACKLIGHT/brightness)"
+
if [ ! $1 ]; then
newbright=$(zenity --scale --text "Set brightness" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1)
else
if [ $newbright ]; then
if [ $newbright -le $minbright ]; then newbright=$minbright; fi
if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi
- echo $newbright > $device
+ echo $newbright > $SYSFS_BACKLIGHT_BRIGHTNESS
fi
#!/bin/bash
-cur=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness);
+
+. /usr/pandora/scripts/op_paths.sh
+
+cur=$(cat $SYSFS_BACKLIGHT_BRIGHTNESS)
if [ "$cur" -gt "40" ]; then
new=$(($cur-10))
elif [ "$cur" -gt "30" ]; then
new=0
fi
-echo $new > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
+echo $new > $SYSFS_BACKLIGHT_BRIGHTNESS
#!/bin/bash
-cur=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness);
+
+. /usr/pandora/scripts/op_paths.sh
+
+cur=$(cat $SYSFS_BACKLIGHT_BRIGHTNESS)
+max=$(cat $SYSFS_BACKLIGHT/max_brightness)
+
if [ "$cur" -gt "35" ]; then
new=$(($cur+10))
elif [ "$cur" -gt "20" ]; then
new=3
fi
-if [ "$new" -gt "54" ]; then
- new=54
+if [ "$new" -gt "$max" ]; then
+ new=$max
fi
-
-
-echo $new > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
+echo $new > $SYSFS_BACKLIGHT_BRIGHTNESS
# LCD-Settings, v1.0, written by Michael Mrozek aka EvilDragon 2010. Brightness-Settings-Part written by vimacs.
# This scripts allows you to create, load and save Gamma-Settings and to change the LCD Brightness.
+. /usr/pandora/scripts/op_paths.sh
+
while mainsel=$(zenity --title="LCD-Settings" --width="300" --height="280" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "bright" "Change LCD Brightness" "gamma" "Manage LCD Gamma" "filter" "Select current video filter" "filterdef" "Select default video filter" "sblank" "Enable/disable screen blanking" ); do
case $mainsel in
"bright")
minbright=3
- maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness)
- curbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness)
- device=/sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
+ maxbright=$(cat $SYSFS_BACKLIGHT/max_brightness)
+ curbright=$(cat $SYSFS_BACKLIGHT/brightness)
if [ ! $1 ]; then
newbright=$(zenity --scale --text "Set brightness" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1)
else
if [ $newbright ]; then
if [ $newbright -le $minbright ]; then newbright=$minbright; fi
if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi
- echo $newbright > $device
+ echo $newbright > $SYSFS_BACKLIGHT_BRIGHTNESS
fi;;
"gamma")
gamma=$(grep "$selection" /etc/pandora/conf/gamma.conf | awk -F\; '{print $3}')
if [ "${gamma}" = "syssyscreatenew" ]; then
- cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma > /tmp/gamma.current
+ cat $SYSFS_GAMMA > /tmp/gamma.current
op_gammatool
if zenity --question --title="Confirm new gamma setting" --text="Do you want to keep the current gamma setting or revert to the previous one?" --ok-label="Keep it" --cancel-label="Revert"; then
if zenity --question --title="Save as profile" --text="Do you want to save the new gamma setting as new profile?\n\nNote: You can also test it out first and save it later by restarting the Gamma Manager" --ok-label="Save it now" --cancel-label="Don't save it now"; then
while ! name=$(zenity --title="Save current settings" --entry --text "Please enter a Name for the new profile.") || [ "x$name" = "x" ] ; do
zenity --title="Error" --error --text="Please enter a name for the profile.." --timeout 6
done
- curr=$(cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma)
+ curr=$(cat $SYSFS_GAMMA)
desc=$(zenity --title="Save current settings" --entry --text "Please enter a description for the new profile.")
echo "$name;$desc;$curr" >> /etc/pandora/conf/gamma.conf
zenity --info --title="Profile created" --text "The current gamma settings have been saved as a new profile." --timeout 6
fi
else
- cat /tmp/gamma.current > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma
+ cat /tmp/gamma.current > $SYSFS_GAMMA
fi
elif [ "${gamma}" = "syssyssavecurrent" ]; then
- curr=$(cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma)
+ curr=$(cat $SYSFS_GAMMA)
while ! name=$(zenity --title="Save current settings" --entry --text "Please enter a Name for the new profile.") || [ "x$name" = "x" ] ; do
- zenity --title="Error" --error --text="Please enter a name for the profile.." --timeout 6
+ zenity --title="Error" --error --text="Please enter a name for the profile.." --timeout 6
done
desc=$(zenity --title="Save current settings" --entry --text "Please enter a description for the new profile.")
echo "$name;$desc;$curr" >> /etc/pandora/conf/gamma.conf
fi
fi
else
- echo $gamma > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma
+ echo $gamma > $SYSFS_GAMMA
fi
fi;;
--- /dev/null
+
+# files changing between kernel versions
+
+if [ -e /sys/class/backlight/pandora-backlight ]; then
+ SYSFS_BACKLIGHT=/sys/class/backlight/pandora-backlight
+elif [ -e /sys/class/backlight/twl4030-pwm0-bl ]; then
+ SYSFS_BACKLIGHT=/sys/class/backlight/twl4030-pwm0-bl
+else
+ echo "ERROR: backlight control not found" >&2
+ SYSFS_BACKLIGHT=/dev/null
+fi
+SYSFS_BACKLIGHT_BRIGHTNESS=${SYSFS_BACKLIGHT}/brightness
+
+if [ -e /sys/devices/omapdss/display0/gamma ]; then
+ SYSFS_GAMMA=/sys/devices/omapdss/display0/gamma
+elif [ -e /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma ]; then
+ SYSFS_GAMMA=/sys/devices/platform/omap2_mcspi.1/spi1.1/gamma
+else
+ echo "ERROR: gamma control not found" >&2
+ SYSFS_GAMMA=/dev/null
+fi
#!/bin/bash
+. /usr/pandora/scripts/op_paths.sh
+
( test -e /tmp/op_power.lock && exit 2 ) || touch "/tmp/op_power.lock"
debug(){
lowPowerOn(){ #switch from normal to lowpower mode
cat /proc/pandora/cpu_mhz_max > /tmp/oldspeed
- cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness > /tmp/oldbright
+ cat $SYSFS_BACKLIGHT_BRIGHTNESS > /tmp/oldbright
pidlist=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*(\([0-9]\+\))/\1/p')
for PID in $pidlist
do
ifconfig wlan0 down
rmmod board_omap3pandora_wifi wl1251_sdio wl1251
fi
- echo 0 > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
+ echo 0 > $SYSFS_BACKLIGHT_BRIGHTNESS
echo 1 > /sys/devices/platform/omapfb/graphics/fb0/blank
echo 16 > /sys/class/leds/pandora\:\:power/brightness #dim power LED
/usr/pandora/scripts/op_cpuspeed.sh 125
oldspeed=$(cat /tmp/oldspeed)
/usr/pandora/scripts/op_cpuspeed.sh $oldspeed
oldbright=$(cat /tmp/oldbright)
- maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness)
+ maxbright=$(cat $SYSFS_BACKLIGHT/max_brightness)
echo 0 > /sys/devices/platform/omapfb/graphics/fb0/blank
sleep 0.1s # looks cleaner, could flicker without
oldspeed=$(cat /tmp/oldspeed)
displayOn(){ # turns the display on
#echo 0 > /sys/devices/platform/omapfb/graphics/fb0/blank
#sleep 0.1s # looks cleaner, could flicker without
- maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness)
+ maxbright=$(cat $SYSFS_BACKLIGHT/max_brightness)
oldbright=0
if [ -f /tmp/oldbright ]; then
oldbright=$(cat /tmp/oldbright)
}
displayOff(){ # turns the display off
- brightness=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness)
+ brightness=$(cat $SYSFS_BACKLIGHT_BRIGHTNESS)
if [ $brightness -gt 0 ]; then
echo $brightness > /tmp/oldbright
fi
- echo 0 > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
+ echo 0 > $SYSFS_BACKLIGHT_BRIGHTNESS
#echo 1 > /sys/devices/platform/omapfb/graphics/fb0/blank
}
COMPATIBLE_MACHINE = "omap3-pandora"
-PR = "r7"
+RDEPENDS = "pandora-scripts"
+
+PR = "r8"
inherit update-rc.d
INITSCRIPT_NAME = "pandora-state"
DESC="OpenPandora Save and Restore LCD Settings"
NAME="pandora-state"
+. /usr/pandora/scripts/op_paths.sh
+
d_stop() {
echo "Saving Pandora specific settings"
- bright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness)
+ bright=$(cat $SYSFS_BACKLIGHT_BRIGHTNESS)
if [ $bright != "0" ]; then
- cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness > /etc/pandora/conf/brightness.state
+ echo $bright > /etc/pandora/conf/brightness.state
fi
touch /etc/pandora/shutdown
- cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma > /etc/pandora/conf/gamma.state
+ cat $SYSFS_GAMMA > /etc/pandora/conf/gamma.state
cat -v /proc/pandora/nub0/mode | sed -n '1p' > /etc/pandora/conf/nubs.state
cat -v /proc/pandora/nub0/mouse_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
cat -v /proc/pandora/nub0/scrollx_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
d_start() {
echo "Restoring Pandora specific settings"
+ bright=$(cat /etc/pandora/conf/brightness.state)
+ if [ "$bright" -gt "0" ]; then
+ echo $bright > $SYSFS_BACKLIGHT_BRIGHTNESS
+ fi
cat /etc/pandora/conf/dirty_expire_centisecs > /proc/sys/vm/dirty_expire_centisecs
- cat /etc/pandora/conf/brightness.state > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
- cat /etc/pandora/conf/gamma.state > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma
+ cat /etc/pandora/conf/gamma.state > $SYSFS_GAMMA
if [ -f /etc/pandora/conf/filter.state ]; then
filter=$(cat /etc/pandora/conf/filter.state)
/usr/pandora/scripts/op_videofir.sh $filter