All of lore.kernel.org
 help / color / mirror / Atom feed
From: <rs@ti.com>
To: <reatmon@ti.com>, <denis@denix.org>, <afd@ti.com>, <detheridge@ti.com>
Cc: <meta-arago@lists.yoctoproject.org>, Randolph Sapp <rs@ti.com>
Subject: [arago][kirkstone][PATCH 7/7] weston-init: add a simple touchscreen calibration check
Date: Wed, 24 May 2023 13:11:22 -0500	[thread overview]
Message-ID: <20230524181122.35202-8-rs@ti.com> (raw)
In-Reply-To: <20230524181122.35202-1-rs@ti.com>

From: Randolph Sapp <rs@ti.com>

The old touchscreen calibration script created a generic UDEV rule for
all touch devices that applied the LIBINPUT_CALIBRATION_MATRIX of the
last calibrated display. This attempts to replace that to an extent.

This script executes at the start of Weston and if it detects a touch
input device, uses Weston's built in touchscreen calibrator and
touchscreen calibrator interface to apply the current calibration
without restarting Weston. This script does not attempt to make these
calibration values persistent.

If a user wants calibration values to persist for all Weston users they
should add the calibration to /etc/default/weston using the
LIBINPUT_CALIBRATION_MATRIX variable themselves. The script will bypass
calibration if it detects this variable is already set.

Signed-off-by: Randolph Sapp <rs@ti.com>
---
 .../recipes-graphics/wayland/weston-init.bbappend   | 13 ++++++++++---
 .../wayland/weston-init/weston-launch-calibrator.sh | 13 +++++++++++++
 .../recipes-graphics/wayland/weston-init/weston.ini |  4 ++++
 3 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston-init/weston-launch-calibrator.sh

diff --git a/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend b/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend
index a73b669d..4d5db58c 100644
--- a/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend
+++ b/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend
@@ -2,6 +2,13 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
 
 PR:append = ".arago12"
 
-#SRC_URI:append = " \
-#    file://weston.ini \
-#"
+SRC_URI:append = " \
+    file://weston.ini \
+    file://weston-launch-calibrator.sh \
+"
+
+do_install:append() {
+    install -Dm755 weston-launch-calibrator.sh ${D}/${bindir}/weston-launch-calibrator
+}
+
+FILES:${PN}:append = "${bindir}/weston-launch-calibrator"
diff --git a/meta-arago-distro/recipes-graphics/wayland/weston-init/weston-launch-calibrator.sh b/meta-arago-distro/recipes-graphics/wayland/weston-init/weston-launch-calibrator.sh
new file mode 100644
index 00000000..45863ecd
--- /dev/null
+++ b/meta-arago-distro/recipes-graphics/wayland/weston-init/weston-launch-calibrator.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if [ -e /dev/input/touchscreen0 ]; then
+	echo "Touch screen detected..."
+	if [ -n "$LIBINPUT_CALIBRATION_MATRIX" ]; then
+		echo "Calibration matrix already present, skipping calibration..."
+	else
+		echo "Calibrating touchscreen..."
+		exec weston-calibrator
+	fi
+else
+	echo "Touch screen not detected, skipping calibration..."
+fi
diff --git a/meta-arago-distro/recipes-graphics/wayland/weston-init/weston.ini b/meta-arago-distro/recipes-graphics/wayland/weston-init/weston.ini
index 4cc2683a..b9610fa8 100644
--- a/meta-arago-distro/recipes-graphics/wayland/weston-init/weston.ini
+++ b/meta-arago-distro/recipes-graphics/wayland/weston-init/weston.ini
@@ -11,6 +11,10 @@ startup-animation=fade
 [libinput]
 touchscreen_calibrator=true
 
+[autolaunch]
+# launch the calibrator on startup if a touchscreen is detected
+path=/usr/bin/weston-launch-calibrator
+
 [screensaver]
 # Uncomment path to disable screensaver
 #path=@libexecdir@/weston-screensaver
-- 
2.40.1



      parent reply	other threads:[~2023-05-24 18:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24 18:11 [arago][kirkstone][PATCH 0/7] Rootless Weston and Weston patch cleanup rs
2023-05-24 18:11 ` [arago][kirkstone][PATCH 1/7] weston-init: drop all the old append logic rs
2023-05-24 18:11 ` [arago][kirkstone][PATCH 2/7] weston: drop Fix-touch-screen-crash patch rs
2023-05-24 18:11 ` [arago][kirkstone][PATCH 3/7] weston: drop allow-visual_id-to-be-0 patch rs
2023-05-24 18:11 ` [arago][kirkstone][PATCH 4/7] weston: add notice about select-plane patch rs
2023-05-24 18:11 ` [arago][kirkstone][PATCH 5/7] weston: add weston user to the render group rs
2023-05-24 18:11 ` [arago][kirkstone][PATCH 6/7] weston: drop the fix-virtual-keyboard-display-issue patch rs
2023-05-24 18:11 ` rs [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230524181122.35202-8-rs@ti.com \
    --to=rs@ti.com \
    --cc=afd@ti.com \
    --cc=denis@denix.org \
    --cc=detheridge@ti.com \
    --cc=meta-arago@lists.yoctoproject.org \
    --cc=reatmon@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.