drivers/hid/hid-core.c | 4 + drivers/hid/hid-input.c | 193 +++++++++++++++++++++++++++------------- include/linux/hid.h | 42 ++++++++- 3 files changed, 176 insertions(+), 63 deletions(-)
This RFC introduces support for multiple batteries per HID device, addressing a long-standing architectural limitation in the HID battery reporting subsystem. ## Background The current HID implementation explicitly prevents multiple batteries per device through an early return in hidinput_setup_battery() that enforces a single-battery assumption. Linux treats peripheral batteries (scope=Device) differently from system batteries, with desktop environments often displaying them separately or ignoring them entirely. However, this design doesn't account for modern multi-battery hardware patterns. ## Problem Statement Multiple battery scenarios that cannot be properly reported today: 1. Gaming headsets with charging docks (e.g., SteelSeries Arctis Nova Pro Wireless) - headset battery reported, dock battery invisible 2. Graphics tablets with stylus batteries (Wacom) - requires driver-specific workarounds 3. Wireless earbuds with per-earbud batteries plus charging case 4. Multi-device receivers (Logitech Unifying) - requires proprietary HID++ protocol parsing This forces manufacturers to use proprietary protocols and vendor-specific software. Community projects parse USB packets directly because standard HID battery reporting cannot handle multi-battery scenarios. ## Why This Matters The current limitation creates a cycle: OS lacks support, so manufacturers implement proprietary protocols, which makes vendor software necessary, which reduces pressure to fix the OS limitation. Improving HID core support for multiple batteries would enable standardized reporting, reduce the need for vendor software, improve OS integration, reduce driver duplication, and provide a foundation for future multi-battery devices. ## Proposed Solution This patch introduces struct hid_battery to encapsulate individual battery state, adds a batteries list to struct hid_device for tracking multiple batteries, and uses report ID-based identification. The implementation maintains full backwards compatibility with existing single-battery code. ## Testing Tested with split keyboard hardware. Each battery reports independently through the power supply interface. ## Request for Comments Is list-based storage appropriate or would another structure work better? Should we support usage-based identification in addition to report ID for devices using the same report ID? Is sequential naming (battery-N) sufficient or should batteries have semantic role identifiers like "main", "stylus", "dock"? To HID maintainers (Jiri Kosina, Benjamin Tissoires): Does this belong in hid-input.c or should it be separate? Any concerns about the backwards compatibility approach? Meaning, should I have removed the whole dev->bat legacy mapping and use the new struct? To power supply maintainers (Sebastian Reichel): Any issues with multiple power_supply devices from a single HID device? Related commits: - c6838eeef2fb: HID: hid-input: occasionally report stylus battery - a608dc1c0639: HID: input: map battery system charging - fd2a9b29dc9c: HID: wacom: Remove AES power_supply after inactivity Community projects demonstrating the need: - HeadsetControl: https://github.com/Sapd/HeadsetControl - Solaar: https://github.com/pwr-Solaar/Solaar - OpenRazer: https://github.com/openrazer/openrazer Lucas Zampieri (1): HID: input: Add support for multiple batteries per device drivers/hid/hid-core.c | 4 + drivers/hid/hid-input.c | 193 +++++++++++++++++++++++++++------------- include/linux/hid.h | 42 ++++++++- 3 files changed, 176 insertions(+), 63 deletions(-) -- 2.51.1
© 2016 - 2026 Red Hat, Inc.