Skip to content

Commit d92189e

Browse files
andreasfJiri Kosina
authored andcommitted
HID: lenovo: set INPUT_PROP_POINTING_STICK
Set flags INPUT_PROP_POINTER and INPUT_PROP_POINTING_STICK for the trackpoint integrated in Lenovo USB and Bluetooth keyboards. Libinput checks these flags to enable features such as middle-button-scrolling by default. Signed-off-by: Andreas Fleig <[email protected]> Reviewed-by: Benjamin Tissoires <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 8de29a3 commit d92189e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

drivers/hid/hid-lenovo.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,24 @@ static void lenovo_remove(struct hid_device *hdev)
762762
hid_hw_stop(hdev);
763763
}
764764

765+
static void lenovo_input_configured(struct hid_device *hdev,
766+
struct hid_input *hi)
767+
{
768+
switch (hdev->product) {
769+
case USB_DEVICE_ID_LENOVO_TPKBD:
770+
case USB_DEVICE_ID_LENOVO_CUSBKBD:
771+
case USB_DEVICE_ID_LENOVO_CBTKBD:
772+
if (test_bit(EV_REL, hi->input->evbit)) {
773+
/* set only for trackpoint device */
774+
__set_bit(INPUT_PROP_POINTER, hi->input->propbit);
775+
__set_bit(INPUT_PROP_POINTING_STICK,
776+
hi->input->propbit);
777+
}
778+
break;
779+
}
780+
}
781+
782+
765783
static const struct hid_device_id lenovo_devices[] = {
766784
{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) },
767785
{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) },
@@ -774,6 +792,7 @@ MODULE_DEVICE_TABLE(hid, lenovo_devices);
774792
static struct hid_driver lenovo_driver = {
775793
.name = "lenovo",
776794
.id_table = lenovo_devices,
795+
.input_configured = lenovo_input_configured,
777796
.input_mapping = lenovo_input_mapping,
778797
.probe = lenovo_probe,
779798
.remove = lenovo_remove,

0 commit comments

Comments
 (0)