A limitation affecting various gaming headsets, graphic tablets, wireless earbuds, multi-device receivers and more with Linux has been not being able to report multiple batteries per HID device. After patches were proposed last year for dealing with the increasingly common scenario these days of having multiple batteries per device, the upcoming Linux 7.1 kernel is set to address this limitation.
The HID core code with the upcoming Linux 7.1 kernel is set to support multiple batteries per device. The HID device structure rather than being able to point to just one battery will now have a list of batteries with unique report IDs. API compatibility is retained for code expecting the “get battery” call to point just to a single battery to avoid any possible breakage.
This commit adjusting the hid-core and hid-input code is queued now into HID’s for-next Git branch ahead of the Linux 7.1 merge window in April.
That followed a restructuring of the HID battery code as part of the fore-next Git branch as well.
Lucas Zampieri has been working through the Linux HID code for being able to properly handle HID devices with multiple batteries. Among the multi-battery device scenarios noted in the patch series include gaming headsets with batteries in both the headset and charging dock, wireless earbuds with per-earbud batteries and charging case, and split keyboards with per-side barries. Now beginning with Linux 7.1, these devices with multiple batteries will be able to properly report their state.
While the kernel work is complete, user-space software can be better adapted to deal with multi-battery scenarios for enumerating all batteries, desktop environments can improve labeling of multiple-battery devices, and systemd entry updates for device-specific battery role mappings. More details within the prior v7 patch series.
