Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+19
+19
tools/testing/selftests/hid/tests/base_device.py
··· 23 23 import functools 24 24 import libevdev 25 25 import os 26 + import threading 26 27 27 28 try: 28 29 import pyudev ··· 345 344 if not self.kernel_is_ready or not self.started: 346 345 return [] 347 346 347 + # Starting with kernel v6.16, an event is emitted when 348 + # userspace opens a kernel device, and for some devices 349 + # this translates into a SET_REPORT. 350 + # Because EvdevDevice(path) opens every single evdev node 351 + # we need to have a separate thread to process the incoming 352 + # SET_REPORT or we end up having to wait for the kernel 353 + # timeout of 5 seconds. 354 + done = False 355 + 356 + def dispatch(): 357 + while not done: 358 + self.dispatch(1) 359 + 360 + t = threading.Thread(target=dispatch) 361 + t.start() 362 + 348 363 self._input_nodes = [ 349 364 EvdevDevice(path) 350 365 for path in self.walk_sysfs("input", "input/input*/event*") 351 366 ] 367 + done = True 368 + t.join() 352 369 return self._input_nodes 353 370 354 371 def match_evdev_rule(self, application, evdev):