Skip to contentSkip to conversation

xinput-calibrator: add --boot-mode comand line option to wrapper script

PATCH In review Mario Domenech Goulart 4 participants 7 messages Feb 4, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xinput-calibrator: add --boot-mode comand line option to wrapper script

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.

---
 .../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
meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator/boot-mode.patch new file +35 -0
new file mode 100644
index 0000000..8af9fc4
@@ -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 <[email protected]>, 2010-01-31
+ # updated by Tias Guns <[email protected]>, 2010-02-15
+ # updated by Koen Kooi <[email protected]>, 2012-02-28
++# updated by Mario Domenech Goulart <[email protected]>, 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
+ 
meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb +5 -4
index 97f9343..21fd382 100644
@@ -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
 }
 
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 4 lines · Mario Domenech Goulart

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

Quoted 8 lines

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.

Did you send this upstream?

Can you provide Upstream-Status?

Cheers,

Quoted 89 lines
---
 .../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
meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator/boot-mode.patch new file +35 -0
new file mode 100644
index 0000000..8af9fc4
@@ -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 <[email protected]>, 2010-01-31
+ # updated by Tias Guns <[email protected]>, 2010-02-15
+ # updated by Koen Kooi <[email protected]>, 2012-02-28
++# updated by Mario Domenech Goulart <[email protected]>, 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
+ 
meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb +5 -4
index 97f9343..21fd382 100644
@@ -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
 }
 
Signature · 7 lines
1.7.2.5


_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#2 lore raw
Quoted 101 lines · Martin Jansa
Quoted 4 lines · Mario Domenech Goulart

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

Quoted 8 lines

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.

Did you send this upstream?

Can you provide Upstream-Status?

Cheers,

Quoted 81 lines
---
 .../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
meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator/boot-mode.patch new file +35 -0
new file mode 100644
index 0000000..8af9fc4
@@ -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 <[email protected]>, 2010-01-31
+ # updated by Tias Guns <[email protected]>, 2010-02-15
+ # updated by Koen Kooi <[email protected]>, 2012-02-28
++# updated by Mario Domenech Goulart <[email protected]>, 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
+
meta-oe/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb +5 -4
index 97f9343..21fd382 100644
@@ -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
 }
 
Quoted 4 lines
Quoted 4 lines

--
1.7.2.5

I can't see what this patch fixes. From my point of view we have currently:

* two conflicting/racing start types systemd and xdg/autostart
* systemd service fails always - it doesn't know which display to use (error message something like 'cannot connect to xserver')
* xdg/autostart sometimes fails because the touchscreen devices are not yet known to xserver (error message something like 'no devices to calibrate devices found'). This causes calibration being started from time to time.

I am working on a complete different solution (udev/systemd automatic start) but need a few days to iron out & test. Can we wait few days before applying this to give me the chance to send an alternative? Sorry for this but I spent of efforts till now and wand to avoid rebasing.

Andreas

[1]

#3 lore raw

On Mon, Feb 4, 2013 at 11:49 AM, Andreas Müller
<[email protected]> wrote:
...

Quoted 1 line

I can't see what this patch fixes. From my point of view we have currently:

This allow us to re-run it from a running system; in our use-case user might want to re-run the colibration and without this patch it does not work.

Quoted 7 lines

* two conflicting/racing start types systemd and xdg/autostart
* systemd service fails always - it doesn't know which display to use (error message something like 'cannot connect to xserver')
* xdg/autostart sometimes fails because the touchscreen devices are not yet known to xserver (error message something like 'no devices to calibrate devices found'). This causes calibration being started from time to time.

You need to consider the use of serial touchscreen as well; we have here one which we can test your proposed patch. Bear on mind that user might want to run the calibration *again* so a script to support this needs to be add as well.

Quoted 5 lines

I am working on a complete different solution (udev/systemd automatic start) but need a few days to iron out & test. Can we wait few days before applying this to give me the chance to send an alternative? Sorry for this but I spent of efforts till now and wand to avoid rebasing.

If you plan to add support to our use-case too, sure. :-)

Regards,

--
Otavio Salvador O.S. Systems
E-mail: [email protected] http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br

#4 lore raw
Quoted 22 lines · Otavio Salvador

On Mon, Feb 4, 2013 at 11:49 AM, Andreas Müller
<[email protected]> wrote:
...

Quoted 1 line

I can't see what this patch fixes. From my point of view we have currently:

This allow us to re-run it from a running system; in our use-case user might want to re-run the colibration and without this patch it does not work.

Quoted 7 lines

* two conflicting/racing start types systemd and xdg/autostart
* systemd service fails always - it doesn't know which display to use (error message something like 'cannot connect to xserver')
* xdg/autostart sometimes fails because the touchscreen devices are not yet known to xserver (error message something like 'no devices to calibrate devices found'). This causes calibration being started from time to time.

You need to consider the use of serial touchscreen as well; we have here one which we can test your proposed patch. Bear on mind that user might want to run the calibration *again* so a script to support this needs to be add as well.

Quoted 7 lines
Quoted 5 lines

I am working on a complete different solution (udev/systemd automatic start) but need a few days to iron out & test. Can we wait few days before applying this to give me the chance to send an alternative? Sorry for this but I spent of efforts till now and wand to avoid rebasing.

If you plan to add support to our use-case too, sure. :-)

Hope I get it done soon (give me till end of week max) - your use-case included :)

Andreas

#5 lore raw
In reply to Martin Jansa

Hi Martin,

Quoted 11 lines · On Mon, 4 Feb 2013 13:02:12 +0100 Martin Jansa <[email protected]> wrote:
Quoted 10 lines · Mario Domenech Goulart

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.

Quoted 6 lines
Quoted 2 lines

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

Did you send this upstream?

Can you provide Upstream-Status?

Sorry, I messed up using git send-email (used a file as argument, which made it ignore --subject-prefix).

Since Andreas is working on a better solution, this patch can be ignored.

Sorry for the noise.

Best wishes.
Mario

#6 lore raw
Quoted 20 lines · Mario Domenech Goulart

Hi Martin,

Quoted 16 lines · On Mon, 4 Feb 2013 13:02:12 +0100 Martin Jansa <[email protected]> wrote:
Quoted 4 lines · Mario Domenech Goulart

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

Quoted 8 lines

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.

Did you send this upstream?

Quoted 7 lines
Quoted 1 line

Can you provide Upstream-Status?

Sorry, I messed up using git send-email (used a file as argument, which made it ignore --subject-prefix).

Since Andreas is working on a better solution, this patch can be ignored.

I still have one problem to be solved and it might be that my solution will not be accepted...

Quoted 2 lines

Sorry for the noise.

That was just two people working on same issue :)

Andreas