All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saalim Quadri <danascape@gmail.com>
To: lains@riseup.net
Cc: jikos@kernel.org, bentiss@kernel.org, gregkh@linuxfoundation.org,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC] Writing a Driver for Xinmeng M71 Keyboard (Battery Status Support)
Date: Sun, 22 Jun 2025 17:02:42 +0530	[thread overview]
Message-ID: <20250622113242.183562-1-danascape@gmail.com> (raw)

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

             reply	other threads:[~2025-06-22 11:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-22 11:32 Saalim Quadri [this message]
2025-06-22 21:02 ` [RFC] Writing a Driver for Xinmeng M71 Keyboard (Battery Status Support) Jiri Kosina
2025-06-23 13:03   ` Saalim Quadri

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=20250622113242.183562-1-danascape@gmail.com \
    --to=danascape@gmail.com \
    --cc=bentiss@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jikos@kernel.org \
    --cc=lains@riseup.net \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.