op_nubmode: Enhanced the script to make all new features added by notaz configurable.
authorMichael Mrozek <EvilDragon@openpandora.de>
Mon, 26 Apr 2010 00:50:24 +0000 (02:50 +0200)
committerMichael Mrozek <EvilDragon@openpandora.de>
Mon, 26 Apr 2010 00:50:24 +0000 (02:50 +0200)
Also updated the rc.pandora-lcd-state-Script to save and restore the nub settings.

recipes/pandora-system/pandora-lcd-state/nubs.state
recipes/pandora-system/pandora-lcd-state/rc.pandora-lcd-state
recipes/pandora-system/pandora-scripts/op_nubmode.sh

index 496f602..b3a083d 100644 (file)
@@ -1,2 +1,12 @@
 mouse
-scroll
\ No newline at end of file
+150
+7
+7
+20
+20
+mbuttons
+150
+7
+7
+20
+20
\ No newline at end of file
index 80d0c3f..9b7b5d0 100644 (file)
@@ -15,16 +15,36 @@ d_stop() {
        echo "Saving LCD and Nub-Settings"
        cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness > /etc/pandora/conf/brightness.state
        cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma > /etc/pandora/conf/gamma.state
-        cat cat -v /proc/pandora/vsense66 | sed -n '1p' > /etc/pandora/conf/nubs.state
-       cat cat -v /proc/pandora/vsense67 | sed -n '1p' >> /etc/pandora/conf/nubs.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
+       cat -v /proc/pandora/nub0/scrolly_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
+       cat -v /proc/pandora/nub0/scroll_rate| sed -n '1p' >> /etc/pandora/conf/nubs.state
+       cat -v /proc/pandora/nub0/mbutton_threshold | sed -n '1p' >> /etc/pandora/conf/nubs.state
+       cat -v /proc/pandora/nub1/mode | sed -n '1p' >> /etc/pandora/conf/nubs.state
+       cat -v /proc/pandora/nub1/mouse_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
+       cat -v /proc/pandora/nub1/scrollx_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
+       cat -v /proc/pandora/nub1/scrolly_sensitivity | sed -n '1p' >> /etc/pandora/conf/nubs.state
+       cat -v /proc/pandora/nub1/scroll_rate | sed -n '1p' >> /etc/pandora/conf/nubs.state
+       cat -v /proc/pandora/nub1/mbutton_threshold | sed -n '1p' >> /etc/pandora/conf/nubs.state
 }
 
 d_start() {
        echo "Restoring LCD and Nub-Settings"
        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
-       sed -n '1p' /etc/pandora/conf/nubs.state > /proc/pandora/vsense66
-       sed -n '2p' /etc/pandora/conf/nubs.state > /proc/pandora/vsense67
+       sed -n '1p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mode
+       sed -n '2p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mouse_sensitivity
+       sed -n '3p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/scrollx_sensitivity
+       sed -n '4p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/scrolly_sensitivity
+       sed -n '5p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/scroll_rate
+       sed -n '6p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mbutton_threshold
+       sed -n '7p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mode
+       sed -n '8p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mouse_sensitivity
+       sed -n '9p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/scrollx_sensitivity
+       sed -n '10p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/scrolly_sensitivity
+       sed -n '11p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/scroll_rate
+       sed -n '12p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mbutton_threshold
 }
 
 case "$1" in
index 634344d..584909e 100755 (executable)
@@ -1,13 +1,87 @@
 #!/bin/bash
 
-if nubl=$(zenity --height=300 --list --title="Select Nub-mode for the left nub" --text="Please select the modus for the left nub.\n\nNote: This can affect running programs.\nSome programs also may change the nub mode themselves."  --column "return" --hide-column=1 --column "Nub Mode" "mouse" "Use the nub as mouse" "scroll" "Use the nub for scrolling" "absolute" "Use the nub as joystick") ; then
+while mainsel=$(zenity --title="Nub-Configuration" --width="430" --height="400" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "nub0mode" "Change the mode for the left nub" "nub0msense" "Change the mouse speed for the left nub" "nub0ssense" "Change the scroll sensitivity for the left nub" "nub0rate" "Change the scroll speed for the left nub" "nub0thres" "Change the mouse button sensitivity for the left nub" "nub1mode" "Change the mode for the right nub" "nub1msense" "Change the mouse speed for the right nub" "nub1ssense" "Change the scroll sensitivity for the right nub" "nub1rate" "Change the scroll speed for the right nub" "nub1thres" "Change the mouse button sensitivity for the right nub" "default" "Restore default settings for both nubs"); do
 
-echo $nubl > /proc/pandora/vsense66
+case $mainsel in
 
-fi
+  "nub0mode")
+      if nubm=$(zenity --height=300 --list --title="Select Nub-mode for the left nub" --text="Please select the modus for the left nub.\n\nNote: This can affect running programs.\nSome programs also may change the nub mode themselves."  --column "return" --hide-column=1 --column "Nub Mode" "mouse" "Use the nub as mouse" "mbuttons" "Use the nub for mousebuttons" "scroll" "Use the nub for scrolling" "absolute" "Use the nub as joystick") ; then
 
-if nubr=$(zenity --height=300 --list --title="Select Nub-mode for the right nub" --text="Please select the modus for the right nub.\n\nNote: This can affect running programs.\nSome programs also may change the nub mode themselves."  --column "return" --hide-column=1 --column "Nub Mode" "mouse" "Use the nub as mouse" "scroll" "Use the nub for scrolling" "absolute" "Use the nub as joystick") ; then
+      echo $nubm > /proc/pandora/nub0/mode
+      fi;;
 
-echo $nubr > /proc/pandora/vsense67
+  "nub0msense")
+      curmsense=$(cat /proc/pandora/nub0/mouse_sensitivity)
+      newmsense=$(zenity --scale --text "Set speed for left nub mouse.\nThe default value is 150. Higher value means faster mouse." --min-value=50 --max-value=300 --value=$curmsense --step 1)
+      echo $newmsense > /proc/pandora/nub0/mouse_sensitivity
+      ;;
+    
+  "nub0ssense")
+      curssense=$(cat /proc/pandora/nub0/scrollx_sensitivity)
+      newssense=$(zenity --scale --text "Set the scroll sensitivity for the left nub for the X-Axis.\nThe default value is 7. Higher value means more sensitive.\nA negative value inverts the axis." --min-value=-32 --max-value=32 --value=$curssense --step 1)
+      echo $newssense > /proc/pandora/nub0/scrollx_sensitivity
+      curssense=$(cat /proc/pandora/nub0/scrolly_sensitivity)
+      newssense=$(zenity --scale --text "Set the scroll sensitivity for the left nub for the Y-Axis.\nThe default value is 7. Higher value means more sensitive.\nA negative value inverts the axis." --min-value=-32 --max-value=32 --value=$curssense --step 1)
+      echo $newssense > /proc/pandora/nub0/scrolly_sensitivity
+      ;;
 
-fi
\ No newline at end of file
+  "nub0rate")
+      currate=$(cat /proc/pandora/nub0/scroll_rate)
+      newrate=$(zenity --scale --text "Set the scroll speed for the left nub.\nThe default value is 20. Higher value means more sensitive." --min-value=1 --max-value=40 --value=$currate --step 1)
+      echo $newrate > /proc/pandora/nub0/scroll_rate
+      ;;
+     
+  "nub0thres")
+      curthres=$(cat /proc/pandora/nub0/mbutton_threshold)
+      newthres=$(zenity --scale --text "Change the mousebutton sensitivity for the left nub.\nThe default value is 20.\nThe higher the value the higher you need to move the nub" --min-value=1 --max-value=40 --value=$curthres --step 1)
+      echo $newthres > /proc/pandora/nub0/mbutton_threshold
+      ;;
+
+  "nub1mode")
+      if nubm=$(zenity --height=300 --list --title="Select Nub-mode for the right nub" --text="Please select the modus for the right nub.\n\nNote: This can affect running programs.\nSome programs also may change the nub mode themselves."  --column "return" --hide-column=1 --column "Nub Mode" "mouse" "Use the nub as mouse" "mbuttons" "Use the nub for mousebuttons" "scroll" "Use the nub for scrolling" "absolute" "Use the nub as joystick") ; then
+
+      echo $nubm > /proc/pandora/nub1/mode
+      fi;;
+
+  "nub1msense")
+      curmsense=$(cat /proc/pandora/nub1/mouse_sensitivity)
+      newmsense=$(zenity --scale --text "Set speed for right nub mouse.\nThe default value is 150. Higher value means faster mouse." --min-value=50 --max-value=300 --value=$curmsense --step 1)
+      echo $newmsense > /proc/pandora/nub1/mouse_sensitivity
+      ;;
+    
+  "nub1ssense")
+       curssense=$(cat /proc/pandora/nub1/scrollx_sensitivity)
+      newssense=$(zenity --scale --text "Set the scroll sensitivity for the right nub for the X-Axis.\nThe default value is 7. Higher value means more sensitive.\nA negative value inverts the axis." --min-value=-32 --max-value=32 --value=$curssense --step 1)
+      echo $newssense > /proc/pandora/nub1/scrollx_sensitivity
+      curssense=$(cat /proc/pandora/nub1/scrolly_sensitivity)
+      newssense=$(zenity --scale --text "Set the scroll sensitivity for the right nub for the Y-Axis.\nThe default value is 7. Higher value means more sensitive.\nA negative value inverts the axis." --min-value=-32 --max-value=32 --value=$curssense --step 1)
+      echo $newssense > /proc/pandora/nub1/scrolly_sensitivity
+      ;;
+
+  "nub1rate")
+      currate=$(cat /proc/pandora/nub1/scroll_rate)
+      newrate=$(zenity --scale --text "Set the scroll speed for the right nub.\nThe default value is 20. Higher value means more sensitive." --min-value=1 --max-value=40 --value=$currate --step 1)
+      echo $newrate > /proc/pandora/nub1/scroll_rate
+      ;;
+     
+  "nub1thres")
+      curthres=$(cat /proc/pandora/nub1/mbutton_threshold)
+      newthres=$(zenity --scale --text "Change the mousebutton sensitivity for the right nub.\nThe default value is 20.\nThe higher the value the higher you need to move the nub" --min-value=1 --max-value=40 --value=$curthres --step 1)
+      echo $newthres > /proc/pandora/nub1/mbutton_threshold
+      ;;
+  "default")
+      echo mouse > /proc/pandora/nub0/mode
+      echo 150 > /proc/pandora/nub0/mouse_sensitivity
+      echo 7 > /proc/pandora/nub0/scrollx_sensitivity
+      echo 7 > /proc/pandora/nub0/scrolly_sensitivity
+      echo 20 > /proc/pandora/nub0/scroll_rate
+      echo 20 > /proc/pandora/nub0/mbutton_threshold
+      echo mbuttons > /proc/pandora/nub1/mode
+      echo 150 > /proc/pandora/nub1/mouse_sensitivity
+      echo 7 > /proc/pandora/nub1/scrollx_sensitivity
+      echo 7 > /proc/pandora/nub1/scrolly_sensitivity
+      echo 20 > /proc/pandora/nub1/scroll_rate
+      echo 20 > /proc/pandora/nub1/mbutton_threshold
+      zenity --info --title="Settings restored" --text "The default nub-settings have been restored." --timeout 6
+esac
+done
\ No newline at end of file