libinput and the Thinkpad Compact USB Keyboard

Benjamin Tissoires benjamin.tissoires at gmail.com
Mon Apr 13 10:10:29 PDT 2015


Hi Andreas,

On Mon, Mar 30, 2015 at 3:39 PM, Andreas Fleig <andreasfleig at gmail.com> 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.

This looks like a problem in libinput. I am not sure I'll have the
time to dig into it in a timely manner, but maybe Hans or Peter will
have the answer of head.

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

No, that's the right way to go in the kernel.
For the record, Andreas published a v2 of his patch here:
https://patchwork.kernel.org/patch/6177961/

I am going to review it ASAP.

Cheers,
Benjamin

>
> 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,
>
>
>
> _______________________________________________
> 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