All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Erlend Jacobsen" <erlendjacobsen@pm.me>, linux-input@vger.kernel.org
Cc: dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2] HID: rdmctmzt: add RDMCTMZT keyboard battery driver
Date: Mon, 23 Nov 2026 16:03:07 +0000	[thread overview]
Message-ID: <sashiko-outbox-229637@kernel.org> (raw)
In-Reply-To: <20261123-b4-rdmctmzt-v2-1-8c18d7dac4bc@pm.me>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] HID: rdmctmzt: 60s retry delay in rdm_battery_work() on first
  answer
--

commit db1494c514873abbd1e68abaf2e2c2ff69742269
Author: Erlend Jacobsen <erlendjacobsen@pm.me>

HID: rdmctmzt: add RDMCTMZT keyboard battery driver

This commit adds a HID driver for RDMCTMZT keyboards and their 2.4 GHz
dongles to poll battery status over the vendor raw-HID interface and
report the dongle's wireless link status.

> diff --git a/drivers/hid/hid-rdmctmzt.c b/drivers/hid/hid-rdmctmzt.c
> new file mode 100644
> index 0000000000000..cad89c22577d4
> --- /dev/null
> +++ b/drivers/hid/hid-rdmctmzt.c
[ ... ]
> +static void rdm_battery_work(struct work_struct *work)
> +{
[ ... ]
> +	if (!linked) {
> +		/* A keyboard that comes back starts with fresh counts */
> +		rdm->silent = 0;
> +		rdm->fails = 0;
> +		wireless = USB_WIRELESS_STATUS_DISCONNECTED;
> +	} else {
> +		rdm->silent = answered ? 0 : min(rdm->silent + 1, RDM_MAX_FAILS);
> +		rdm->fails = got ? 0 : min(rdm->fails + 1, RDM_MAX_FAILS);
> +		if (answered)
> +			wireless = USB_WIRELESS_STATUS_CONNECTED;
> +		else if (rdm->silent >= RDM_MAX_FAILS ||
> +			 rdm->wireless == USB_WIRELESS_STATUS_NA)
> +			wireless = USB_WIRELESS_STATUS_DISCONNECTED;
> +	}
> +
> +	/* Without a link the dongle reports when it comes back */
> +	if (got || !linked)
> +		delay = RDM_POLL_MS;
> +	else if (rdm->fails < RDM_MAX_FAILS)
> +		delay = RDM_RETRY_MS;
> +	else if (rdm->dongle && rdm->silent >= RDM_MAX_FAILS)
> +		delay = RDM_SEARCH_MS;
> +	else
> +		delay = RDM_POLL_MS;

[Severity: Low]
When a dongle keeps linked == true while the keyboard is silent (such as
bcdDevice 0x0102 reporting link byte 0x00), three unanswered polls leave
both rdm->silent and rdm->fails at RDM_MAX_FAILS.  If the keyboard then
connects and answers RDM_CMD_START without returning a battery status yet
(for example, refusing with 0x0f before measuring the battery),
rdm->silent resets to 0 while rdm->fails stays at RDM_MAX_FAILS.

Does delay then fall through to RDM_POLL_MS (60 s) instead of
RDM_RETRY_MS (5 s) on that first answer?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123-b4-rdmctmzt-v2-1-8c18d7dac4bc@pm.me?part=1

  reply	other threads:[~2026-11-23 16:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 15:49 [PATCH v2] HID: rdmctmzt: add RDMCTMZT keyboard battery driver Erlend Jacobsen via B4 Relay
2026-11-23 15:49 ` Erlend Jacobsen
2026-11-23 16:03 ` sashiko-bot [this message]
2026-11-23 16:43   ` Erlend Jacobsen

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-229637@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=erlendjacobsen@pm.me \
    --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 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.