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

login
register
mail settings
Submitter Mario Domenech Goulart
Date Feb. 4, 2013, 12:53 p.m.
Message ID <1359982426-9836-1-git-send-email-mario@ossystems.com.br>
Download mbox | patch
Permalink /patch/44011/
State Changes Requested, archived
Headers show

Comments

Martin Jansa - Feb. 4, 2013, 12:02 p.m.
On Mon, Feb 04, 2013 at 10:53:46AM -0200, Mario Domenech Goulart wrote:
> 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.

Did you send this upstream?

Can you provide Upstream-Status?

Cheers,
 
> Signed-off-by: Mario Domenech Goulart <mario@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@gmail.com>, 2010-01-31
> + # updated by Tias Guns <tias@ulyssis.org>, 2010-02-15
> + # updated by Koen Kooi <koen@dominion.thruhere.net>, 2012-02-28
> ++# updated by Mario Domenech Goulart <mario@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
> 
> 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Mario Domenech Goulart - Feb. 4, 2013, 12:53 p.m.
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@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
Andreas Müller - Feb. 4, 2013, 1:49 p.m.
On Mon, Feb 4, 2013 at 1:02 PM, Martin Jansa <martin.jansa@gmail.com> wrote:
> On Mon, Feb 04, 2013 at 10:53:46AM -0200, Mario Domenech Goulart wrote:
>> 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.
>
> Did you send this upstream?
>
> Can you provide Upstream-Status?
>
> Cheers,
>
>> Signed-off-by: Mario Domenech Goulart <mario@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@gmail.com>, 2010-01-31
>> + # updated by Tias Guns <tias@ulyssis.org>, 2010-02-15
>> + # updated by Koen Kooi <koen@dominion.thruhere.net>, 2012-02-28
>> ++# updated by Mario Domenech Goulart <mario@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
>>
>>
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]
Otavio Salvador - Feb. 4, 2013, 3:39 p.m.
On Mon, Feb 4, 2013 at 11:49 AM, Andreas Müller
<schnitzeltony@googlemail.com> wrote:
...
> 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.

> * 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.

> 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: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
Mario Domenech Goulart - Feb. 4, 2013, 3:48 p.m.
Hi Martin,

On Mon, 4 Feb 2013 13:02:12 +0100 Martin Jansa <martin.jansa@gmail.com> wrote:

> On Mon, Feb 04, 2013 at 10:53:46AM -0200, Mario Domenech Goulart wrote:
>> 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.
>
> 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
Andreas Müller - Feb. 4, 2013, 3:50 p.m.
On Mon, Feb 4, 2013 at 4:39 PM, Otavio Salvador <otavio@ossystems.com.br> wrote:
> On Mon, Feb 4, 2013 at 11:49 AM, Andreas Müller
> <schnitzeltony@googlemail.com> wrote:
> ...
>> 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.
>
>> * 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.
>
>> 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
Andreas Müller - Feb. 4, 2013, 4:53 p.m.
On Mon, Feb 4, 2013 at 4:48 PM, Mario Domenech Goulart
<mario@ossystems.com.br> wrote:
> Hi Martin,
>
> On Mon, 4 Feb 2013 13:02:12 +0100 Martin Jansa <martin.jansa@gmail.com> wrote:
>
>> On Mon, Feb 04, 2013 at 10:53:46AM -0200, Mario Domenech Goulart wrote:
>>> 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.
>>
>> 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.
I still have one problem to be solved and it might be that my solution
will not be accepted...
>
> Sorry for the noise.
That was just two people working on same issue :)

Andreas

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@gmail.com>, 2010-01-31
+ # updated by Tias Guns <tias@ulyssis.org>, 2010-02-15
+ # updated by Koen Kooi <koen@dominion.thruhere.net>, 2012-02-28
++# updated by Mario Domenech Goulart <mario@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
 }