pandora-scripts: allow to configure idle power LED brightness
authorGrazvydas Ignotas <notasas@gmail.com>
Mon, 16 May 2016 20:51:20 +0000 (23:51 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Mon, 16 May 2016 20:51:20 +0000 (23:51 +0300)
some cleanup too

recipes/pandora-system/pandora-scripts.bb
recipes/pandora-system/pandora-scripts/op_ledsettings.sh
recipes/pandora-system/pandora-version.bb

index bbadf65..7f98f57 100644 (file)
@@ -5,7 +5,7 @@ COMPATIBLE_MACHINE = "omap3-pandora"
 
 RDEPENDS = "bash sed gawk grep zenity"
 
 
 RDEPENDS = "bash sed gawk grep zenity"
 
-PR = "r167"
+PR = "r168"
 
 SRC_URI = " \
           file://op_bright.sh \
 
 SRC_URI = " \
           file://op_bright.sh \
index a1f8fe7..3377b74 100644 (file)
@@ -4,33 +4,59 @@
 
  . /usr/pandora/scripts/op_common.sh
 
 
  . /usr/pandora/scripts/op_common.sh
 
-while mainsel=$(zenity --title="LED-Settings" --width="400" --height="370" --list --column "id" --column "Please select" --hide-column=1 --text="Welcome to the LED-Settings-Dialogue.\n\nWhat do you want to do?\n" "normal" "Set Power LED Brightness (normal mode)" "power" "Set Power LED Brightness (powersave)" "sd1" "Enable / Disable SD1 LED" "sd2" "Enable / Disable SD2 LED" "wifi" "Enable / Disable WiFi LED" "bt" "Enable / Disable Bluetooth LED"  --ok-label="Change Setting" --cancel-label="Exit"); do
+LED_CONF="/etc/pandora/conf/led.conf"
+grep -q HighPowerLED $LED_CONF || echo "LowPowerLED:16" >> $LED_CONF
+grep -q LowPowerLED $LED_CONF || echo "HighPowerLED:255" >> $LED_CONF
+grep -q IdleLED $LED_CONF || echo "IdleLED:48" >> $LED_CONF
+
+while mainsel=$(zenity --title="LED-Settings" --width="400" --height="370" --list --column "id" --column "Please select" --hide-column=1 --text="Welcome to the LED-Settings-Dialogue.\n\nWhat do you want to do?\n" \
+  "normal" "Set Power LED Brightness (normal mode)" \
+  "power" "Set Power LED Brightness (powersave)" \
+  "idle" "Set Power LED Brightness (screen off/idle)" \
+  "sd1" "Enable / Disable SD1 LED" \
+  "sd2" "Enable / Disable SD2 LED" \
+  "wifi" "Enable / Disable WiFi LED" \
+  "bt" "Enable / Disable Bluetooth LED" \
+    --ok-label="Change Setting" --cancel-label="Exit"); do
 
 case $mainsel in
 
   "normal")
 
 case $mainsel in
 
   "normal")
-   curbright=$(cat /etc/pandora/conf/led.conf | grep HighPowerLED: | awk -F\: '{print $2}')
+   curbright=$(cat $LED_CONF | grep HighPowerLED: | awk -F\: '{print $2}')
    while newbright=$(zenity --scale --text "Set brightness of Power LED (normal mode)" --min-value=0 --max-value=255 --value=$curbright --step 1 --ok-label="Set new brightness" --cancel-label="Save and exit"); do
       curbright=$newbright
       echo $curbright > /sys/class/leds/pandora\:\:power/brightness
    done
    while newbright=$(zenity --scale --text "Set brightness of Power LED (normal mode)" --min-value=0 --max-value=255 --value=$curbright --step 1 --ok-label="Set new brightness" --cancel-label="Save and exit"); do
       curbright=$newbright
       echo $curbright > /sys/class/leds/pandora\:\:power/brightness
    done
-   sed -i "s/.*HighPowerLED.*/HighPowerLED:$curbright/g" /etc/pandora/conf/led.conf 
+   sed -i "s/.*HighPowerLED.*/HighPowerLED:$curbright/g" $LED_CONF
    zenity --info --title="Power LED Brightness Set" --text "The new power LED Brightness setting has been saved." --timeout 6
    ;;   
   
   "power")
    normbright=$(cat /sys/class/leds/pandora\:\:power/brightness)
    zenity --info --title="Power LED Brightness Set" --text "The new power LED Brightness setting has been saved." --timeout 6
    ;;   
   
   "power")
    normbright=$(cat /sys/class/leds/pandora\:\:power/brightness)
-   curbright=$(cat /etc/pandora/conf/led.conf | grep LowPowerLED: | awk -F\: '{print $2}')
+   curbright=$(cat $LED_CONF | grep LowPowerLED: | awk -F\: '{print $2}')
    echo $curbright > /sys/class/leds/pandora\:\:power/brightness
    while newbright=$(zenity --scale --text "Set brightness of Power LED (Powersave mode)" --min-value=0 --max-value=255 --value=$curbright --step 1 --ok-label="Set new brightness" --cancel-label="Save and exit"); do
       curbright=$newbright
       echo $curbright > /sys/class/leds/pandora\:\:power/brightness
    done
    echo $curbright > /sys/class/leds/pandora\:\:power/brightness
    while newbright=$(zenity --scale --text "Set brightness of Power LED (Powersave mode)" --min-value=0 --max-value=255 --value=$curbright --step 1 --ok-label="Set new brightness" --cancel-label="Save and exit"); do
       curbright=$newbright
       echo $curbright > /sys/class/leds/pandora\:\:power/brightness
    done
-   sed -i "s/.*LowPowerLED.*/LowPowerLED:$curbright/g" /etc/pandora/conf/led.conf 
+   sed -i "s/.*LowPowerLED.*/LowPowerLED:$curbright/g" $LED_CONF
    zenity --info --title="Power LED Brightness Set" --text "The new power LED Brightness setting (Powersave mode) has been saved." --timeout 6
    echo $normbright > /sys/class/leds/pandora\:\:power/brightness
    zenity --info --title="Power LED Brightness Set" --text "The new power LED Brightness setting (Powersave mode) has been saved." --timeout 6
    echo $normbright > /sys/class/leds/pandora\:\:power/brightness
-   ;;   
-  
+   ;;
+
+   "idle")
+   normbright=$(cat /sys/class/leds/pandora\:\:power/brightness)
+   curbright=$(cat $LED_CONF | grep IdleLED: | awk -F\: '{print $2}')
+   echo $curbright > /sys/class/leds/pandora\:\:power/brightness
+   while newbright=$(zenity --scale --text "Set brightness of Power LED (screen off/idle mode)" --min-value=0 --max-value=255 --value=$curbright --step 1 --ok-label="Set new brightness" --cancel-label="Save and exit"); do
+      curbright=$newbright
+      echo $curbright > /sys/class/leds/pandora\:\:power/brightness
+   done
+   sed -i "s/.*IdleLED.*/IdleLED:$curbright/g" $LED_CONF
+   zenity --info --title="Power LED Brightness Set" --text "The new power LED Brightness setting (screen off/idle mode) has been saved." --timeout 6
+   echo $normbright > /sys/class/leds/pandora\:\:power/brightness
+   ;;
+
   "sd1")
   if zenity --question --title="Enable / Disable LED?" --text="Do you want to enable or disable the LED for SD Card 1?" --ok-label="Enable it" --cancel-label="Disable it"; then
     echo mmc0 > /sys/class/leds/pandora\:\:sd1/trigger
   "sd1")
   if zenity --question --title="Enable / Disable LED?" --text="Do you want to enable or disable the LED for SD Card 1?" --ok-label="Enable it" --cancel-label="Disable it"; then
     echo mmc0 > /sys/class/leds/pandora\:\:sd1/trigger
index 528c346..1256a9e 100644 (file)
@@ -1,6 +1,6 @@
 DESCRIPTION = "Installs /etc/op-version file."
 LICENSE = "Public Domain"
 DESCRIPTION = "Installs /etc/op-version file."
 LICENSE = "Public Domain"
-PR = "r25"
+PR = "r26"
 
 do_install() {
   OLD_PWD=$PWD
 
 do_install() {
   OLD_PWD=$PWD