diff options
author | pgzh <peter.ganzhorn@gmail.com> | 2018-04-12 13:36:47 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2018-04-25 04:48:35 -0400 |
commit | a230cd52b8a2be39cd6e9a13b3e62af57f21372a (patch) | |
tree | 3e66e5f8bf1ac553eaf807021b09bc5a059500eb | |
parent | b658912cb023cd6f8e46963d29779903d3c10538 (diff) |
HID: lenovo: Add support for IBM/Lenovo Scrollpoint mice
The IBM/Lenovo Scrollpoint mice feature a trackpoint-like stick instead of a
scrolling wheel capable of 2-D (vertical+horizontal) scrolling. hid-generic
does only expose 1-D (vertical) scrolling functionality for these mice. This
patch adds support for horizontal scrolling for the IBM/Lenovo Scrollpoint mice
to hid-lenovo.
[jkosina@suse.cz: remove change versioning from git changelog]
Signed-off-by: Peter Ganzhorn <peter.ganzhorn@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Peter De Wachter <pdewacht@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/Kconfig | 7 | ||||
-rw-r--r-- | drivers/hid/hid-ids.h | 8 | ||||
-rw-r--r-- | drivers/hid/hid-lenovo.c | 36 |
3 files changed, 48 insertions, 3 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 60252fd796f6..0000434a1fbd 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -462,10 +462,11 @@ config HID_LENOVO | |||
462 | select NEW_LEDS | 462 | select NEW_LEDS |
463 | select LEDS_CLASS | 463 | select LEDS_CLASS |
464 | ---help--- | 464 | ---help--- |
465 | Support for Lenovo devices that are not fully compliant with HID standard. | 465 | Support for IBM/Lenovo devices that are not fully compliant with HID standard. |
466 | 466 | ||
467 | Say Y if you want support for the non-compliant features of the Lenovo | 467 | Say Y if you want support for horizontal scrolling of the IBM/Lenovo |
468 | Thinkpad standalone keyboards, e.g: | 468 | Scrollpoint mice or the non-compliant features of the Lenovo Thinkpad |
469 | standalone keyboards, e.g: | ||
469 | - ThinkPad USB Keyboard with TrackPoint (supports extra LEDs and trackpoint | 470 | - ThinkPad USB Keyboard with TrackPoint (supports extra LEDs and trackpoint |
470 | configuration) | 471 | configuration) |
471 | - ThinkPad Compact Bluetooth Keyboard with TrackPoint (supports Fn keys) | 472 | - ThinkPad Compact Bluetooth Keyboard with TrackPoint (supports Fn keys) |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 0b5cc910f62e..ec73aa486315 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -552,6 +552,13 @@ | |||
552 | #define USB_VENDOR_ID_HUION 0x256c | 552 | #define USB_VENDOR_ID_HUION 0x256c |
553 | #define USB_DEVICE_ID_HUION_TABLET 0x006e | 553 | #define USB_DEVICE_ID_HUION_TABLET 0x006e |
554 | 554 | ||
555 | #define USB_VENDOR_ID_IBM 0x04b3 | ||
556 | #define USB_DEVICE_ID_IBM_SCROLLPOINT_III 0x3100 | ||
557 | #define USB_DEVICE_ID_IBM_SCROLLPOINT_PRO 0x3103 | ||
558 | #define USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL 0x3105 | ||
559 | #define USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL 0x3108 | ||
560 | #define USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO 0x3109 | ||
561 | |||
555 | #define USB_VENDOR_ID_IDEACOM 0x1cb6 | 562 | #define USB_VENDOR_ID_IDEACOM 0x1cb6 |
556 | #define USB_DEVICE_ID_IDEACOM_IDC6650 0x6650 | 563 | #define USB_DEVICE_ID_IDEACOM_IDC6650 0x6650 |
557 | #define USB_DEVICE_ID_IDEACOM_IDC6651 0x6651 | 564 | #define USB_DEVICE_ID_IDEACOM_IDC6651 0x6651 |
@@ -684,6 +691,7 @@ | |||
684 | #define USB_DEVICE_ID_LENOVO_TPKBD 0x6009 | 691 | #define USB_DEVICE_ID_LENOVO_TPKBD 0x6009 |
685 | #define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047 | 692 | #define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047 |
686 | #define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048 | 693 | #define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048 |
694 | #define USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL 0x6049 | ||
687 | #define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067 | 695 | #define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067 |
688 | #define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085 | 696 | #define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085 |
689 | #define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3 | 697 | #define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3 |
diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c index 1ac4ff4d57a6..643b6eb54442 100644 --- a/drivers/hid/hid-lenovo.c +++ b/drivers/hid/hid-lenovo.c | |||
@@ -6,6 +6,17 @@ | |||
6 | * | 6 | * |
7 | * Copyright (c) 2012 Bernhard Seibold | 7 | * Copyright (c) 2012 Bernhard Seibold |
8 | * Copyright (c) 2014 Jamie Lentin <jm@lentin.co.uk> | 8 | * Copyright (c) 2014 Jamie Lentin <jm@lentin.co.uk> |
9 | * | ||
10 | * Linux IBM/Lenovo Scrollpoint mouse driver: | ||
11 | * - IBM Scrollpoint III | ||
12 | * - IBM Scrollpoint Pro | ||
13 | * - IBM Scrollpoint Optical | ||
14 | * - IBM Scrollpoint Optical 800dpi | ||
15 | * - IBM Scrollpoint Optical 800dpi Pro | ||
16 | * - Lenovo Scrollpoint Optical | ||
17 | * | ||
18 | * Copyright (c) 2012 Peter De Wachter <pdewacht@gmail.com> | ||
19 | * Copyright (c) 2018 Peter Ganzhorn <peter.ganzhorn@gmail.com> | ||
9 | */ | 20 | */ |
10 | 21 | ||
11 | /* | 22 | /* |
@@ -160,6 +171,17 @@ static int lenovo_input_mapping_cptkbd(struct hid_device *hdev, | |||
160 | return 0; | 171 | return 0; |
161 | } | 172 | } |
162 | 173 | ||
174 | static int lenovo_input_mapping_scrollpoint(struct hid_device *hdev, | ||
175 | struct hid_input *hi, struct hid_field *field, | ||
176 | struct hid_usage *usage, unsigned long **bit, int *max) | ||
177 | { | ||
178 | if (usage->hid == HID_GD_Z) { | ||
179 | hid_map_usage(hi, usage, bit, max, EV_REL, REL_HWHEEL); | ||
180 | return 1; | ||
181 | } | ||
182 | return 0; | ||
183 | } | ||
184 | |||
163 | static int lenovo_input_mapping(struct hid_device *hdev, | 185 | static int lenovo_input_mapping(struct hid_device *hdev, |
164 | struct hid_input *hi, struct hid_field *field, | 186 | struct hid_input *hi, struct hid_field *field, |
165 | struct hid_usage *usage, unsigned long **bit, int *max) | 187 | struct hid_usage *usage, unsigned long **bit, int *max) |
@@ -172,6 +194,14 @@ static int lenovo_input_mapping(struct hid_device *hdev, | |||
172 | case USB_DEVICE_ID_LENOVO_CBTKBD: | 194 | case USB_DEVICE_ID_LENOVO_CBTKBD: |
173 | return lenovo_input_mapping_cptkbd(hdev, hi, field, | 195 | return lenovo_input_mapping_cptkbd(hdev, hi, field, |
174 | usage, bit, max); | 196 | usage, bit, max); |
197 | case USB_DEVICE_ID_IBM_SCROLLPOINT_III: | ||
198 | case USB_DEVICE_ID_IBM_SCROLLPOINT_PRO: | ||
199 | case USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL: | ||
200 | case USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL: | ||
201 | case USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO: | ||
202 | case USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL: | ||
203 | return lenovo_input_mapping_scrollpoint(hdev, hi, field, | ||
204 | usage, bit, max); | ||
175 | default: | 205 | default: |
176 | return 0; | 206 | return 0; |
177 | } | 207 | } |
@@ -883,6 +913,12 @@ static const struct hid_device_id lenovo_devices[] = { | |||
883 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, | 913 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, |
884 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, | 914 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, |
885 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) }, | 915 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) }, |
916 | { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_III) }, | ||
917 | { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_PRO) }, | ||
918 | { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL) }, | ||
919 | { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL) }, | ||
920 | { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO) }, | ||
921 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL) }, | ||
886 | { } | 922 | { } |
887 | }; | 923 | }; |
888 | 924 | ||