Skip to contentSkip to conversation

xinput-calibrator: avoid defunct process

PATCH Superseded Mark Asselstine 2 participants 3 messages Aug 28, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

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

---
 ...r_pointercal.sh-allow-skipping-calib.patch | 32 +++++++++++++++++++
 .../xinput-calibrator_git.bb                  |  1 +
 2 files changed, 33 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 +32 -0
new file mode 100644
index 0000000000..a7fade3428
@@ -0,0 +1,32 @@
+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).
+
+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

✗ patchtest: failure for "xinput-calibrator: avoid defun..." and 1 more

In reply to Mark Asselstine

== Series Details ==

Series: "xinput-calibrator: avoid defun..." and 1 more
Revision: 1
URL : https://patchwork.openembedded.org/series/25842/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Added patch file is missing Upstream-Status in the header [test_upstream_status_presence_format]

  Suggested fix    Add Upstream-Status: <Valid status> to the header of meta/recipes-graphics/xinput-calibrator/xinput-calibrator/xinput_calibrator_pointercal.sh-allow-skipping-calib.patch
  Standard format  Upstream-Status: <Valid status>
  Valid status     Pending, Accepted, Backport, Denied, Inappropriate [reason], Submitted [where]

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe