Skip to contentSkip to conversation

xinput-calibrator: avoid defunct process

PATCH In review Mark Asselstine 2 participants 4 messages Aug 28, 2020 – Sep 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 xinput-calibrator: avoid defunct process

The xinput_calibrator_once.sh script produces output on stdout and stderr which the current 'Exec' doesn't consume. This results in a [xinput_calibrator_once.sh] defunct process which will remain around until we exit the X11 session.

Add a redirect to the Exec which will consume this output and avoid the defunct process.

---

V2: * no changes

 .../recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb +1 -1
index 4f831932e7..c59f97895c 100644
@@ -31,7 +31,7 @@ do_install_append() {
     install -m 0755 ${WORKDIR}/30xinput_calibrate.sh ${D}${sysconfdir}/X11/Xsession.d/
 
     install -d ${D}${sysconfdir}/xdg/autostart
-    sed -e 's,^Exec=.*,Exec=${bindir}/xinput_calibrator_once.sh,' ${S}/scripts/xinput_calibrator.desktop > ${D}${sysconfdir}/xdg/autostart/xinput_calibrator.desktop
+    sed -e 's,^Exec=.*,Exec=${bindir}/sh -c "${bindir}/xinput_calibrator_once.sh 2>\&1 > /dev/null",' ${S}/scripts/xinput_calibrator.desktop > ${D}${sysconfdir}/xdg/autostart/xinput_calibrator.desktop
 }
 
 FILES_${PN} += "${sysconfdir}/xdg/autostart"
Signature · 1 line
2.27.0
#1 lore raw

PATCH v2 2/2 xinput-calibrator: make _once run only once

If no calibratable devices are found then no calibration is written. With no configuration file created each and every login will result in a fresh attempt to perform calibrations, which is undesirable for many reasons. Since HW doesn't change often we are better off writing an 'empty' calibration file to avoid further attempts to perform calibration. If new HW is added the file can simply be removed to force a new calibration attempt.

---

V2: * add Upstream-status to the patch

 ...r_pointercal.sh-allow-skipping-calib.patch | 34 +++++++++++++++++++
 .../xinput-calibrator_git.bb                  |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 meta/recipes-graphics/xinput-calibrator/xinput-calibrator/xinput_calibrator_pointercal.sh-allow-skipping-calib.patch
meta/recipes-graphics/xinput-calibrator/xinput-calibrator/xinput_calibrator_pointercal.sh-allow-skipping-calib.patch new file +34 -0
new file mode 100644
index 0000000000..d28b623313
@@ -0,0 +1,34 @@
+From d89d5e25a805d5ccc6d9fb2245da45cdc6b5ac33 Mon Sep 17 00:00:00 2001
+From: Mark Asselstine <[email protected]>
+Date: Fri, 28 Aug 2020 14:48:40 -0400
+Subject: [PATCH] xinput_calibrator_pointercal.sh: allow skipping calibration
+
+If no suitable devices are found then no configuration file will be
+written. This results in a new attempt to perform calibration on every
+login. Instead we write an "empty" file with just some brief
+instructions on how to force a new calibration. This will result in a
+calibration attempt only being run on the first login (future logins
+have things end with the sourcing of an empty config only).
+
+Upstream-Status: Inappropriate as only Yocto uses this as a 'once' script
+
+Signed-off-by: Mark Asselstine <[email protected]>
+---
+ scripts/xinput_calibrator_pointercal.sh | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/scripts/xinput_calibrator_pointercal.sh b/scripts/xinput_calibrator_pointercal.sh
+index 0ada7da..a331af1 100755
+--- a/scripts/xinput_calibrator_pointercal.sh
++++ b/scripts/xinput_calibrator_pointercal.sh
+@@ -41,4 +41,7 @@ CALDATA=`$BINARY --output-type xinput -v | tee $LOGFILE | grep '    xinput set'
+ if [ ! -z "$CALDATA" ] ; then
+   echo $CALDATA > $CALFILE
+   echo "Calibration data stored in $CALFILE (log in $LOGFILE)"
++else
++  echo "# Delete this file to force xinput_calibrator to redo calibration" > $CALFILE
++  echo "Created $CALFILE as an empty calibration file, no devices found."
+ fi
+-- 
+2.27.0
+
meta/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb +1 -0
index c59f97895c..6f4ea03958 100644
@@ -16,6 +16,7 @@ SRC_URI = "git://github.com/tias/xinput_calibrator.git \
            file://30xinput_calibrate.sh \
            file://Allow-xinput_calibrator_pointercal.sh-to-be-run-as-n.patch \
            file://0001-calibrator.hh-Include-string-to-get-std-string.patch \
+           file://xinput_calibrator_pointercal.sh-allow-skipping-calib.patch \
            "
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.27.0
#2 lore raw
In reply to Mark Asselstine
Quoted 21 lines · Mark Asselstine

The xinput_calibrator_once.sh script produces output on stdout and stderr which the current 'Exec' doesn't consume. This results in a [xinput_calibrator_once.sh] defunct process which will remain around until we exit the X11 session.

Add a redirect to the Exec which will consume this output and avoid the defunct process.

---

V2: * no changes

 .../recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb +0 -0
index 4f831932e7..c59f97895c 100644

meta/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb do_install_append() { · line 37

Quoted 8 lines
meta/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb +1 -1
@@ -31,7 +31,7 @@ do_install_append() {
     install -m 0755 ${WORKDIR}/30xinput_calibrate.sh ${D}${sysconfdir}/X11/Xsession.d/
 
     install -d ${D}${sysconfdir}/xdg/autostart
-    sed -e 's,^Exec=.*,Exec=${bindir}/xinput_calibrator_once.sh,' ${S}/scripts/xinput_calibrator.desktop > ${D}${sysconfdir}/xdg/autostart/xinput_calibrator.desktop
+    sed -e 's,^Exec=.*,Exec=${bindir}/sh -c "${bindir}/xinput_calibrator_once.sh 2>\&1 > /dev/null",' ${S}/scripts/xinput_calibrator.desktop > ${D}${sysconfdir}/xdg/autostart/xinput_calibrator.desktop
 }
 
 FILES_${PN} += "${sysconfdir}/xdg/autostart"

That appears to fail in testing:

https://autobuilder.yoctoproject.org/typhoon/#/builders/110/builds/1281/steps/8/logs/step1c

Presumably it should be base_bindir?

Cheers,

Richard

#3 lore raw
Quoted 38 lines · On Tuesday, September 1, 2020 11:30:23 A.M. EDT Richard Purdie wrote:
Quoted 37 lines · Mark Asselstine

The xinput_calibrator_once.sh script produces output on stdout and stderr which the current 'Exec' doesn't consume. This results in a [xinput_calibrator_once.sh] defunct process which will remain around until we exit the X11 session.

Add a redirect to the Exec which will consume this output and avoid the defunct process.

---

V2: * no changes

 .../recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb b/meta/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb index 4f831932e7..c59f97895c 100644

meta/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb +0 -1
@@ -31,7 +31,7 @@ do_install_append() {
 
     install -m 0755 ${WORKDIR}/30xinput_calibrate.sh
     ${D}${sysconfdir}/X11/Xsession.d/
 
     install -d ${D}${sysconfdir}/xdg/autostart
 
-    sed -e 's,^Exec=.*,Exec=${bindir}/xinput_calibrator_once.sh,'

${S}/scripts/xinput_calibrator.desktop >
${D}${sysconfdir}/xdg/autostart/xinput_calibrator.desktop + sed -e
's,^Exec=.*,Exec=${bindir}/sh -c "${bindir}/xinput_calibrator_once.sh 2>\&1 > /dev/null",' ${S}/scripts/xinput_calibrator.desktop > ${D}${sysconfdir}/xdg/autostart/xinput_calibrator.desktop>
}

Quoted 8 lines
Quoted 1 line

FILES_${PN} += "${sysconfdir}/xdg/autostart"

That appears to fail in testing:

https://autobuilder.yoctoproject.org/typhoon/#/builders/110/builds/1281/step
s/8/logs/step1c

Presumably it should be base_bindir?

Sorry about that Richard. The configuration I tested with had no issue but obviously this wasn't universal. As you should have seen when I was looking into another XFCE startup issue it made me question my fix and so we should hold off on this change regardless, until I have dug in further to the bigger root cause.

Thanks,
Mark

Quoted 4 lines

Cheers,

Richard