HID: fix A4Tech horizontal scrolling
A message that is not in the archive (sent off-list or not yet received): AO-hwJKNH7WoJV-X+egK5cJNNtxamh0L0e1er5dkiTt6KvrmSQ@mail.gmail.com
PATCH v2 1/1 HID: fix A4Tech horizontal scrolling
Since recent high resolution scrolling changes the A4Tech driver must check for the "REL_WHEEL_HI_RES" usage code.
Resolution Multiplier for high-resolution scrolling")
---
Changes in v2:
- changed commit message
drivers/hid/hid-a4tech.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hid/hid-a4tech.c +3 -3
@@ -38,7 +38,7 @@ static int a4_input_mapped(struct hid_device *hdev, struct hid_input *hi, {struct a4tech_sc *a4 =hid_get_drvdata (hdev); -if (usage->type ==EV_REL && usage->code ==REL_WHEEL ) +if (usage->type ==EV_REL && usage->code ==REL_WHEEL_HI_RES )set_bit (REL_HWHEEL , *bit);if ((a4->quirks &A4_2WHEEL_MOUSE_HACK_7 ) && usage->hid ==0x00090007 )
@@ -60,7 +60,7 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field, input = field->hidinput->input;if (a4->quirks &A4_2WHEEL_MOUSE_HACK_B8 ) { -if (usage->type ==EV_REL && usage->code ==REL_WHEEL ) { +if (usage->type ==EV_REL && usage->code ==REL_WHEEL_HI_RES ) { a4->delayed_value = value;return 1 ; }
@@ -77,7 +77,7 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field,return 1 ; } -if (usage->code ==REL_WHEEL && a4->hw_wheel) { +if (usage->code ==REL_WHEEL_HI_RES && a4->hw_wheel) {input_event (input, usage->type,REL_HWHEEL , value);return 1 ; }
Signature · 1 line
2.21.0
Quoted 38 lines · Błażej Szczygieł
Since recent high resolution scrolling changes the A4Tech driver must check for the "
REL_WHEEL_HI_RES" usage code.Fixes 2dc702c991e3774af9d7ce410eef410ca9e2357e ("HID: input: use theResolution Multiplier for high-resolution scrolling")
Signed-off-by Błażej Szczygieł <[email protected]>---
Changes in v2:
- changed commit messagedrivers/hid/hid-a4tech.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/hid/hid-a4tech.c +2
-2@@ -38,7 +38,7 @@ static int a4_input_mapped(struct hid_device *hdev, struct hid_input *hi, {struct a4tech_sc *a4 =hid_get_drvdata (hdev); -if (usage->type ==EV_REL && usage->code ==REL_WHEEL ) +if (usage->type ==EV_REL && usage->code ==REL_WHEEL_HI_RES )set_bit (REL_HWHEEL , *bit);if ((a4->quirks &A4_2WHEEL_MOUSE_HACK_7 ) && usage->hid ==0x00090007 )@@ -60,7 +60,7 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field, input = field->hidinput->input;if (a4->quirks &A4_2WHEEL_MOUSE_HACK_B8 ) { -if (usage->type ==EV_REL && usage->code ==REL_WHEEL ) { +if (usage->type ==EV_REL && usage->code ==REL_WHEEL_HI_RES ) { a4->delayed_value = value;return 1 ; }
drivers/hid/hid-a4tech.c static int a4_event(struct hid_device *hdev, struct hid_field *field, · line 81
Quoted 6 lines
drivers/hid/hid-a4tech.c +1
-1@@ -77,7 +77,7 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field,return 1 ; } -if (usage->code ==REL_WHEEL && a4->hw_wheel) { +if (usage->code ==REL_WHEEL_HI_RES && a4->hw_wheel) {input_event (input, usage->type,REL_HWHEEL , value);
You'll need to send both events here, so please add:
input_event(input, usage->type, REL_HWHEEL_HI_RES, value * 120);
assume that wheel and wheel_hi_res are two separate event streams for the same axis, userspace may listen to either or both. if you only send the legacy event, newer userspace won't receive any scroll events as it may only look for the new hi-res events.
Check with evtest/evemu/libinput record after, you should see multiples of 120 on the hi-res axis for every legacy wheel event.
Cheers,
Peter
Quoted 5 lines
drivers/hid/hid-a4tech.c +0
-0return 1 ; }Signature · 1 line
2.21.0
PATCH v3 1/1 HID: fix A4Tech horizontal scrolling
Since recent high resolution scrolling changes the A4Tech driver must check for the "REL_WHEEL_HI_RES" usage code.
Resolution Multiplier for high-resolution scrolling")
---
Changes in v2:
- changed commit message
Changes in v3:
- send also high resolution events
drivers/hid/hid-a4tech.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/hid/hid-a4tech.c +8 -3
@@ -38,8 +38,10 @@ static int a4_input_mapped(struct hid_device *hdev, struct hid_input *hi, {struct a4tech_sc *a4 =hid_get_drvdata (hdev); -if (usage->type ==EV_REL && usage->code ==REL_WHEEL ) +if (usage->type ==EV_REL && usage->code ==REL_WHEEL_HI_RES ) {set_bit (REL_HWHEEL , *bit); +set_bit (REL_HWHEEL_HI_RES , *bit); + }if ((a4->quirks &A4_2WHEEL_MOUSE_HACK_7 ) && usage->hid ==0x00090007 )return -1 ;
@@ -60,7 +62,7 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field, input = field->hidinput->input;if (a4->quirks &A4_2WHEEL_MOUSE_HACK_B8 ) { -if (usage->type ==EV_REL && usage->code ==REL_WHEEL ) { +if (usage->type ==EV_REL && usage->code ==REL_WHEEL_HI_RES ) { a4->delayed_value = value;return 1 ; }
@@ -68,6 +70,8 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field,if (usage->hid ==0x000100b8 ) {input_event (input,EV_REL , value ?REL_HWHEEL :REL_WHEEL , a4->delayed_value); +input_event (input,EV_REL , value ?REL_HWHEEL_HI_RES : +REL_WHEEL_HI_RES , a4->delayed_value *120 );return 1 ; } }
@@ -77,8 +81,9 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field,return 1 ; } -if (usage->code ==REL_WHEEL && a4->hw_wheel) { +if (usage->code ==REL_WHEEL_HI_RES && a4->hw_wheel) {input_event (input, usage->type,REL_HWHEEL , value); +input_event (input, usage->type,REL_HWHEEL_HI_RES , value *120 );return 1 ; }
Signature · 1 line
2.21.0
Hi!
I have verified that the PATCH v3 applied to kernel 5.0.15 fixes horizontal scrolling for my A4Tech WOP-49Z mouse just as well as the previous patch did.
Thank you,
Igor
Quoted 64 lines · Błażej Szczygieł
Since recent high resolution scrolling changes the A4Tech driver must check for the "
REL_WHEEL_HI_RES" usage code.Fixes 2dc702c991e3774af9d7ce410eef410ca9e2357e ("HID: input: use theResolution Multiplier for high-resolution scrolling")
Signed-off-by Błażej Szczygieł <[email protected]>---
Changes in v2:
- changed commit messageChanges in v3:
- send also high resolution eventsdrivers/hid/hid-a4tech.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/hid/hid-a4tech.c +8
-3@@ -38,8 +38,10 @@ static int a4_input_mapped(struct hid_device *hdev, struct hid_input *hi, {struct a4tech_sc *a4 =hid_get_drvdata (hdev); -if (usage->type ==EV_REL && usage->code ==REL_WHEEL ) +if (usage->type ==EV_REL && usage->code ==REL_WHEEL_HI_RES ) {set_bit (REL_HWHEEL , *bit); +set_bit (REL_HWHEEL_HI_RES , *bit); + }if ((a4->quirks &A4_2WHEEL_MOUSE_HACK_7 ) && usage->hid ==0x00090007 )return -1 ;@@ -60,7 +62,7 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field, input = field->hidinput->input;if (a4->quirks &A4_2WHEEL_MOUSE_HACK_B8 ) { -if (usage->type ==EV_REL && usage->code ==REL_WHEEL ) { +if (usage->type ==EV_REL && usage->code ==REL_WHEEL_HI_RES ) { a4->delayed_value = value;return 1 ; }@@ -68,6 +70,8 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field,if (usage->hid ==0x000100b8 ) {input_event (input,EV_REL , value ?REL_HWHEEL :REL_WHEEL , a4->delayed_value); +input_event (input,EV_REL , value ?REL_HWHEEL_HI_RES : +REL_WHEEL_HI_RES , a4->delayed_value *120 );return 1 ; } }@@ -77,8 +81,9 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field,return 1 ; } -if (usage->code ==REL_WHEEL && a4->hw_wheel) { +if (usage->code ==REL_WHEEL_HI_RES && a4->hw_wheel) {input_event (input, usage->type,REL_HWHEEL , value); +input_event (input, usage->type,REL_HWHEEL_HI_RES , value *120 );return 1 ; }
Quoted 8 lines · Błażej Szczygieł
Since recent high resolution scrolling changes the A4Tech driver must check for the "
REL_WHEEL_HI_RES" usage code.Fixes 2dc702c991e3774af9d7ce410eef410ca9e2357e ("HID: input: use theResolution Multiplier for high-resolution scrolling")
Signed-off-by Błażej Szczygieł <[email protected]>
Applied, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs