Skip to content

Commit 1aee3a4

Browse files
author
Benjamin Tissoires
committed
selftests/hid: sync python tests to hid-tools 0.10
hid-tools 0.10 fixes one inconvenience introduced by commit 6a9e76f ("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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent 642f9b2 commit 1aee3a4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tools/testing/selftests/hid/tests/base_device.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import functools
2424
import libevdev
2525
import os
26+
import threading
2627

2728
try:
2829
import pyudev
@@ -344,10 +345,28 @@ def input_nodes(self: "BaseDevice") -> List[EvdevDevice]:
344345
if not self.kernel_is_ready or not self.started:
345346
return []
346347

348+
# Starting with kernel v6.16, an event is emitted when
349+
# userspace opens a kernel device, and for some devices
350+
# this translates into a SET_REPORT.
351+
# Because EvdevDevice(path) opens every single evdev node
352+
# we need to have a separate thread to process the incoming
353+
# SET_REPORT or we end up having to wait for the kernel
354+
# timeout of 5 seconds.
355+
done = False
356+
357+
def dispatch():
358+
while not done:
359+
self.dispatch(1)
360+
361+
t = threading.Thread(target=dispatch)
362+
t.start()
363+
347364
self._input_nodes = [
348365
EvdevDevice(path)
349366
for path in self.walk_sysfs("input", "input/input*/event*")
350367
]
368+
done = True
369+
t.join()
351370
return self._input_nodes
352371

353372
def match_evdev_rule(self, application, evdev):

0 commit comments

Comments
 (0)