linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: logitech: Handle 0 scroll events for the m560
@ 2019-03-19 22:48 Peter Hutterer
  2019-03-20 14:29 ` Benjamin Tissoires
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Hutterer @ 2019-03-19 22:48 UTC (permalink / raw)
  To: linux-input
  Cc: Benjamin Tissoires, Aimo Metsälä,
	nlopezcasad, Jiri Kosina, linux-kernel

hidpp_scroll_counter_handle_scroll() doesn't expect a 0-value scroll event, it
gets interpreted as a negative scroll direction event. This can cause scroll
direction resets and thus broken scrolling.

Reported-and-tested-by: Aimo Metsälä <aimetsal@outlook.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 drivers/hid/hid-logitech-hidpp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 15ed6177a7a3..f040c8a7f9a9 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -2608,8 +2608,9 @@ static int m560_raw_event(struct hid_device *hdev, u8 *data, int size)
 		input_report_rel(mydata->input, REL_Y, v);
 
 		v = hid_snto32(data[6], 8);
-		hidpp_scroll_counter_handle_scroll(
-				&hidpp->vertical_wheel_counter, v);
+		if (v != 0)
+			hidpp_scroll_counter_handle_scroll(
+					&hidpp->vertical_wheel_counter, v);
 
 		input_sync(mydata->input);
 	}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] HID: logitech: Handle 0 scroll events for the m560
  2019-03-19 22:48 [PATCH] HID: logitech: Handle 0 scroll events for the m560 Peter Hutterer
@ 2019-03-20 14:29 ` Benjamin Tissoires
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Tissoires @ 2019-03-20 14:29 UTC (permalink / raw)
  To: Peter Hutterer
  Cc: open list:HID CORE LAYER, Aimo Metsälä,
	Nestor Lopez Casado, Jiri Kosina, lkml

On Tue, Mar 19, 2019 at 11:48 PM Peter Hutterer
<peter.hutterer@who-t.net> wrote:
>
> hidpp_scroll_counter_handle_scroll() doesn't expect a 0-value scroll event, it
> gets interpreted as a negative scroll direction event. This can cause scroll
> direction resets and thus broken scrolling.
>
> Reported-and-tested-by: Aimo Metsälä <aimetsal@outlook.com>
> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
> ---

Added the 'Fixes' and "cc: stable" tags and patch applied to
for-5.1/upstream-fixes

Cheers,
Benjamin

>  drivers/hid/hid-logitech-hidpp.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 15ed6177a7a3..f040c8a7f9a9 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -2608,8 +2608,9 @@ static int m560_raw_event(struct hid_device *hdev, u8 *data, int size)
>                 input_report_rel(mydata->input, REL_Y, v);
>
>                 v = hid_snto32(data[6], 8);
> -               hidpp_scroll_counter_handle_scroll(
> -                               &hidpp->vertical_wheel_counter, v);
> +               if (v != 0)
> +                       hidpp_scroll_counter_handle_scroll(
> +                                       &hidpp->vertical_wheel_counter, v);
>
>                 input_sync(mydata->input);
>         }
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-20 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19 22:48 [PATCH] HID: logitech: Handle 0 scroll events for the m560 Peter Hutterer
2019-03-20 14:29 ` Benjamin Tissoires

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).