Bluetooth panel shows no battery for classic HID devices (e.g. Keychron keyboards)
Bluetooth panel shows no battery for classic HID devices (e.g. Keychron keyboards)
What's wrong?
The Bluetooth panel shows the battery percentage for a MX Master 3S (Bluetooth LE with a GATT Battery Service) but never for a Keychron K3, even though the keyboard does report its battery — UPower sees it:
$ upower -d | grep -A 9 -i keychron
Device: /org/freedesktop/UPower/devices/battery_hid_dco2co26o26of6o4e_battery_3
native-path: hid-dc:2c:26:26:f6:4e-battery-3
model: Keychron K3
keyboard
present: yes
state: discharging
percentage: 14%
Why
DeviceRow.statusText in shell/plugins/panels/bluetooth/Panel.qml only reads dev.batteryAvailable, which comes from Quickshell.Bluetooth and is backed by BlueZ's org.bluez.Battery1. BlueZ only exposes that interface for GATT devices that advertise a standard Battery Service (0x180F). Classic (BR/EDR) HID devices never get it:
$ bluetoothctl info DC:2C:26:26:F6:4E # Keychron K3 — no Battery Percentage line
$ bluetoothctl info D8:9E:B0:0C:67:21 # MX Master 3S — Battery Percentage: 0x5f (95)
Classic HID devices report their charge through the kernel's HID power-device support instead, as a power_supply named after the device address (hid-dc:2c:26:26:f6:4e-battery-3), which UPower already lists. The panel just never consults it.
Expected
The battery percentage shows for any connected device that reports a battery, classic HID included.
Fix
Fall back to UPower when BlueZ reports no battery, matching the device address against the UPower entry's nativePath. Quickshell exposes this through Quickshell.Services.UPower with push updates, so no polling is involved. PR follows.
System details
- Omarchy 4.0.5-1, bluez 5.87-2, upower 1.91.5, quickshell 0.3.2
- CPU: Intel Core Ultra 5 125H, GPU: Intel Arc (Meteor Lake-P)
- Keyboard: Keychron K3 over classic Bluetooth HID; mouse: MX Master 3S over BLE
Reviewed against quattro (967bbdd73). The cause is as described: the Bluetooth panel decides whether to show a battery only from BlueZ's Battery1 (shell/plugins/panels/bluetooth/Model.js:96 copies batteryAvailable, and Panel.qml:921 shows a percentage only when it is set), and nothing in the shell reads peripheral batteries from UPower today, so a classic HID device whose charge arrives as a kernel hid-<address>-battery power supply shows nothing. BlueZ's classic input profile has no battery-provider integration, so this is not a configuration the user could change. Not reproduced: it needs a classic Bluetooth HID device, which a worker VM does not have.
The fix is already open as #15979, which closes this issue. Two older pull requests add the same UPower fallback matched by device address: #15107 (Apple trackpads, mice and keyboards) and #15143 (game controllers, with a charging state). Reading their matching logic against the hid-dc:2c:26:26:f6:4e-battery-3 path in this report, each of the three would show this keyboard's battery. They are being reviewed as their own items; which one lands is the maintainer's decision.
Second opinion: Codex Medium and muse-spark-1.3 (thinking high) each read the code separately and agreed on the cause and that all three pull requests match this device; their independence from this review is not guaranteed. Waiting on the maintainer to choose among #15107, #15143 and #15979.
I ran into the same gap with an Apple Magic Keyboard and Magic Trackpad, and I opened #16720 before I noticed this issue. It takes the same approach as #15979: it falls back to UPower and matches the device address against the hid-<address>-battery native path, so a Keychron K3 like this one would show its battery.
A few things it adds, in case they help the maintainer decide:
- Charging state. The label says
Chargingonly while charging, for exampleMagic Keyboard 49% · Charging, and otherwise just the percentage. - Battery on each device's row in the panel and in the bar icon's hover text. The icon itself stays a plain glyph, so one number never stands in for several devices.
- A wired keyboard that UPower sees but BlueZ doesn't gets its own read-only row under BATTERIES. A battery joins a device's row only when its native path or serial contains that device's address, so a cabled keyboard of the same model is never merged into the wrong row.
- Tests in
test/shell.d/bluetooth-test.shfor the address formats, charging-only labels, and the cabled-keyboard case.
Happy to fold any of this into whichever pull request lands, or close mine if that's simpler.
A fourth pull request now fixes this: #16720, which @JamesCaudill mentioned above. I read its Bluetooth panel changes against the native path in this report. upowerAddress in shell/plugins/panels/bluetooth/Model.js takes dc:2c:26:26:f6:4e out of hid-dc:2c:26:26:f6:4e-battery-3, a UPower keyboard counts as a peripheral, and the reading is matched to the connected keyboard by address. So it would show this keyboard's battery, as long as UPower reports a percentage. It uses the same UPower fallback by address as #15979, #15107 and #15143, and also adds a charging state and rows for batteries that match no Bluetooth device. When UPower and BlueZ both report a battery for a device, it shows UPower's. #16720 will be reviewed as its own item. Nothing was run, since this needs a classic Bluetooth HID device, which a worker VM does not have.
Second opinion: Codex Medium read the same diff and agreed that it covers this path. It also pointed out that UPower takes precedence over BlueZ. Its independence from this review is not guaranteed.
Still waiting on the maintainer to choose among #15107, #15143, #15979 and #16720.