* [RFC] Writing a Driver for Xinmeng M71 Keyboard (Battery Status Support)
@ 2025-06-22 11:32 Saalim Quadri
2025-06-22 21:02 ` Jiri Kosina
0 siblings, 1 reply; 3+ messages in thread
From: Saalim Quadri @ 2025-06-22 11:32 UTC (permalink / raw)
To: lains; +Cc: jikos, bentiss, gregkh, linux-input, linux-kernel
Hello everyone,
I'm currently working with a Xinmeng M71 wireless keyboard, which is recognized by the kernel as a hid-generic device and functions well.
I'd like to extend its support in Linux by writing a driver that can expose its battery status to userspace,
I used hidtools to record descriptors of the keyboards, I discharged my keyboard over the week and charged it and recorded the responses from it,
like when it started charging/discharging, I saw hex values change reporting me the percentage of the charge
E: 000002.772731 20 13 0a 01 00 04 05 63 01 00 00 00 00 00 00 00 00 00 00 00 8b
# ReportID: 19 /Array ['0a', '01', '0xff020002', '04', '05', '63', '11', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '9b']
E: 000005.642942 20 13 0a 01 00 04 05 63 11 00 00 00 00 00 00 00 00 00 00 00 9b
# ReportID: 19 /Array ['0a', '01', '0xff020002', '04', '05', '64', '11', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '0xff020002', '9c']
E: 000005.860767 20 13 0a 01 00 04 05 64 11 00 00 00 00 00 00 00 00 00 00 00 9c
I would appreciate guidance on, how can I continue this, I am familiar with Linux Kernel and writing drivers, but would like to ask some pointers regarding the same.
I saw a reference that logitech HID driver uses it, but it looked quite complex to me.
I'm comfortable writing kernel C code but relatively new to the HID subsystem. Any documentation pointers, example patches, or suggestions to get started would be highly appreciated.
Looking forward to your responses.
Thank you very much,
Sincerely,
Saalim Quadri
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] Writing a Driver for Xinmeng M71 Keyboard (Battery Status Support)
2025-06-22 11:32 [RFC] Writing a Driver for Xinmeng M71 Keyboard (Battery Status Support) Saalim Quadri
@ 2025-06-22 21:02 ` Jiri Kosina
2025-06-23 13:03 ` Saalim Quadri
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Kosina @ 2025-06-22 21:02 UTC (permalink / raw)
To: Saalim Quadri; +Cc: lains, bentiss, gregkh, linux-input, linux-kernel
On Sun, 22 Jun 2025, Saalim Quadri wrote:
> I would appreciate guidance on, how can I continue this, I am familiar
> with Linux Kernel and writing drivers, but would like to ask some
> pointers regarding the same. I saw a reference that logitech HID driver
> uses it, but it looked quite complex to me.
>
> I'm comfortable writing kernel C code but relatively new to the HID
> subsystem. Any documentation pointers, example patches, or suggestions
> to get started would be highly appreciated.
Yeah, Logitech is probably the most complex (and thus not really
appropriate :) ) driver to pick when trying to understand something. It's
quite complex.
Specifically for handling battery interface, I'd suggest looking into some
way more trivial driver that also exposes battery interface (in the most
straightforward way) for inspiration, e.g. hid-asus, hid-kysona ...
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] Writing a Driver for Xinmeng M71 Keyboard (Battery Status Support)
2025-06-22 21:02 ` Jiri Kosina
@ 2025-06-23 13:03 ` Saalim Quadri
0 siblings, 0 replies; 3+ messages in thread
From: Saalim Quadri @ 2025-06-23 13:03 UTC (permalink / raw)
To: jikos; +Cc: bentiss, danascape, gregkh, lains, linux-input, linux-kernel
Thank you very much for the response,
I was able to parse the raw event and get the data, I am currently trying to figure out how to fetch the data on-demand and read the values,
I took hid-kysona as reference.
I will be sending a patch soon for reviews
Thank you very much,
Sincerely,
Saalim Quadri
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-23 13:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-22 11:32 [RFC] Writing a Driver for Xinmeng M71 Keyboard (Battery Status Support) Saalim Quadri
2025-06-22 21:02 ` Jiri Kosina
2025-06-23 13:03 ` Saalim Quadri
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).