From: sashiko-bot@kernel.org
To: "Bishwa Bhusan Saha" <contact@bishwasaha.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH 2/5] HID: UNCTRL: add basic battery reporting for UNCTRL RAGE Mouse
Date: Mon, 12 Oct 2026 20:23:33 +0000 [thread overview]
Message-ID: <sashiko-outbox-168592@kernel.org> (raw)
In-Reply-To: <20261013-b4-unctrl-m1-battery-v1-2-4a50203b7177@bishwasaha.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] hid: unctrl: initial battery query response may be dropped in probe
--
commit 6b35740bb80be8312a87135a9844c03a48dc1cca
Author: Bishwa Bhusan Saha <contact@bishwasaha.com>
HID: UNCTRL: add basic battery reporting for UNCTRL RAGE Mouse
This commit adds basic battery reporting for the UNCTRL RAGE Wireless Mouse
over both 2.4 GHz and wired connections. It queries the battery once during
device probe by sending an output report to the hardware.
> diff --git a/drivers/hid/hid-unctrl-m1.c b/drivers/hid/hid-unctrl-m1.c
> new file mode 100644
> index 0000000000000..59259dee7e429
> --- /dev/null
> +++ b/drivers/hid/hid-unctrl-m1.c
[ ... ]
> +static void unctrl_fetch_battery(struct hid_device *hdev)
> +{
> + u8 *write_buf;
> + int ret;
> +
> + /* buf[0] is the report number, and hid_hw_output_report() sends the
> + * buffer verbatim.
> + */
> + write_buf = kmemdup(unctrl_battery_query, sizeof(unctrl_battery_query),
> + GFP_KERNEL);
> + if (!write_buf)
> + return;
> +
> + ret = hid_hw_output_report(hdev, write_buf,
> + sizeof(unctrl_battery_query));
[ ... ]
> +static int unctrl_probe(struct hid_device *hdev, const struct hid_device_id *id)
> +{
[ ... ]
> + /* usbhid polls the interrupt in endpoint only while it is open */
> + ret = hid_hw_open(hdev);
> + if (ret) {
> + hid_err(hdev, "%s:open failed with error %d\n", __func__, ret);
> + hid_hw_stop(hdev);
> + kfree(dev);
> + return ret;
> + }
> +
> + hid_set_drvdata(hdev, dev);
> +
> + ret = unctrl_battery_register(dev);
[Severity: Low]
Since hid_device_io_start() has not been called in unctrl_probe(), will the
HID core's driver_input_lock block the incoming battery report reply?
If the device responds to the output report sent by unctrl_fetch_battery()
before the probe function returns, it appears __hid_input_report() might drop
the reply because the IO path is still gated.
Does this mean the initial battery level will remain incorrectly reported as
100% until a subsequent poll occurs?
> + if (ret)
> + goto err_del;
> +
> + return 0;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261013-b4-unctrl-m1-battery-v1-0-4a50203b7177@bishwasaha.com?part=2
next prev parent reply other threads:[~2026-10-12 20:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 20:15 [PATCH 0/5] HID: add battery driver for the UNCTRL RAGE Wireless Mouse Bishwa Bhusan Saha via B4 Relay
2026-10-12 20:15 ` [PATCH 1/5] HID: add IDs for UNCTRL RAGE Mouse Bishwa Bhusan Saha via B4 Relay
2026-10-12 20:15 ` [PATCH 2/5] HID: UNCTRL: add basic battery reporting " Bishwa Bhusan Saha via B4 Relay
2026-10-12 20:23 ` sashiko-bot [this message]
2026-10-12 20:15 ` [PATCH 3/5] HID: UNCTRL: add periodic battery reporting using a workqueue Bishwa Bhusan Saha via B4 Relay
2026-10-12 20:26 ` sashiko-bot
2026-10-12 20:15 ` [PATCH 4/5] HID: UNCTRL: keep a single battery when a mouse has multiple connections Bishwa Bhusan Saha via B4 Relay
2026-10-12 20:29 ` sashiko-bot
2026-10-12 20:15 ` [PATCH 5/5] HID: UNCTRL: only report to userspace on battery changes Bishwa Bhusan Saha 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=sashiko-outbox-168592@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=contact@bishwasaha.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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