On Wed, Apr 11, 2018 at 9:09 PM, Peter Ganzhorn <peter.ganzhorn@xxxxxxxxx> wrote: > Signed-off-by: Peter Ganzhorn <peter.ganzhorn@xxxxxxxxx> > --- > drivers/hid/Kconfig | 7 ++++--- > drivers/hid/hid-lenovo.c | 36 ++++++++++++++++++++++++++++++++++++ > drivers/hid/hid-quirks.c | 6 ++++++ > 3 files changed, 46 insertions(+), 3 deletions(-) > > diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig > index 60252fd796f6..ab5e84018345 100644 > --- a/drivers/hid/Kconfig > +++ b/drivers/hid/Kconfig > @@ -462,10 +462,11 @@ config HID_LENOVO > select NEW_LEDS > select LEDS_CLASS > ---help--- > - Support for Lenovo devices that are not fully compliant with HID standard. > + Support for IBM/Lenovo devices that are not fully compliant with HID standard. > > - Say Y if you want support for the non-compliant features of the Lenovo > - Thinkpad standalone keyboards, e.g: > + Say Y if you want support for horizontal scrolling with the IBM/Lenovo > + Scrollpoint mice or the non-compliant features of the Lenovo Thinkpad > + standalone keyboards, e.g: > - ThinkPad USB Keyboard with TrackPoint (supports extra LEDs and trackpoint > configuration) > - ThinkPad Compact Bluetooth Keyboard with TrackPoint (supports Fn keys) > 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 @@ > * > * Copyright (c) 2012 Bernhard Seibold > * Copyright (c) 2014 Jamie Lentin <jm@xxxxxxxxxxxx> > + * > + * Linux IBM/Lenovo Scrollpoint mouse driver: > + * - IBM Scrollpoint III > + * - IBM Scrollpoint Pro > + * - IBM Scrollpoint Optical > + * - IBM Scrollpoint Optical 800dpi > + * - IBM Scrollpoint Optical 800dpi Pro > + * - Lenovo Scrollpoint Optical > + * > + * Copyright (c) 2012 Peter De Wachter <pdewacht@xxxxxxxxx> > + * Copyright (c) 2018 Peter Ganzhorn <peter.ganzhorn@xxxxxxxxx> > */ > > /* > @@ -160,6 +171,17 @@ static int lenovo_input_mapping_cptkbd(struct hid_device *hdev, > return 0; > } > > +static int lenovo_input_mapping_scrollpoint(struct hid_device *hdev, > + struct hid_input *hi, struct hid_field *field, > + struct hid_usage *usage, unsigned long **bit, int *max) > +{ > + if (usage->hid == HID_GD_Z) { > + hid_map_usage(hi, usage, bit, max, EV_REL, REL_HWHEEL); > + return 1; > + } > + return 0; > +} > + > static int lenovo_input_mapping(struct hid_device *hdev, > struct hid_input *hi, struct hid_field *field, > struct hid_usage *usage, unsigned long **bit, int *max) > @@ -172,6 +194,14 @@ static int lenovo_input_mapping(struct hid_device *hdev, > case USB_DEVICE_ID_LENOVO_CBTKBD: > return lenovo_input_mapping_cptkbd(hdev, hi, field, > usage, bit, max); > + case USB_DEVICE_ID_IBM_SCROLLPOINT_III: > + case USB_DEVICE_ID_IBM_SCROLLPOINT_PRO: > + case USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL: > + case USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL: > + case USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO: > + case USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL: > + return lenovo_input_mapping_scrollpoint(hdev, hi, field, > + usage, bit, max); > default: > return 0; > } > @@ -883,6 +913,12 @@ static const struct hid_device_id lenovo_devices[] = { > { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, > { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, > { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) }, > + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_III) }, > + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_PRO) }, > + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL) }, > + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL) }, > + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO) }, > + { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL) }, > { } > }; > > diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c > index 587e2681a53f..d5ff6de75e0b 100644 > --- a/drivers/hid/hid-quirks.c > +++ b/drivers/hid/hid-quirks.c > @@ -428,6 +428,12 @@ static const struct hid_device_id hid_have_special_driver[] = { > { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, > { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, > { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) }, > + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_III) }, > + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_PRO) }, > + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL) }, > + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL) }, > + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO) }, > + { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL) }, Hi, please also remove this hunk. Since v4.15 or v4.16 we don't really need to populate this table. Do it only if the default hid-generic interferes with the device and prevents hid-lenovo to take over the device. This will allow to have users blacklisting hid-lenovo for instance and still have their mouse supported. Cheers, Benjamin > #endif > #if IS_ENABLED(CONFIG_HID_LOGITECH) > { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, > -- > 2.11.0 > -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html