[oe] [PATCH] xinput-calibrator: add --boot-mode comand line option to wrapper script

Mario Domenech Goulart mario at ossystems.com.br
Mon Feb 4 12:53:46 UTC 2013


xinput_calibrator_once.sh has been renamed to
run-xinput-calibrator.sh, which now also handles the --boot-mode
command line option.

When in boot mode (i.e., when --boot-mode is provided on the command
line), the script exits if calibration data is found in the
calibration data file.  When not in boot mode (i.e., no command line
option), the script runs xinput-calibrator and creates/overwrites the
calibration data file.

This change allows other applications to use a common wrapper
(run-xinput-calibrator.sh) for xinput-calibrator.

Signed-off-by: Mario Domenech Goulart <mario at ossystems.com.br>
---
 .../xinput-calibrator/boot-mode.patch              |   35 ++++++++++++++++++++
 .../xinput-calibrator/xinput-calibrator_git.bb     |    9 +++--
 2 files changed, 40 insertions(+), 4 deletions(-)
 create mode 100644 meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator/boot-mode.patch

diff --git a/meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator/boot-mode.patch b/meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator/boot-mode.patch
new file mode 100644
index 0000000..8af9fc4
--- /dev/null
+++ b/meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator/boot-mode.patch
@@ -0,0 +1,35 @@
+diff --git a/scripts/xinput_calibrator_pointercal.sh b/scripts/xinput_calibrator_pointercal.sh
+index fccb197..253455b 100755
+--- a/scripts/xinput_calibrator_pointercal.sh
++++ b/scripts/xinput_calibrator_pointercal.sh
+@@ -7,6 +7,7 @@
+ # original script: Martin Jansa <Martin.Jansa at gmail.com>, 2010-01-31
+ # updated by Tias Guns <tias at ulyssis.org>, 2010-02-15
+ # updated by Koen Kooi <koen at dominion.thruhere.net>, 2012-02-28
++# updated by Mario Domenech Goulart <mario at ossystems.com.br>, 2013-02-01
+ 
+ PATH="/usr/bin:$PATH"
+ 
+@@ -14,13 +15,21 @@ BINARY="xinput_calibrator"
+ CALFILE="/etc/pointercal.xinput"
+ LOGFILE="/var/log/xinput_calibrator.pointercal.log"
+ 
++# In boot mode, this script exits if calibration data is found in
++# $CALFILE.  If not in boot-mode, it runs the calibrator and
++# creates/overwrites $CALFILE (in other words: it always recalibrate).
++if [ "$1" = "--boot-mode" ]; then
++    BOOT_MODE=1
++fi
++
+ if [ -e $CALFILE ] ; then
+   if grep replace $CALFILE ; then
+     echo "Empty calibration file found, removing it"
+     rm $CALFILE
+   else
+     echo "Using calibration data stored in $CALFILE"
+-    . $CALFILE && exit 0
++    . $CALFILE
++    [ -z "$BOOT_MODE" ] || exit 0
+   fi
+ fi
+ 
diff --git a/meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb b/meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb
index 97f9343..21fd382 100644
--- a/meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb
+++ b/meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb
@@ -5,12 +5,13 @@ LIC_FILES_CHKSUM = "file://src/calibrator.cpp;endline=22;md5=1bcba08f67cdb56f340
 DEPENDS = "virtual/libx11 libxi"
 
 PV = "0.7.5+git${SRCPV}"
-PR = "r1"
+PR = "r2"
 
 inherit autotools
 
 SRCREV = "c01c5af807cb4b0157b882ab07a893df9a810111"
-SRC_URI = "git://github.com/tias/xinput_calibrator.git;protocol=git"
+SRC_URI = "git://github.com/tias/xinput_calibrator.git;protocol=git \
+           file://boot-mode.patch"
 
 S = "${WORKDIR}/git"
 
@@ -19,10 +20,10 @@ EXTRA_OECONF += "--with-gui=x11"
 
 do_install_append() {
         install -d ${D}${bindir}
-        install -m 0755 scripts/xinput_calibrator_pointercal.sh ${D}${bindir}/xinput_calibrator_once.sh
+        install -m 0755 scripts/xinput_calibrator_pointercal.sh ${D}${bindir}/run-xinput-calibrator.sh
 
         install -d ${D}${sysconfdir}/xdg/autostart
-        sed -i -e 's,^Exec=.*,Exec=${bindir}/xinput_calibrator_once.sh,' scripts/xinput_calibrator.desktop
+        sed -i -e 's,^Exec=.*,Exec=${bindir}/run-xinput-calibrator.sh --boot-mode,' scripts/xinput_calibrator.desktop
         install -m 0644 scripts/xinput_calibrator.desktop ${D}${sysconfdir}/xdg/autostart
 }
 
-- 
1.7.2.5





More information about the Openembedded-devel mailing list