Skip to content

Commit a230cd5

Browse files
pgzhJiri Kosina
authored andcommitted
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. [[email protected]: remove change versioning from git changelog] Signed-off-by: Peter Ganzhorn <[email protected]> Reviewed-by: Benjamin Tissoires <[email protected]> Signed-off-by: Peter De Wachter <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent b658912 commit a230cd5

File tree

3 files changed

+48
-3
lines changed

3 files changed

+48
-3
lines changed

drivers/hid/Kconfig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,11 @@ config HID_LENOVO
462462
select NEW_LEDS
463463
select LEDS_CLASS
464464
---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.
466466

467-
Say Y if you want support for the non-compliant features of the Lenovo
468-
Thinkpad standalone keyboards, e.g:
467+
Say Y if you want support for horizontal scrolling of the IBM/Lenovo
468+
Scrollpoint mice or the non-compliant features of the Lenovo Thinkpad
469+
standalone keyboards, e.g:
469470
- ThinkPad USB Keyboard with TrackPoint (supports extra LEDs and trackpoint
470471
configuration)
471472
- ThinkPad Compact Bluetooth Keyboard with TrackPoint (supports Fn keys)

drivers/hid/hid-ids.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,13 @@
552552
#define USB_VENDOR_ID_HUION 0x256c
553553
#define USB_DEVICE_ID_HUION_TABLET 0x006e
554554

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+
555562
#define USB_VENDOR_ID_IDEACOM 0x1cb6
556563
#define USB_DEVICE_ID_IDEACOM_IDC6650 0x6650
557564
#define USB_DEVICE_ID_IDEACOM_IDC6651 0x6651
@@ -684,6 +691,7 @@
684691
#define USB_DEVICE_ID_LENOVO_TPKBD 0x6009
685692
#define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047
686693
#define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048
694+
#define USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL 0x6049
687695
#define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067
688696
#define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085
689697
#define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3

drivers/hid/hid-lenovo.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
*
77
* Copyright (c) 2012 Bernhard Seibold
88
* Copyright (c) 2014 Jamie Lentin <[email protected]>
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 <[email protected]>
19+
* Copyright (c) 2018 Peter Ganzhorn <[email protected]>
920
*/
1021

1122
/*
@@ -160,6 +171,17 @@ static int lenovo_input_mapping_cptkbd(struct hid_device *hdev,
160171
return 0;
161172
}
162173

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+
163185
static int lenovo_input_mapping(struct hid_device *hdev,
164186
struct hid_input *hi, struct hid_field *field,
165187
struct hid_usage *usage, unsigned long **bit, int *max)
@@ -172,6 +194,14 @@ static int lenovo_input_mapping(struct hid_device *hdev,
172194
case USB_DEVICE_ID_LENOVO_CBTKBD:
173195
return lenovo_input_mapping_cptkbd(hdev, hi, field,
174196
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);
175205
default:
176206
return 0;
177207
}
@@ -883,6 +913,12 @@ static const struct hid_device_id lenovo_devices[] = {
883913
{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) },
884914
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) },
885915
{ 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) },
886922
{ }
887923
};
888924

0 commit comments

Comments
 (0)