libinput and the Thinkpad Compact USB Keyboard

Peter Hutterer peter.hutterer at who-t.net
Mon Apr 13 15:04:12 PDT 2015


On Mon, Mar 30, 2015 at 09:39:07PM +0200, Andreas Fleig wrote:
> 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?

huh, weird, must have missed this email though I have a strong deja-vu now.
Anyway, bug was filed here:
https://bugs.freedesktop.org/show_bug.cgi?id=89935

The code currently doesn't expect more than one trackstick, so I suspect the
association with devices goes wrong. Which would explain why it works when
plugged in at runtime but not when booted up with it plugged in.

Anyway, aside from the patch below let's keep this in the bugreport.

Cheers,
   Peter

> 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,
> 
> 
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 


More information about the wayland-devel mailing list