Linux Input/HID development
 help / color / mirror / Atom feed
From: "Stephen J. Fuhry" <fuhrysteve@gmail.com>
To: linux-input@vger.kernel.org
Cc: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <bentiss@kernel.org>,
	linux-kernel@vger.kernel.org,
	"Stephen J. Fuhry" <fuhrysteve@gmail.com>,
	stable@vger.kernel.org
Subject: [PATCH] HID: input: ignore the battery of Keychron keyboards over Bluetooth
Date: Wed, 14 Oct 2026 11:25:05 -0400	[thread overview]
Message-ID: <20261014152505.2523337-1-fuhrysteve@gmail.com> (raw)

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


                 reply	other threads:[~2026-10-14 15:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261014152505.2523337-1-fuhrysteve@gmail.com \
    --to=fuhrysteve@gmail.com \
    --cc=bentiss@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox