selftests/hid: test battery queries with nonzero field offsets
PATCH v2 1/1 selftests/hid: test battery queries with nonzero field offsets
Commit d07644524b65 ("HID: input: read battery capacity from its actual report offset") fixed synchronous battery queries for reports that place the capacity byte after status fields.
Add a UHID mouse with the Magic Mouse 2 report layout and answer GET_REPORT with 90 04 5f. Read capacity before sending an input report so the test exercises the synchronous query path. Without the fix, it reads the status byte as 4%; with the fix, it reads capacity as 95%.
Enable CONFIG_HID_BATTERY_STRENGTH in the HID selftest configuration.
---
Changes in v2:
- Drop driver fix, superseded by d07644524b65.
- Rebase the regression test onto the current HID for-next branch.
- Amend commit message and tool-assistance trailer.
v1: https://lore.kernel.org/linux-input/[email protected]/
tools/testing/selftests/hid/config | 1 + .../testing/selftests/hid/tests/test_mouse.py | 54 +++++++++++++++++++ 2 files changed, 55 insertions(+)
tools/testing/selftests/hid/config +1 -0
@@ -16,6 +16,7 @@ CONFIG_FTRACE_SYSCALLS=y CONFIG_FUNCTION_TRACER=y CONFIG_HIDRAW=y CONFIG_HID=y +CONFIG_HID_BATTERY_STRENGTH=y CONFIG_HID_BPF=y CONFIG_INPUT_EVDEV=y CONFIG_UHID=y
tools/testing/selftests/hid/tests/test_mouse.py +54 -0
69 lines not on this page · raw message
base-commit: 931aaa59d1826f43b0bb3f07e21233f6faf4540a
Signature · 1 line
2.39.5 (Apple Git-154)