diff mbox series

HID: logitech: Handle 0 scroll events for the m560

Message ID 20190319224823.GA26366@jelly (mailing list archive)
State Mainlined
Commit fd35759ce32b60d3eb52436894bab996dbf8cffa
Delegated to: Jiri Kosina
Headers show
Series HID: logitech: Handle 0 scroll events for the m560 | expand

Commit Message

Peter Hutterer March 19, 2019, 10:48 p.m. UTC
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(-)

Comments

Benjamin Tissoires March 20, 2019, 2:29 p.m. UTC | #1
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
>
diff mbox series

Patch

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);
 	}