Bezel buttons events not registered by X server when lid closed (covertible laptop)

Hi,

I’ve got ThinkPad X230T with convertible lid so it can be used as a tablet - it got extra 3 buttons on bezel from one of which is power-switch.
I wanted to bind some actions to these 2 other buttons - one for undo and one for screen rotation - and everything is working fine when I’m in Laptop Mode but when I switch to Tablet Mode only power button events are registred in xev.

When i run xev & showkey in separate terminals:

  • in Laptop Mode button presses are registred in both
  • in Tablet Mode button presses are registred only in showkey

I got my buttons binded in KDE system settings > custom shortcuts - one to script, and the other one to [Ctrl]+[Z] combination.

Tried to modify /etc/systemd/logind.conf lid switch handling to ignore but no success.

I assume they don’t work because something are blocking these events in X?
It seems so because they work until I close the lid (with monitor switched so the display is at the top) in Tablet Mode.

I checked in Energy Saving -> Buttons event handling -> when laptop lid closed -> suspend (even when external monitors connected)

Don’t know how can I enable raising these events so they’ll be handled by shortcuts binds.
Or maybe I should rather bind them in some another way?

I’m a new linux user so I don’t know how to solve this in a proper way.

I’ve investigated a little bit further and it seems like the input driver is suppressing events from kernel when laptop lid is closed (TabletMode - screen at top):

[ol]
[li]os have preinstalled ‘Wacom tablet detection’ tool which detects my screen, but no hardware buttons can be mapped here - so it means that the bezel buttons aren’t from the “tablet” [/li][li]identified registered input devices with:[/li][ul]
[li]evtest (for kernel)[/li]

Available devices:
[b]/dev/input/event0:      AT Translated Set 2 keyboard
[/b]/dev/input/event1:      SynPS/2 Synaptics TouchPad
/dev/input/event2:      Video Bus
/dev/input/event3:      TPPS/2 IBM TrackPoint
/dev/input/event4:      Wacom ISDv4 90 Pen
/dev/input/event5:      Lid Switch
/dev/input/event6:      Sleep Button[b]
/dev/input/event7:      Power Button[/b]
/dev/input/event8:      ThinkPad Extra Buttons
/dev/input/event9:      PC Speaker
/dev/input/event10:     HDA Digital PCBeep
/dev/input/event11:     HDA Intel PCH Mic
/dev/input/event12:     HDA Intel PCH Dock Mic
/dev/input/event13:     HDA Intel PCH Headphone
/dev/input/event14:     HDA Intel PCH Dock Headphone
/dev/input/event15:     HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event16:     HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event17:     Integrated Camera: Integrated C

[li]xinput (for xserver)[/li]

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Wacom ISDv4 90 Pen stylus                 id=10   [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=12   [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=13   [slave  pointer  (2)]
⎜   ↳ Wacom ISDv4 90 Pen eraser                 id=15   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
[b]    ↳ Power Button                              id=6    [slave  keyboard (3)][/b]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ Integrated Camera: Integrated C           id=9    [slave  keyboard (3)]
    [b]↳ AT Translated Set 2 keyboard              id=11   [slave  keyboard (3)][/b]
    ↳ ThinkPad Extra Buttons                    id=14   [slave  keyboard (3)]

[/ul]

[li]checked responsivness in both modes:[/li][ul]
[li]LaptopMode - lid open[/li][LIST]
[li]evtest 0 → registering keypress events [/li][li]xinput 11 → registering keypress events [/li][/ul]

[li]TabletMode - lid closed (screen at top)[/li][ul]
[li]evtest 0 → registering keypress events [/li][li]xinput 11not registering keypress events [/li][/ul]

[/ol]

[li]checked state in both modes (thougth that maybe they got disabled) but xinput shows them all as ‘up’ (no matter the lid id closed or open) [/li]```
xinput query-state 11

 
[li]checked changes in device when lid is closing/opening - but no change[/li]

xinput watch-props 11

 
[li]listed all properties for my keyboard device - and saw libinput event handlers[/li]

xinput list-props 11

 
[li]checked input driver in xorg logs[/li]

L5k@linux-cpla:/var/log> cat Xorg.0.log | grep ‘input driver’
[ 2501.148] (II) Using input driver ‘libinput’ for ‘Power Button’
[ 2501.204] (II) Using input driver ‘libinput’ for ‘Video Bus’
[ 2501.267] (II) No input driver specified, ignoring this device.
[ 2501.268] (II) Using input driver ‘libinput’ for ‘Sleep Button’
[ 2501.300] (II) Using input driver ‘libinput’ for ‘Integrated Camera: Integrated C’
[ 2501.360] (II) No input driver specified, ignoring this device.
[ 2501.360] (II) No input driver specified, ignoring this device.
[ 2501.361] (II) No input driver specified, ignoring this device.
[ 2501.362] (II) No input driver specified, ignoring this device.
[ 2501.363] (II) No input driver specified, ignoring this device.
[ 2501.363] (II) No input driver specified, ignoring this device.
[ 2501.364] (II) No input driver specified, ignoring this device.
[ 2501.366] (II) Using input driver ‘wacom’ for ‘Wacom ISDv4 90 Pen’
[ 2501.529] (II) No input driver specified, ignoring this device.
[ 2501.531] (II) Using input driver ‘libinput’ for ‘AT Translated Set 2 keyboard’
[ 2501.556] (II) Using input driver ‘libinput’ for ‘SynPS/2 Synaptics TouchPad’
[ 2501.606] (II) No input driver specified, ignoring this device.
[ 2501.607] (II) Using input driver ‘libinput’ for ‘TPPS/2 IBM TrackPoint’
[ 2501.653] (II) Using input driver ‘evdev’ for ‘TPPS/2 IBM TrackPoint’
[ 2501.689] (II) No input driver specified, ignoring this device.
[ 2501.694] (II) Using input driver ‘libinput’ for ‘ThinkPad Extra Buttons’
[ 2501.730] (II) Using input driver ‘wacom’ for ‘Wacom ISDv4 90 Pen eraser’

 
[li]then go to [i]/etc/X11/xorg.conf.d[/i] and [i]edit 40-libinput.conf[/i] file to comment whole section for keyboard input handling[/li]

#Section “InputClass”

Identifier “libinput keyboard catchall”

MatchIsKeyboard “on”

MatchDevicePath “/dev/input/event*”

Driver “libinput”

#EndSection

 
[li]reboot [/li][li]checked xinput properties for KB device again - no libinput event handlers anymore[/li]

L5k@linux-cpla:/etc/X11/xorg.conf.d> xinput list-props 11
Device ‘AT Translated Set 2 keyboard’:
Device Enabled (144): 1
Coordinate Transformation Matrix (146): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Product ID (266): 1, 1
Device Node (267): “/dev/input/event0”

 
[li]checked xorg logs - input driver is 'evdev' now[/li]```

L5k@linux-cpla:/var/log> cat Xorg.0.log | grep 'input driver'
[b][    12.209] (II) Using input driver 'evdev' for 'Power Button'[/b]
[    12.239] (II) Using input driver 'evdev' for 'Video Bus'
[    12.241] (II) No input driver specified, ignoring this device.
[    12.242] (II) Using input driver 'evdev' for 'Sleep Button'
[    12.244] (II) Using input driver 'evdev' for 'Integrated Camera: Integrated C'
[    12.246] (II) No input driver specified, ignoring this device.
[    12.246] (II) No input driver specified, ignoring this device.
[    12.247] (II) No input driver specified, ignoring this device.
[    12.248] (II) No input driver specified, ignoring this device.
[    12.248] (II) No input driver specified, ignoring this device.
[    12.249] (II) No input driver specified, ignoring this device.
[    12.249] (II) No input driver specified, ignoring this device.
[    12.253] (II) Using input driver 'wacom' for 'Wacom ISDv4 90 Pen'
[    12.404] (II) No input driver specified, ignoring this device.
[b][    12.405] (II) Using input driver 'evdev' for 'AT Translated Set 2 keyboard'[/b]
[    12.413] (II) Using input driver 'libinput' for 'SynPS/2 Synaptics TouchPad'
[    12.466] (II) No input driver specified, ignoring this device.
[    12.467] (II) Using input driver 'libinput' for 'TPPS/2 IBM TrackPoint'
[    12.504] (II) Using input driver 'evdev' for 'TPPS/2 IBM TrackPoint'
[    12.541] (II) No input driver specified, ignoring this device.
[    12.546] (II) Using input driver 'evdev' for 'ThinkPad Extra Buttons'
[    12.553] (II) Using input driver 'wacom' for 'Wacom ISDv4 90 Pen eraser'

[li]bezel buttons keypress events are now registred normally in xev and xinput when the lid is closed (in TabletMode) - so all my binds to ‘undo operation’ and ‘screen rotation script’ are working now [/li][/LIST]
It seems that libinput is suppressing those events when the laptop lid is closed (even with screen switch to top - TabletMode), but I don’t know how i can configure it in better way than simply disabling it…
It works now, but it’s more like a workaround than a solution to the problem - i’d like to have those two buttons ‘whitelisted’ somehow like the power button is (in libinput) so the xinput events are registred for them normally without the need to disable whole libinput keyboard handling.

Forgot to put ouptut from xinput device properties (ad. 5, 6)

so here it is:

L5k@linux-cpla:/etc/X11/xorg.conf.d> xinput list-props 11
Device 'AT Translated Set 2 keyboard':
        Device Enabled (144):   1
        Coordinate Transformation Matrix (146): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
**        libinput Send Events Modes Available (264):     1, 0
        libinput Send Events Mode Enabled (265):        0, 0
        libinput Send Events Mode Enabled Default (266):        0, 0**
        Device Node (267):      "/dev/input/event0"
        Device Product ID (268):        1, 1

watch-props showing the same output with no change when I close the lid.

I recommend submitting a bug report for this.
https://wayland.freedesktop.org/libinput/doc/latest/reporting-bugs.html