All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] weston-init: update initscript to store calibration on SD card
@ 2014-12-09  2:20 Denys Dmytriyenko
  2014-12-09 15:47 ` Carlos Hernandez
  0 siblings, 1 reply; 3+ messages in thread
From: Denys Dmytriyenko @ 2014-12-09  2:20 UTC (permalink / raw)
  To: meta-arago

From: Denys Dmytriyenko <denys@ti.com>

Signed-off-by: Denys Dmytriyenko <denys@ti.com>
---
 .../recipes-graphics/wayland/weston-init.bbappend  |  2 +-
 .../recipes-graphics/wayland/weston-init/init      | 43 +++++++++++++++++-----
 2 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend b/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend
index 0d76e3b..7825618 100644
--- a/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend
+++ b/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend
@@ -1,3 +1,3 @@
-PR_append = "-arago2"
+PR_append = "-arago3"
 
 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
diff --git a/meta-arago-distro/recipes-graphics/wayland/weston-init/init b/meta-arago-distro/recipes-graphics/wayland/weston-init/init
index 834de4d..b2a2567 100644
--- a/meta-arago-distro/recipes-graphics/wayland/weston-init/init
+++ b/meta-arago-distro/recipes-graphics/wayland/weston-init/init
@@ -32,7 +32,7 @@ case "$1" in
 
         # This is all a nasty hack
         if test -z "$XDG_RUNTIME_DIR"; then
-                export XDG_RUNTIME_DIR=/run/user/root
+            export XDG_RUNTIME_DIR=/run/user/root
         fi
 
         if [ ! -d "$XDG_RUNTIME_DIR" ] ; then
@@ -42,23 +42,48 @@ case "$1" in
 
         openvt -s weston
 
-        # Handle touchscreen calibration
+        # If there's no touchscreen device available, done
         if [ ! -e /dev/input/touchscreen0 ] ; then
-                exit 0
+            exit 0
         fi
 
-        if [ ! -f $WS_CALUDEV_FILE ] ; then
+        # If it was already calibrated, done
+        if [ -f "$WS_CALUDEV_FILE" ] ; then
+            exit 0
+        fi
+
+        # Check if SD card is mounted
+        mount | grep /run/media/mmcblk0p1 | grep vfat > /dev/null 2>&1
+        if [ "$?" = "0" ] ; then
+            SD_MOUNTED="1"
+        else
+            SD_MOUNTED="0"
+        fi
+
+        # Check if SD card has a calibration rules file
+        SD_CALUDEV_FILE=/run/media/mmcblk0p1/ws-calibrate.rules
+        if [ "$SD_MOUNTED" = "1" -a -f "$SD_CALUDEV_FILE" ] ; then
+            # Copy it over to udev location
+            cp "$SD_CALUDEV_FILE" "$WS_CALUDEV_FILE"
+        else
+            # Run a calibration app and save output to udev rules
             echo -n "Calibrating touchscreen (first time only)"
             sleep 1
             CAL_VALUES=`weston-calibrator|cut -c21-`
             echo 'SUBSYSTEM=="input", ENV{WL_CALIBRATION}="'$CAL_VALUES'"' > $WS_CALUDEV_FILE
             echo "."
-            udevadm control --reload
-            udevadm trigger
-            killproc weston
-            sleep 1
-            openvt -s weston
+            # Copy it back to SD
+            if [ "$SD_MOUNTED" = "1" ] ; then
+                cp "$WS_CALUDEV_FILE" "$SD_CALUDEV_FILE"
+            fi
         fi
+
+        # Reload and re-run udev rules and restart weston
+        udevadm control --reload
+        udevadm trigger
+        killproc weston
+        sleep 1
+        openvt -s weston
   ;;
 
   stop)
-- 
2.1.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-09 15:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-09  2:20 [PATCH] weston-init: update initscript to store calibration on SD card Denys Dmytriyenko
2014-12-09 15:47 ` Carlos Hernandez
2014-12-09 15:54   ` Denys Dmytriyenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.