mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Benjamin Tissoires <bentiss@kernel.org>
To: Jiri Kosina <jikos@kernel.org>,
	 Peter Hutterer <peter.hutterer@who-t.net>,
	Shuah Khan <shuah@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kselftest@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	Benjamin Tissoires <bentiss@kernel.org>
Subject: [PATCH 3/3] selftests/hid: sync python tests to hid-tools 0.10
Date: Wed, 09 Jul 2025 11:08:51 +0200	[thread overview]
Message-ID: <20250709-wip-fix-ci-v1-3-b7df4c271cf8@kernel.org> (raw)
In-Reply-To: <20250709-wip-fix-ci-v1-0-b7df4c271cf8@kernel.org>

hid-tools 0.10 fixes one inconvenience introduced by
commit 6a9e76f75c1a ("HID: multitouch: Disable touchpad
on firmware level while not in use")

This change added a new callback when a hid-nultitouch device is opened
or closed to put the underlying device into a given operating mode.
However, in the test cases, that means that while the single threaded
test is run, it opens the device but has to react to the device while
the open() is still running. hid-tools now implements a minimal thread
to circumvent this.

This makes the HID kernel tests in sync with hid-tools 0.10.

This has the net effect of running the full HID python testsuite in 6
minutes instead of 1 hour.

Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
---
 tools/testing/selftests/hid/tests/base_device.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tools/testing/selftests/hid/tests/base_device.py b/tools/testing/selftests/hid/tests/base_device.py
index e13035fe1deb4c2ee5fd729d43c619bdd759c138..59465c58d94dfd3993ae87b25a62e444e93e0f66 100644
--- a/tools/testing/selftests/hid/tests/base_device.py
+++ b/tools/testing/selftests/hid/tests/base_device.py
@@ -23,6 +23,7 @@ import fcntl
 import functools
 import libevdev
 import os
+import threading
 
 try:
     import pyudev
@@ -344,10 +345,28 @@ class BaseDevice(UHIDDevice):
         if not self.kernel_is_ready or not self.started:
             return []
 
+        # Starting with kernel v6.16, an event is emitted when
+        # userspace opens a kernel device, and for some devices
+        # this translates into a SET_REPORT.
+        # Because EvdevDevice(path) opens every single evdev node
+        # we need to have a separate thread to process the incoming
+        # SET_REPORT or we end up having to wait for the kernel
+        # timeout of 5 seconds.
+        done = False
+
+        def dispatch():
+            while not done:
+                self.dispatch(1)
+
+        t = threading.Thread(target=dispatch)
+        t.start()
+
         self._input_nodes = [
             EvdevDevice(path)
             for path in self.walk_sysfs("input", "input/input*/event*")
         ]
+        done = True
+        t.join()
         return self._input_nodes
 
     def match_evdev_rule(self, application, evdev):

-- 
2.49.0


  parent reply	other threads:[~2025-07-09  9:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09  9:08 [PATCH 0/3] selftests/hid: upgrade the python scripts to match " Benjamin Tissoires
2025-07-09  9:08 ` [PATCH 1/3] selftests/hid: run ruff format on the python part Benjamin Tissoires
2025-07-09  9:08 ` [PATCH 2/3] selftests/hid: sync the python tests to hid-tools 0.8 Benjamin Tissoires
2025-07-10  2:58   ` Peter Hutterer
2025-07-09  9:08 ` Benjamin Tissoires [this message]
2025-07-10 14:21 ` [PATCH 0/3] selftests/hid: upgrade the python scripts to match hid-tools 0.10 Benjamin Tissoires

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=20250709-wip-fix-ci-v1-3-b7df4c271cf8@kernel.org \
    --to=bentiss@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=peter.hutterer@who-t.net \
    --cc=shuah@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®