libinput and the Thinkpad Compact USB Keyboard

Andreas Fleig andreasfleig at gmail.com
Mon Mar 30 12:39:07 PDT 2015


Hi,

I recently updated my T440s to Fedora 22, and was happy about middle 
button scrolling being enabled by default -- for the built-in 
trackpoint. Since I'm an avid scroller, I needed to make this work for 
my "ThinkPad Compact USB Keyboard" as well. After some debugging I 
found that libinput checks for the presence of 
INPUT_PROP_POINTING_STICK, and wrote a small patch to add it to the 
device (see below). The patch works in that it enables middle button 
scrolling with the USB keyboard, but curiously it *disables* scrolling 
on the T440s' built-in trackpoint, if the USB keyboard is plugged in at 
boot time. When plugging it in after booting, the built-in trackpoint 
sometimes, but not always, continues to work.

Is this a problem in my patch or is it caused by libinput?

Andreas

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index c4c3f09..0dcb85d 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -762,6 +762,15 @@ static void lenovo_remove(struct hid_device *hdev)
 	hid_hw_stop(hdev);
 }

+static void lenovo_input_configured(struct hid_device *hdev,
+            struct hid_input *hi)
+{
+	if (*hi->input->ledbit == 0) {
+		/* set only for trackpoint device, which doesn't have any LEDs */
+		__set_bit(INPUT_PROP_POINTING_STICK, hi->input->propbit);
+	}
+}
+
 static const struct hid_device_id lenovo_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) 
},
@@ -774,6 +783,7 @@ MODULE_DEVICE_TABLE(hid, lenovo_devices);
 static struct hid_driver lenovo_driver = {
 	.name = "lenovo",
 	.id_table = lenovo_devices,
+	.input_configured = lenovo_input_configured,
 	.input_mapping = lenovo_input_mapping,
 	.probe = lenovo_probe,
 	.remove = lenovo_remove,





More information about the wayland-devel mailing list