* [PATCH] HID: input: ignore the battery of Keychron keyboards over Bluetooth
@ 2026-10-14 15:25 Stephen J. Fuhry
0 siblings, 0 replies; only message in thread
From: Stephen J. Fuhry @ 2026-10-14 15:25 UTC (permalink / raw)
To: linux-input
Cc: Jiri Kosina, Benjamin Tissoires, linux-kernel, Stephen J. Fuhry,
stable
Keychron keyboards identify as Apple's wired aluminium keyboard, rev B
ANSI (05ac:024f), when connected over Bluetooth. hid-apple has bound
that ID over Bluetooth since commit ebe0b42a4252 ("HID: apple: Add
support for Keychron K1 wireless keyboard"). The Keychron K8 tested
here does the same, whichever position its Mac/Windows switch is in.
The report descriptor declares a battery, so hid-input creates a
power_supply node for it. The keyboard never answers the battery
feature report. Every read of the node blocks for the full 5 second
uhid timeout and then returns -ENODATA:
$ time cat .../power_supply/hid-<addr>-battery/capacity
cat: ...: No data available
real 0m5.10s
Anything that enumerates devices pays this on every pass. With the
keyboard connected, "udevadm info --export-db" took 10 to 26 seconds;
with it disconnected, 0.11 seconds. KDE's Solid library enumerates
devices on the GUI thread, so Dolphin and the Plasma panel froze for the
same 10 to 26 seconds. upower already gives up on the device and does
not list it.
0x024f is a wired-only Apple product, so a Bluetooth device using it is
not a genuine Apple keyboard. Ignore its battery so the node is never
created. AVOID_QUERY would stop the blocking read, but the K8 does not
send the battery in its input reports either. The node would then stay
at its initial capacity of 0 with status Unknown, which looks like an
empty battery.
Cc: stable@vger.kernel.org
Signed-off-by: Stephen J. Fuhry <fuhrysteve@gmail.com>
---
Tested on 7.2.6 (Debian trixie-backports base) on a ThinkPad T14
Gen 3 with a Keychron K8 paired over Bluetooth: no battery node is
created and "udevadm info --export-db" takes 0.12 s with the keyboard
connected. The keyboard types normally and hid-apple still binds it.
I have only the K8 to test. If another Keychron model on this ID does
answer the battery report, this hides its battery level. I do not know
whether any does.
drivers/hid/hid-input.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index edd6bbf..380ff8a 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -381,6 +381,15 @@ static const struct hid_device_id hid_battery_quirks[] = {
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM,
USB_DEVICE_ID_ELECOM_BM084),
HID_BATTERY_QUIRK_IGNORE },
+ /*
+ * Keychron keyboards in Bluetooth mode reuse the product ID of
+ * Apple's wired aluminium keyboard. They declare a battery but never
+ * answer the battery feature report, so each read blocks for the full
+ * uhid timeout and then fails with -ENODATA.
+ */
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
+ USB_DEVICE_ID_APPLE_ALU_REVB_ANSI),
+ HID_BATTERY_QUIRK_IGNORE },
{ HID_USB_DEVICE(USB_VENDOR_ID_SYMBOL,
USB_DEVICE_ID_SYMBOL_SCANNER_3),
HID_BATTERY_QUIRK_IGNORE },
--
2.47.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-14 15:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-14 15:25 [PATCH] HID: input: ignore the battery of Keychron keyboards over Bluetooth Stephen J. Fuhry
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox