diff options
| author | Benjamin Tissoires <bentiss@kernel.org> | 2025-07-09 11:08:51 +0200 |
|---|---|---|
| committer | Benjamin Tissoires <bentiss@kernel.org> | 2025-07-10 16:20:27 +0200 |
| commit | 1aee3a44fad2adeaa8f1a3aafd7c0154924af666 (patch) | |
| tree | 4c80f7579b17c9b589ed6cdd2ecc4e39d24fbcd0 | |
| parent | 642f9b2d608cc2239d22957ca1dc557d07470b50 (diff) | |
selftests/hid: sync python tests to hid-tools 0.10
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.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Link: https://patch.msgid.link/20250709-wip-fix-ci-v1-3-b7df4c271cf8@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
| -rw-r--r-- | tools/testing/selftests/hid/tests/base_device.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/testing/selftests/hid/tests/base_device.py b/tools/testing/selftests/hid/tests/base_device.py index e13035fe1deb..59465c58d94d 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): |
