All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Roman Stingler" <roman.stingler@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH] HID: logitech-hidpp: do not overwrite the device's hi-res wheel mode
Date: Wed, 23 Sep 2026 18:25:30 +0000	[thread overview]
Message-ID: <20260923182531.4FB7B1F0089A@smtp.kernel.org> (raw)
In-Reply-To: <20260923181203.422097-1-roman.stingler@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] hid: incorrect caching of hi-res wheel multiplier in low-res mode
--

commit 243fa986b83024ae16437c2e5c919019982c426b
Author: Roman Stingler <roman.stingler@gmail.com>

HID: logitech-hidpp: do not overwrite the device's hi-res wheel mode
    
This commit modifies hi_res_scroll_enable() to read the current wheel mode
from the device instead of always forcing high-resolution mode on connect.
This prevents the driver from overwriting a persistent mode configured by
userspace.
    
Link: https://lore.kernel.org/all/20260920094508.39682-1-roman.stingler@gmail.com/

> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 493763a12518e..338477bfcaebe 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c

[ ... ]

> @@ -3910,8 +3910,16 @@ static int hi_res_scroll_enable(struct hidpp_device *hidpp)
>  	u8 multiplier = 1;
>  
>  	if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP20_HI_RES_WHEEL) {
> -		ret = hidpp_hrw_set_wheel_mode(hidpp, false, true, false);
> -		if (ret == 0)
> +		u8 mode;
> +
> +		/*
> +		 * The wheel mode is persistent state in the device, so read it
> +		 * rather than overwriting it, and scale to match. A device
> +		 * left in hi-res still gets the multiplier it needs; one the
> +		 * user configured for low resolution is left alone.
> +		 */
> +		ret = hidpp_hrw_get_wheel_mode(hidpp, &mode);
> +		if (ret == 0 && (mode & BIT(1)))
>  			ret = hidpp_hrw_get_wheel_capability(hidpp, &multiplier);

[Severity: High]
Does skipping the capability query when in low-resolution mode introduce a
regression if the device is later switched to high-resolution mode?

If the device is probed in low-resolution mode, mode & BIT(1) is false and
hidpp_hrw_get_wheel_capability() is skipped. The local variable multiplier
remains 1.

Later in hi_res_scroll_enable(), this fallback value is cached permanently:

    hidpp->hires_wheel_multiplier = multiplier;
    hidpp->vertical_wheel_counter.wheel_multiplier = multiplier;

If a userspace configuration tool (such as Solaar) later switches the device
to high-resolution mode via HID++ commands, the driver will use this cached
multiplier of 1 instead of the hardware's true capability.

Since the kernel relies on hires_wheel_multiplier to scale physical
high-resolution wheel ticks, a multiplier of 1 causes each physical sub-detent
tick to be incorrectly reported as a full 120-unit detent, making the scroll
wheel move wildly fast.

Should the true high-resolution multiplier capability be queried and stored
regardless of the current active mode?

>  	} else if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP20_HI_RES_SCROLL) {
>  		ret = hidpp_hrs_set_highres_scrolling_mode(hidpp, true,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923181203.422097-1-roman.stingler@gmail.com?part=1

  reply	other threads:[~2026-09-23 18:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 18:11 [PATCH] HID: logitech-hidpp: do not overwrite the device's hi-res wheel mode Roman Stingler
2026-09-23 18:25 ` sashiko-bot [this message]
2026-09-25  9:50 ` johannes.goede
2026-09-25  9:50 ` johannes.goede
2026-09-26 11:52   ` 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=20260923182531.4FB7B1F0089A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=roman.stingler@gmail.com \
    --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.