Magic Mouse 2 input report 0x90 places a status byte before the capacity
field. The synchronous battery query treats that byte as capacity and
reports 4% in sysfs when the device reports 95%.
Use the field offset and width from the report descriptor when processing
GET_REPORT responses, and add a UHID regression test.
Tool use:
Codex (GPT-5) reviewed the completed series for submission-process,
formatting, commit-message issues, and suggested edits to the commit
messages. The code and test were written without AI assistance. I
reviewed all resulting changes and take responsibility for the series.
Testing:
- W=1 builds of drivers/hid/hid-input.o with
CONFIG_HID_BATTERY_STRENGTH=y and =n
- v7.2-rc2 plus patch 2 only: FAIL (capacity 4, expected 95)
- v7.2-rc2 plus the complete series: PASS
Mason Camara (2):
HID: input: honor report field offsets in battery queries
selftests/hid: test battery queries with nonzero field offsets
drivers/hid/hid-input.c | 39 ++++++++++----
include/linux/hid.h | 6 +++
tools/testing/selftests/hid/config | 1 +
.../testing/selftests/hid/tests/test_mouse.py | 54 +++++++++++++++++++
4 files changed, 90 insertions(+), 10 deletions(-)
base-commit: 8cdeaa50eae8dad34885515f62559ee83e7e8dda
--
2.55.0