Bug 106799

Summary: IBM x41 tablet must not disable the keyboard in tablet mode
Product: Wayland Reporter: Peter Hutterer <peter.hutterer>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: dya.eshshmai, peter.hutterer
Version: unspecified   
Hardware: Other   
OS: All   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=103749
Whiteboard:
i915 platform: i915 features:
Attachments: 0001-udev-the-IBM-X41-Tablet-must-not-disable-the-keyboar.patch

Description Peter Hutterer 2018-06-03 22:20:43 UTC
Created attachment 139996 [details] [review]
0001-udev-the-IBM-X41-Tablet-must-not-disable-the-keyboar.patch

From Bug 103749, comment 36 there, moving it here to avoid the other bug getting noisy with an unrelated device.

The X41 tablet must not disable the keyboard during tablet mode, otherwise the lid buttons are inaccessible.

Patch attached, please give it a try. This is a hwdb entry only, please see this link for instructions:
https://wayland.freedesktop.org/libinput/doc/latest/udev_config.html#hwdb
Comment 1 Sergey Koziakov 2018-06-04 09:45:34 UTC
Hello! Thank you very much. I am not sure if I'm doing everything correctly, so here is what I am doing:

1. I have applied patch (with 'patch < patchname.patch`) to the source code (patch was in  repository root, but said it can't find a file, so I provided it a path to the file) and built and installed libinput according to official build instructions. I realize now that it's silly, but at first I couldn't found libinput's hwdb file.

2. I updated hwdb file on-disk and ran 'udevadm trigger' for event devices 4 and 5 (keyboard and additional buttons which include tablet switch event).

3. I then ran 'udevadm test' for those devices. There are few lines that bothered me in the output, here are they:


PROGRAM 'libinput-device-group /sys/devices/platform/i8042/serio0/input/input10/event4' /usr/lib/udev/rules.d/80-libinput-device-groups.rules:7
starting 'libinput-device-group /sys/devices/platform/i8042/serio0/input/input10/event4'
'libinput-device-group /sys/devices/platform/i8042/serio0/input/input10/event4'(out) '11/1/1:isa0060/serio0'
Process 'libinput-device-group /sys/devices/platform/i8042/serio0/input/input10/event4' succeeded.
IMPORT builtin 'hwdb' /usr/lib/udev/rules.d/90-libinput-model-quirks.rules:32
2 character(s) replaced
IMPORT builtin 'hwdb' /usr/lib/udev/rules.d/90-libinput-model-quirks.rules:36
IMPORT builtin 'hwdb' /usr/lib/udev/rules.d/90-libinput-model-quirks.rules:40
IMPORT builtin 'hwdb' returned non-zero

and 


PROGRAM 'libinput-device-group /sys/devices/platform/thinkpad_acpi/input/input6/event5' /usr/lib/udev/rules.d/80-libinput-device-groups.rules:7
starting 'libinput-device-group /sys/devices/platform/thinkpad_acpi/input/input6/event5'
'libinput-device-group /sys/devices/platform/thinkpad_acpi/input/input6/event5'(out) '19/1014/5054:thinkpad_acpi'
Process 'libinput-device-group /sys/devices/platform/thinkpad_acpi/input/input6/event5' succeeded.
2 character(s) replaced
IMPORT builtin 'hwdb' /usr/lib/udev/rules.d/90-libinput-model-quirks.rules:36
IMPORT builtin 'hwdb' returned non-zero
IMPORT builtin 'hwdb' /usr/lib/udev/rules.d/90-libinput-model-quirks.rules:40
IMPORT builtin 'hwdb' returned non-zero

I'm not sure if it is ok, so I decided I should attach this.

4. Those lid buttons don't have keycodes at first, so I used 'setkeycodes' to give them keycodes. I tried using udev/hwdb rule in past, but it didn't work at all.


Am I doing something wrong? Did I forgot some step or something? Thanks again.
Comment 2 Sergey Koziakov 2018-06-04 09:48:11 UTC
I forgot to add that after all that, lid keys still don't work when transformed.
Comment 3 Peter Hutterer 2018-06-04 10:05:50 UTC
It's a git patch, you're better off doing "git am < patchfile" and git will take care of it. Otherwise patch -p1 should work too but I'd rather you use git directly. Installing afterwards is correct but not necessary, you could just copy the hwdb file over the system one. Whether the lid keys are mapped to anything doesn't really matter to libinput at least, but depending what they're mapped to X may filter them. What does evemu-record say about the buttons on the lid?

The udevadm test messages are fine. What was the bottom of the udevadm test output though? Did it list the LIBINPUT_MODEL_TABLET_MODE_NO_SUSPEND property for the keyboard device?

What does libinput debug-events --verbose say when you run it now?
Comment 4 Sergey Koziakov 2018-06-04 11:05:20 UTC
(In reply to Peter Hutterer from comment #3)
> It's a git patch, you're better off doing "git am < patchfile" and git will
> take care of it. Otherwise patch -p1 should work too but I'd rather you use
> git directly. Installing afterwards is correct but not necessary, you could
> just copy the hwdb file over the system one.

Yep, I tried again using git patch, and it produced no errors.

> The udevadm test messages are fine. What was the bottom of the udevadm test
> output though? Did it list the LIBINPUT_MODEL_TABLET_MODE_NO_SUSPEND
> property for the keyboard device?

It does!

For some reason, I tried again using git patch and it works perfectly. Regular keyboard also works (if I stick a finger between lid and case and press some keys when event has triggered they work), but it's not like lid is pressing any buttons or moving a trackpoint, so it's not a problem.

I'm going to reboot and see if everything persists, and then close the bug. Thank you!
Comment 5 Sergey Koziakov 2018-06-04 11:11:04 UTC
Oh, right, I wasn't the one who openned issue. Anyways, changes persist trough reboot and work perfectly. Thanks again!.
Comment 6 Peter Hutterer 2018-06-05 00:57:37 UTC
Either way, bugs shouldn't be closed until they're on git master anyway. Patch is pushed now, thanks for testing.

commit 07eefba84b1fe46b3e8702ee0db806ddfb80df73
Author: Peter Hutterer <>
Date:   Mon Jun 4 08:16:48 2018 +1000

     udev: the IBM X41 Tablet must not disable the keyboard in tablet mode


https://wayland.freedesktop.org/libinput/doc/latest/reporting_bugs.html#fixed_bugs
Comment 7 sinan 2018-06-13 13:13:08 UTC
Exact same situation on Lenovo ThinkPad S1 Yoga (svnLENOVO:*pvrThinkPadS1Yoga:*)

Probably also on all ThinkPad Yoga models (:*pvrThinkPad*Yoga*:*) ; the keyboard gets locked mechanically. It's not the case on other consumer yoga models though.
Comment 8 Peter Hutterer 2018-06-14 01:34:40 UTC
sinan, please file a separate issue so we don't mix hardware-specific quirks for different devices in the same bug reports.

libinput has switched to gitlab now, please file the issue here: https://gitlab.freedesktop.org/libinput/libinput/issues

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.