From 1e93186b0aa2e4805c765429d15223bb8b08f53b Mon Sep 17 00:00:00 2001 From: Michael Mrozek Date: Mon, 26 Apr 2010 03:41:27 +0200 Subject: [PATCH] op_lcdsettings.sh: Combined brightness and gamma settings into one script. Also updated the sudoers-file for this. --- .../pandora-scripts/op_gammamanager.desktop | 9 --- .../pandora-scripts/op_gammamanager.sh | 48 ------------ .../pandora-scripts/op_lcdsettings.desktop | 9 +++ .../pandora-scripts/op_lcdsettings.sh | 69 ++++++++++++++++++ .../pandora-scripts/pandorascripts.pnd | Bin 10041 -> 9505 bytes .../pandora-sudoers/50_openpandora | 2 +- 6 files changed, 79 insertions(+), 58 deletions(-) delete mode 100644 recipes/pandora-system/pandora-scripts/op_gammamanager.desktop delete mode 100755 recipes/pandora-system/pandora-scripts/op_gammamanager.sh create mode 100644 recipes/pandora-system/pandora-scripts/op_lcdsettings.desktop create mode 100755 recipes/pandora-system/pandora-scripts/op_lcdsettings.sh diff --git a/recipes/pandora-system/pandora-scripts/op_gammamanager.desktop b/recipes/pandora-system/pandora-scripts/op_gammamanager.desktop deleted file mode 100644 index 6ca93eb..0000000 --- a/recipes/pandora-system/pandora-scripts/op_gammamanager.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Name=LCD Gamma Manager -Comment=Load, create and save LCD Gamma profiles. -StartupNotify=false -Exec=sudo /usr/pandora/scripts/op_gammamanager.sh -Icon=package_graphics -Terminal=false -Type=Application -Categories=Settings; diff --git a/recipes/pandora-system/pandora-scripts/op_gammamanager.sh b/recipes/pandora-system/pandora-scripts/op_gammamanager.sh deleted file mode 100755 index 7a7c0d2..0000000 --- a/recipes/pandora-system/pandora-scripts/op_gammamanager.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - - -if selection=$(cat /etc/pandora/conf/gamma.conf | awk -F\; '{print $1 "\n" $2 }' | zenity --width=700 --height=400 --title="Gamma Manager" --list --column "Name" --column "Description" --text "Please select a Gamma Profile" ); then -echo $selection - - -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 - 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) - 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 - fi -elif [ ${gamma} = "syssyssavecurrent" ]; then - curr=$(cat /sys/devices/platform/omap2_mcspi.1/spi1.1/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 - 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 - zenity --info --title="Profile created" --text "The current gamma settings have been saved as a new profile." --timeout 6 -elif [ ${gamma} = "syssysdeleteprofile" ]; then - if selection2=$(cat /etc/pandora/conf/gamma.conf | grep -v syssys | awk -F\; '{print $1 "\n" $2 }' | zenity --width=700 --height=400 --title="Delete gamma profile" --list --column "Name" --column "Description" --text "Please select a Gamma Profile to Delete" ); then - if zenity --question --title="Confirm Profile Removal" --text="Are you REALLY sure you want to remove the profile $selection2?\n\nThere will be NO other confirmation and this can NOT be undone!" --ok-label="Yes, remove the profile!" --cancel-label="Don't remove the profile"; then - remove=$(grep "$selection2" /etc/pandora/conf/gamma.conf) - cat /etc/pandora/conf/gamma.conf | grep -v "$remove" > /tmp/gamma.conf - mv /tmp/gamma.conf /etc/pandora/conf/gamma.conf - zenity --info --title="Profile deleted" --text "The profile has been deleted." --timeout 6 - else - zenity --info --title="Profile not deleted" --text "The profile has not been deleted." --timeout 6 - fi - fi -else -echo $gamma > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma -fi -fi \ No newline at end of file diff --git a/recipes/pandora-system/pandora-scripts/op_lcdsettings.desktop b/recipes/pandora-system/pandora-scripts/op_lcdsettings.desktop new file mode 100644 index 0000000..5e22175 --- /dev/null +++ b/recipes/pandora-system/pandora-scripts/op_lcdsettings.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=LCD Settings +Comment=Manage LCD Gamma and Brightness. +StartupNotify=false +Exec=sudo /usr/pandora/scripts/op_lcdsettings.sh +Icon=package_graphics +Terminal=false +Type=Application +Categories=Settings; diff --git a/recipes/pandora-system/pandora-scripts/op_lcdsettings.sh b/recipes/pandora-system/pandora-scripts/op_lcdsettings.sh new file mode 100755 index 0000000..e289111 --- /dev/null +++ b/recipes/pandora-system/pandora-scripts/op_lcdsettings.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +while mainsel=$(zenity --title="LCD-Settings" --width="300" --height="180" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "bright" "Change LCD Brightness" "gamma" "Manage LCD Gamma"); 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 + if [ ! $1 ]; then + newbright=$(zenity --scale --text "set brightness" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1) + else + newbright=$1 + fi + if [ $newbright ]; then + if [ $newbright -le $minbright ]; then newbright=$minbright; fi + if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi + echo $newbright > $device + fi;; + + "gamma") + if selection=$(cat /etc/pandora/conf/gamma.conf | awk -F\; '{print $1 "\n" $2 }' | zenity --width=700 --height=400 --title="Gamma Manager" --list --column "Name" --column "Description" --text "Please select a Gamma Profile" ); then + echo $selection + + 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 + 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) + 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 + fi + elif [ ${gamma} = "syssyssavecurrent" ]; then + curr=$(cat /sys/devices/platform/omap2_mcspi.1/spi1.1/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 + 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 + zenity --info --title="Profile created" --text "The current gamma settings have been saved as a new profile." --timeout 6 + elif [ ${gamma} = "syssysdeleteprofile" ]; then + if selection2=$(cat /etc/pandora/conf/gamma.conf | grep -v syssys | awk -F\; '{print $1 "\n" $2 }' | zenity --width=700 --height=400 --title="Delete gamma profile" --list --column "Name" --column "Description" --text "Please select a Gamma Profile to Delete" ); then + if zenity --question --title="Confirm Profile Removal" --text="Are you REALLY sure you want to remove the profile $selection2?\n\nThere will be NO other confirmation and this can NOT be undone!" --ok-label="Yes, remove the profile!" --cancel-label="Don't remove the profile"; then + remove=$(grep "$selection2" /etc/pandora/conf/gamma.conf) + cat /etc/pandora/conf/gamma.conf | grep -v "$remove" > /tmp/gamma.conf + mv /tmp/gamma.conf /etc/pandora/conf/gamma.conf + zenity --info --title="Profile deleted" --text "The profile has been deleted." --timeout 6 + else + zenity --info --title="Profile not deleted" --text "The profile has not been deleted." --timeout 6 + fi + fi + else + echo $gamma > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma + fi + fi;; +esac +done \ No newline at end of file diff --git a/recipes/pandora-system/pandora-scripts/pandorascripts.pnd b/recipes/pandora-system/pandora-scripts/pandorascripts.pnd index 898c0da67009d1b98e71088272733b98e1c5025e..653c744cee235d5553262b6d58e236cd0f3dd1c4 100644 GIT binary patch delta 1757 zcmZuxdpMhS8-9a?N*yxCu=1us&0$DwXmz2)Su5x$Ur8dFq=+Jp8*lPCrA5(;Fogqa>OR;qG&v#wl{l{}Zzx%#_&-MKEJUAtAgXl3)G4cQa zc&!Y%1Ar6&lk_kE1++=3jHCxY2@*`f|KX8+-rEQ9Q%Hi>`&_#3_v~}R=yFj%bIe+~ zTby#KdP6Iav3XZ6Tx0CFesz~Ipb_E_%wYOC`oo`9>sSBQv;NL=i*o!X)!D7~DWY*g z=LZYDRebR5fCI7fKHnt$xNnKO#afWkvlDixUT#*xtm(XX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