From: Zamiul Rashid via B4 Relay <devnull+zamiulrashid1.gmail.com@kernel.org>
To: Jiri Kosina <jikos@kernel.org>, Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
Zamiul Rashid <zamiulrashid1@gmail.com>
Subject: [PATCH 0/2] HID: battery reporting for Compx and Keychron Link mouse receivers
Date: Tue, 01 Dec 2026 10:15:35 +0600 [thread overview]
Message-ID: <20261201-compx-keychron-battery-v1-0-d5210d82dd67@gmail.com> (raw)
Two common 2.4 GHz mouse receivers do not describe the mouse battery
with standard HID usages, so the battery level never reaches userspace.
Each uses its own vendor protocol. I worked both out while writing
whiskerd [1], a small userspace daemon that reads these batteries
through hidraw today. These patches move that into the kernel so the
batteries show up in UPower without extra software.
Patch 1 adds hid-compx for Compx receivers (248a:5b2f), sold with
Ajazz, Delux, Genesis, Inphic and other mice. They answer a status
query on feature report 0x0c, which the driver polls.
Patch 2 adds hid-keychron for the Keychron Link receiver (3434:d031).
It pushes the battery level in input report 0x54 when the mouse
connects or wakes, and the driver listens for it.
Both drivers register a power_supply with scope Device once the first
reading has arrived. Tested on 7.0 with an Ajazz AJ179P and a Keychron
M6: the levels match what whiskerd reads, and UPower picks them up.
One note: both receivers also expose keyboard interfaces, and the
Keychron Link a joystick, so UPower currently labels the batteries
"keyboard" and "gaming-input". That comes from UPower's sibling-type
heuristic, not from these drivers.
[1] https://github.com/Zamiul-rashid/whiskerd
---
Zamiul Rashid (2):
HID: compx: add battery reporting for Compx 2.4 GHz receivers
HID: keychron: add battery reporting for the Keychron Link receiver
drivers/hid/Kconfig | 22 +++
drivers/hid/Makefile | 2 +
drivers/hid/hid-compx.c | 330 +++++++++++++++++++++++++++++++++++++++++++++
drivers/hid/hid-ids.h | 2 +
drivers/hid/hid-keychron.c | 236 ++++++++++++++++++++++++++++++++
5 files changed, 592 insertions(+)
---
base-commit: bb9d297a5b045256691b68ddd3aedd25595f527f
change-id: 20261201-compx-keychron-battery-97caad05a9f0
Best regards,
--
Zamiul Rashid <zamiulrashid1@gmail.com>
next reply other threads:[~2026-12-01 4:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 4:15 Zamiul Rashid via B4 Relay [this message]
2026-12-01 4:15 ` [PATCH 1/2] HID: compx: add battery reporting for Compx 2.4 GHz receivers Zamiul Rashid via B4 Relay
2026-12-01 4:15 ` [PATCH 2/2] HID: keychron: add battery reporting for the Keychron Link receiver Zamiul Rashid via B4 Relay
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=20261201-compx-keychron-battery-v1-0-d5210d82dd67@gmail.com \
--to=devnull+zamiulrashid1.gmail.com@kernel.org \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zamiulrashid1@gmail.com \
/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