All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Erik Håkansson" <erikhakan@gmail.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH 2/2] HID: logitech-hidpp: fix Bolt wheel mode handling
Date: Tue, 22 Sep 2026 17:53:01 +0000	[thread overview]
Message-ID: <20260922175302.54B211F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260922-feature-bolt-fix-v1-2-63b0fa8da0d3@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] hid-logitech-hidpp: high-resolution scrolling is no longer enabled by default
- [Medium] hid-logitech-hidpp: failed capability read permanently breaks scroll wheel
--

commit ca5a9ddace3102c7dc2ef5b518171ea6cf49e055
Author: Erik Håkansson <erikhakan@gmail.com>

HID: logitech-hidpp: fix Bolt wheel mode handling

This patch modifies how high-resolution wheel settings are handled for Bolt
devices in the HID++ driver. It preserves the device's user-selected resolution
and inversion settings while enabling HID++ notifications for Bolt. It also
tracks diverted wheel events to apply the correct multiplier for high- and
low-resolution events.

> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 166980be57b7c..55e9ac5e5ab78 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c

[ ... ]

> @@ -3912,16 +3939,43 @@ static int hi_res_scroll_enable(struct hidpp_device *hidpp)
>  {
>  	int ret;
>  	u8 multiplier = 1;
> +	bool high_resolution = true;
> +	const bool is_bolt = hidpp_is_bolt_child(hidpp->hid_dev);
> +
> +	if (is_bolt)
> +		hidpp->hires_wheel_diverted = false;
>  
>  	if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP20_HI_RES_WHEEL) {
> -		bool use_hidpp = hidpp_is_bolt_child(hidpp->hid_dev);
> +		u8 mode;
> +
> +		/* Preserve the persistent mode, except for Bolt event routing. */
> +		ret = hidpp_hrw_get_wheel_mode(hidpp, &mode);
> +		if (ret == 0) {
> +			bool invert = mode & HIRES_WHEEL_MODE_INVERT;
> +			bool use_hidpp = mode & HIRES_WHEEL_MODE_USE_HIDPP;
> +
> +			high_resolution = mode & HIRES_WHEEL_MODE_HIGH_RESOLUTION;
> +
> +			/* Preserve user-set resolution and inversion; enable HID++ for Bolt. */
> +			if (is_bolt && high_resolution && !use_hidpp) {
> +				ret = hidpp_hrw_set_wheel_mode(hidpp, invert,
> +							       high_resolution, true);
> +				if (ret == 0)
> +					use_hidpp = true;
> +			}

[Severity: High]
Does this code intentionally drop the default enablement of high-resolution
scrolling for non-Bolt devices and low-resolution Bolt devices?

The previous code unconditionally enabled high-resolution mode by calling
hidpp_hrw_set_wheel_mode(hidpp, false, true, use_hidpp). The new code appears
to remove this entirely for non-Bolt devices, and only enables it for Bolt
devices if they are already in high-res mode (is_bolt && high_resolution &&
!use_hidpp).

Could this permanently disable high-resolution scrolling out of the box for
these devices?

>  
> -		ret = hidpp_hrw_set_wheel_mode(hidpp, false, true, use_hidpp);
> -		if (ret == 0)
> -			ret = hidpp_hrw_get_wheel_capability(hidpp, &multiplier);
> +			if (ret == 0)
> +				ret = hidpp_hrw_get_wheel_capability(hidpp, &multiplier);
> +			if (ret == 0)
> +				hidpp->hires_wheel_diverted = use_hidpp;

[Severity: Medium]
What happens if hidpp_hrw_get_wheel_capability() fails due to an intermittent
RF timeout or IO error?

If the hardware is already in use_hidpp mode (or was successfully set to it),
but the capability read fails, hidpp->hires_wheel_diverted will not be
updated to match the hardware state.

Could this leave the driver desynchronized from the hardware, causing the raw
event handler to permanently drop subsequent HID++ wheel events?

> +		}
>  	} else if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP20_HI_RES_SCROLL) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260922-feature-bolt-fix-v1-0-63b0fa8da0d3@gmail.com?part=2

  reply	other threads:[~2026-09-22 17:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 17:40 [PATCH 0/2] HID: logitech-hidpp: fix Bolt hi-res wheel handling Erik Håkansson
2026-09-22 17:40 ` [PATCH 1/2] HID: logitech-hidpp: fix hi-res scroll for Bolt-connected MX Master Erik Håkansson
2026-09-22 17:51   ` sashiko-bot
2026-09-22 17:40 ` [PATCH 2/2] HID: logitech-hidpp: fix Bolt wheel mode handling Erik Håkansson
2026-09-22 17:53   ` sashiko-bot [this message]
2026-09-23  6:39 ` [PATCH 0/2] HID: logitech-hidpp: fix Bolt hi-res wheel handling Oleksandr Natalenko
2026-09-23  7:54   ` Benjamin Tissoires
2026-09-23 16:09     ` erikhakan
2026-09-24  6:51       ` Oleksandr Natalenko
2026-09-24 21:41         ` Erik Håkansson
2026-09-24 21:48           ` erikhakan
2026-09-24 21:57           ` Oleksandr Natalenko
2026-09-26 11:13             ` Erik Håkansson
2026-09-26 11:39               ` Oleksandr Natalenko
2026-09-26 12:12                 ` Erik Håkansson
2026-09-26 12:24                   ` Oleksandr Natalenko
2026-09-26 16:47                     ` Erik Håkansson

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=20260922175302.54B211F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=erikhakan@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 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.