I have a ThinkPad X41t running ArchLinux32. On the lid, it has several buttons. I gived them keycodes with setkeycodes. Device can be "transformed" - i.e rotated by 180 degrees around hinge and closed like that. The problem is, when device is transformed, those lid buttons doesn't work - they still produce keycodes (as reported by showkey), but they doesn't do anything. Using evtest, I determined two things:

  1. Lid Buttons belong to same event device as regular keyboard buttons, to "AT Translated Set 2 keyboard".
  2. Being 'transformed' it's an regognizable event. Here is report from evtest:

    Event: time ..., type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 1
    Event: time ..., -------------- SYN_REPORT ------------
    Event: time ..., type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 0
    Event: time ..., -------------- SYN_REPORT ------------

I also tried pressing keyboard keys when event of being transformed already happened using small stick, and they also weren't doing anything.

So I suspect that when event of being transformed triggeres something, that causes OS to ignore any key presses from this particular device. Is there a way to determine what and how does that, and how do I add Lid buttons to exception from this thing, so I could use them when device is transformed?

Thanks in advance.


Fixed in libinput. Now transforming doesn't disable regular keyboard, but lid doesn't press on keys so it's not a problem.


To whoever stumbles upon this with this same problem, there is an easy solution I just stumbled upon.

First, find the xinput device ID of your tablet buttons by running xinput. It should look something like this:

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=10   [slave  pointer  (2)]
⎜   ↳ Wacom Serial Penabled Pen stylus          id=12   [slave  pointer  (2)]
⎜   ↳ Wacom Serial Penabled Pen eraser          id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=9    [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                    id=11   [slave  keyboard (3)]

I'm not sure if these IDs are the same in all cases, but in my case, the entry I'm looking for has an ID of 11. Once you have that, disable it by entering xinput disable 11, and you should be good to go!

  • I believe this depends heavily on your laptop model. For me, as I said, lid button related to device "AT Translated Set 2 Keyboard", i.e. id 9 in your case. Al,so I'm not sure if disabling device is the solution? I mean, whole point was to enable those buttons when device is transformed, not disable them. What is the effect of the xinput disable command? – SuperPrower Dec 16 '18 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.