pandora-scripts: make op_nubmode.py update nubs.state directly
authorGrazvydas Ignotas <notasas@gmail.com>
Mon, 20 Oct 2014 00:14:28 +0000 (03:14 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Mon, 20 Oct 2014 00:14:28 +0000 (03:14 +0300)
recipes/pandora-system/pandora-scripts.bb
recipes/pandora-system/pandora-scripts/op_nubmode.py
recipes/pandora-system/pandora-state.bb
recipes/pandora-system/pandora-state/rc.pandora-state

index 75ec856..9732249 100644 (file)
@@ -5,7 +5,7 @@ COMPATIBLE_MACHINE = "omap3-pandora"
 
 RDEPENDS = "bash sed gawk grep zenity"
 
-PR = "r162"
+PR = "r163"
 
 SRC_URI = " \
           file://op_bright.sh \
index 8183e8b..3086271 100755 (executable)
@@ -6,6 +6,7 @@ import sys
 import gtk
 import time
 import optparse
+import shutil
 
 # ================================================================
 
@@ -289,6 +290,10 @@ class NubConfig(object):
 
     def on_WriteNubConfig_clicked(self, widget, *data):
         StoreProc(self.model.settings)
+        shutil.copyfile("/etc/pandora/conf/nubs.state", "/tmp/nubs.state");
+        os.system("sed -i -e '1c\%s' /tmp/nubs.state" % self.model.settings['mode0'])
+        os.system("sed -i -e '7c\%s' /tmp/nubs.state" % self.model.settings['mode1'])
+        shutil.copyfile("/tmp/nubs.state", "/etc/pandora/conf/nubs.state");
         self.Notify("Nub configuration updated.")
 
     def on_SaveProfile_clicked(self, widget, *data):
index 7a38bf1..d989ad5 100755 (executable)
@@ -5,7 +5,7 @@ COMPATIBLE_MACHINE = "omap3-pandora"
 
 RDEPENDS = "pandora-scripts"
 
-PR = "r23"
+PR = "r24"
 inherit update-rc.d
 
 INITSCRIPT_NAME = "pandora-state"
index 144f1ff..3e785e7 100644 (file)
@@ -21,6 +21,8 @@ d_stop() {
        fi
        touch /etc/pandora/shutdown
        cat $SYSFS_GAMMA > /etc/pandora/conf/gamma.state
+
+       # pnd_run.sh and nub configurator depend on nubs.state format
         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
@@ -35,6 +37,9 @@ d_stop() {
        cat -v /proc/pandora/nub1/mbutton_threshold | sed -n '1p' >> /etc/pandora/conf/nubs.state
        cat -v /proc/pandora/nub0/mbutton_delay | sed -n '1p' >> /etc/pandora/conf/nubs.state
        cat -v /proc/pandora/nub1/mbutton_delay | sed -n '1p' >> /etc/pandora/conf/nubs.state
+
+       # nub tools want to update this file
+       chmod a+w /etc/pandora/conf/nubs.state
 }
 
 d_start() {