Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH 0/2] HID: fix battery queries with nonzero field offsets
@ 2026-07-12  4:47 Mason Camara
  2026-07-12  4:47 ` [PATCH 1/2] HID: input: honor report field offsets in battery queries Mason Camara
  2026-07-12  4:47 ` [PATCH 2/2] selftests/hid: test battery queries with nonzero field offsets Mason Camara
  0 siblings, 2 replies; 3+ messages in thread
From: Mason Camara @ 2026-07-12  4:47 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires
  Cc: Shuah Khan, John Chen, linux-input, linux-kselftest, linux-kernel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-12  4:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-12  4:47 [PATCH 0/2] HID: fix battery queries with nonzero field offsets Mason Camara
2026-07-12  4:47 ` [PATCH 1/2] HID: input: honor report field offsets in battery queries Mason Camara
2026-07-12  4:47 ` [PATCH 2/2] selftests/hid: test battery queries with nonzero field offsets Mason Camara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox