Due to missing drivers for my 2-in-1 convertible, folding the screen back only triggers a lid switch event. This causes the laptop to suspend or, when "Suspend when laptop lid is closed" is disabled in Gnome, still causes all input devices to be disabled (including the touchscreen, which renders the tablet mode useless).

As a workaround, I would like to handle the switch to tablet mode manually. This requires to inhibit all lid switch events.


How can I completely inhibit lid switch events in Linux ?

Alternatively, finding a way to list / disable processes responding to lid switch would solve the issue.

Currently, folding the screen in tablet mode and back logs the following events:

Jul 25 23:58:54 jl-xps systemd-logind[816]: Lid closed.
Jul 25 23:58:58 jl-xps systemd-logind[816]: Lid opened.

The lid switch event is mapped to /dev/input/event0. /proc/bus/input/devices lists (truncated):

I: Bus=0019 Vendor=0000 Product=0005 Version=0000
N: Name="Lid Switch"
P: Phys=PNP0C0D/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input0
U: Uniq=
H: Handlers=event0 
B: EV=21
B: SW=1


Method 1: systemd-inhibit, taken from How to disable auto suspend when I close laptop lid?

# systemd-inhibit --what=handle-lid-switch sleep 1m

and then flip the screen before the end of the timer. Lid switch events are still logged by systemd-logind, and I can see /dev/input/event0 being written to (and other input devices are still disabled).

Method 2: ACPI

$ echo "LID0" | sudo tee /proc/acpi/wakeup

and check that it is indeed disabled:

LID0      S3    *disabled  platform:PNP0C0D:00

with the same systemd-logind log and /dev/input/event0 still being written to.

Method 3: brute force

# mv /dev/input/event0 /dev/input/event0-off
# ln -s /dev/null /dev/input/event0

The lid switch events are still logged by systemd-logind. So it seems that /dev/input/event0 is only informative.

System information:

$ inxi -Fxmz

System:    Host: jl-xps Kernel: 4.18.0-0.rc5.git4.1.fc29.x86_64 x86_64 bits: 64 compiler: gcc v: 8.1.1 
           Desktop: Gnome 3.28.3 Distro: Fedora release 28 (Twenty Eight) 
Machine:   Type: Laptop System: Dell product: XPS 15 9575 v: N/A serial: <filter> 
           Mobo: Dell model: 0C32VW v: A00 serial: <filter> UEFI: Dell v: 1.1.5 date: 05/30/2018 
Battery:   ID-1: BAT0 charge: 72.3 Wh condition: 72.3/75.0 Wh (96%) model: BYD DELL TMFYT84 status: Full 
Memory:    RAM Report: permissions: Unable to run dmidecode. Are you root? 
CPU:       Topology: Quad Core model: Intel Core i7-8705G bits: 64 type: MT MCP arch: Skylake rev: 9 
           L2 cache: 8192 KiB 
           flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 49536 
           Speed: 900 MHz min/max: 800/4100 MHz Core speeds (MHz): 1: 900 2: 900 3: 900 4: 900 5: 900 6: 900 
           7: 900 8: 900 
Graphics:  Card-1: Intel driver: i915 v: kernel bus ID: 00:02.0 
           Card-2: Advanced Micro Devices [AMD/ATI] Polaris 22 [Radeon RX Vega M GL] driver: amdgpu v: kernel 
           bus ID: 01:00.0 
           Display: wayland server: Fedora Project X.org 11.0 driver: amdgpu resolution: 3840x2160~60Hz 
           OpenGL: renderer: Mesa DRI Intel HD Graphics 630 (Kaby Lake GT2) v: 4.5 Mesa 18.1.4 
           direct render: Yes 
Audio:     Card-1: Intel CM238 HD Audio driver: snd_hda_intel v: kernel bus ID: 00:1f.3 
           Card-2: N/A type: USB driver: snd-usb-audio bus ID: 3:2 
           Sound Server: ALSA v: k4.18.0-0.rc5.git4.1.fc29.x86_64 
Network:   Card-1: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter driver: ath10k_pci v: kernel 
           bus ID: 02:00.0 
           IF: wlp2s0 state: up mac: <filter> 
           Card-2: Intel I210 Gigabit Network Connection driver: igb v: 5.4.0-k port: 2000 bus ID: 40:00.0 
           IF: enp64s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
           Card-3: Realtek RTL8153 Gigabit Ethernet Adapter type: USB driver: r8152 bus ID: 10:3 
           IF: enp65s0u2u2 state: down mac: <filter> 
           IF-ID-1: tap0 state: unknown speed: 10 Mbps duplex: full mac: <filter> 
           IF-ID-2: virbr0 state: up speed: N/A duplex: N/A mac: <filter> 
           IF-ID-3: virbr0-nic state: down mac: <filter> 
Drives:    HDD Total Size: 232.89 GiB used: 77.91 GiB (33.5%) 
           ID-1: /dev/sda type: USB vendor: Samsung model: Portable SSD T3 size: 232.89 GiB 
RAID:      Hardware-1: Intel 82801 Mobile SATA Controller [RAID mode] driver: ahci v: 3.0 bus ID: 00:17.0 
Partition: ID-1: / size: 114.35 GiB used: 77.69 GiB (67.9%) fs: ext4 dev: /dev/sda3 
           ID-2: /boot size: 975.9 MiB used: 202.9 MiB (20.8%) fs: ext4 dev: /dev/sda2 
           ID-3: swap-1 size: 16.00 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/sda4 
Sensors:   System Temperatures: cpu: 50.0 C mobo: 37.0 C gpu: amdgpu temp: 49 C 
           Fan Speeds (RPM): cpu: 0 
Info:      Processes: 381 Uptime: 3h 01m Memory: 15.36 GiB used: 7.66 GiB (49.9%) Init: systemd runlevel: 5 
           Compilers: gcc: 8.1.1 Shell: fish v: 2.7.1 inxi: 3.0.14


$ xinput list

⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ xwayland-pointer:15                       id=6    [slave  pointer  (2)]
⎜   ↳ xwayland-relative-pointer:15              id=7    [slave  pointer  (2)]
⎜   ↳ xwayland-touch:15                         id=9    [slave  pointer  (2)]
⎜   ↳ xwayland-stylus:15                        id=10   [slave  pointer  (2)]
⎜   ↳ xwayland-eraser:15                        id=11   [slave  pointer  (2)]
⎜   ↳ xwayland-cursor:15                        id=12   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ xwayland-keyboard:15                      id=8    [slave  keyboard (3)]

Below is the output from sudo libinput debug-events when changing to tablet mode and back to laptop mode (with the lid switch device disabled):

-event3   DEVICE_ADDED     Power Button                      seat0 default group1  cap:k
-event5   DEVICE_ADDED     Video Bus                         seat0 default group2  cap:k
-event1   DEVICE_ADDED     Power Button                      seat0 default group3  cap:k
-event2   DEVICE_ADDED     Sleep Button                      seat0 default group4  cap:k
-event9   DEVICE_ADDED     Integrated_Webcam_HD: Integrate   seat0 default group5  cap:k
-event10  DEVICE_ADDED     Integrated_Webcam_HD: Integrate   seat0 default group5  cap:k
-event13  DEVICE_ADDED     Wacom HID 486A Pen                seat0 default group6  cap:T  size 344x194mm calib
-event14  DEVICE_ADDED     Wacom HID 486A Finger             seat0 default group6  cap:t  size 344x194mm ntouches 10 calib
-event12  DEVICE_ADDED     DELL080D:00 06CB:7A13 Touchpad    seat0 default group7  cap:pg  size 102x77mm tap(dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on
-event15  DEVICE_ADDED     CalDigit, Inc. CalDigit Thunderbolt 3 Audio seat0 default group8  cap:k
-event16  DEVICE_ADDED     Razer Razer Imperator             seat0 default group9  cap:p left scroll-nat scroll-button
-event23  DEVICE_ADDED     Razer Razer Imperator Keyboard    seat0 default group9  cap:k
-event24  DEVICE_ADDED     Razer Razer Imperator Consumer Control seat0 default group9  cap:kp scroll-nat
-event25  DEVICE_ADDED     Razer Razer Imperator System Control seat0 default group9  cap:k
-event26  DEVICE_ADDED     TypeMatrix.com USB Keyboard       seat0 default group10 cap:k
-event27  DEVICE_ADDED     TypeMatrix.com USB Keyboard System Control seat0 default group10 cap:k
-event28  DEVICE_ADDED     TypeMatrix.com USB Keyboard Consumer Control seat0 default group10 cap:kp scroll-nat
-event8   DEVICE_ADDED     Intel Virtual Button driver       seat0 default group11 cap:kS
-event17  DEVICE_ADDED     HDA Intel PCH Headphone Mic       seat0 default group12 cap:
-event18  DEVICE_ADDED     HDA Intel PCH HDMI/DP,pcm=3       seat0 default group12 cap:
-event19  DEVICE_ADDED     HDA Intel PCH HDMI/DP,pcm=7       seat0 default group12 cap:
-event20  DEVICE_ADDED     HDA Intel PCH HDMI/DP,pcm=8       seat0 default group12 cap:
-event21  DEVICE_ADDED     HDA Intel PCH HDMI/DP,pcm=9       seat0 default group12 cap:
-event22  DEVICE_ADDED     HDA Intel PCH HDMI/DP,pcm=10      seat0 default group12 cap:
-event6   DEVICE_ADDED     Intel HID events                  seat0 default group13 cap:k
-event7   DEVICE_ADDED     Intel HID 5 button array          seat0 default group14 cap:k
-event11  DEVICE_ADDED     Dell WMI hotkeys                  seat0 default group15 cap:k
-event4   DEVICE_ADDED     AT Translated Set 2 keyboard      seat0 default group16 cap:k
-event8   SWITCH_TOGGLE     +3.90s  switch tablet-mode state 1
 event8   SWITCH_TOGGLE     +5.44s  switch tablet-mode state 0

More details about this "Intel Virtual Button driver", which seems to be responsible for the switch to tablet-mode:

I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="Intel Virtual Button driver"
P: Phys=
S: Sysfs=/devices/pci0000:00/0000:00:1f.0/PNP0C09:00/INT33D6:00/input/input8
U: Uniq=
H: Handlers=kbd event8 
B: EV=33
B: KEY=2000000000000 0 0 0 0 1000000000000 0 201c000000000000 0
B: MSC=10
B: SW=2


$ find /sys/bus/ -name 'PNP0C09:00'


$ find /sys/devices/ -name 'PNP0C09:00'


$ udevadm info /sys/class/input/event8
P: /devices/pci0000:00/0000:00:1f.0/PNP0C09:00/INT33D6:00/input/input8/event8
N: input/event8
S: input/by-path/pci-0000:00:1f.0-platform-INT33D6:00-event
E: DEVLINKS=/dev/input/by-path/pci-0000:00:1f.0-platform-INT33D6:00-event
E: DEVNAME=/dev/input/event8
E: DEVPATH=/devices/pci0000:00/0000:00:1f.0/PNP0C09:00/INT33D6:00/input/input8/event8
E: ID_PATH=pci-0000:00:1f.0-platform-INT33D6:00
E: ID_PATH_TAG=pci-0000_00_1f_0-platform-INT33D6_00
E: TAGS=:power-switch:
  • @sourcejedi Good point. I will retry these 3 methods but this time restarting the systemd-logind service in between. – Element-126 Jul 26 '18 at 9:42
  • @sourcejedi Hmm... running sudo systemctl restart systemd-logind freezes all input devices (in a similar fashion to folding the screen back), but it does not kill the graphical session (I tested this by having a timer run in the background while executing the command) – Element-126 Jul 26 '18 at 9:58
  • I tried method 2 again, but this time I restarted systemd-logind after applying the changes. I had journalctl -u systemd-logind.service -f running in the background, and the lid switch events are still logged, even though it disables the keyboard, touchpad and touchscreen. I will retry method 3 later. – Element-126 Jul 26 '18 at 10:09
  • Some additional information: when the lid is folded back, the external keyboard and mouse remain enabled. But using a tablet with a keyboard and mouse kind of defeats its purpose :) – Element-126 Jul 26 '18 at 13:01
  • @sourcejedi I will try your suggestion and report the results here. – Element-126 Jul 26 '18 at 13:09

You can test unbinding the driver on the parent device. This will remove the child device input0 - along with any other child devices that were there.

cd /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00
echo PNP0C0D:00 | sudo tee driver/unbind

A second example, based on the other input device you mention:

cd /sys/devices/pci0000:00/0000:00:1f.0/PNP0C09:00/INT33D6:00
echo INT33D6:00 | sudo tee driver/unbind

(If you arrange for such a command to be run automatically, you will want to make sure it runs after the driver is bound... In many cases I think you would get away with putting it in rc.local though).

Further reading

LWN.net describes this feature here: Manual driver binding and unbinding.

  • 1
    Hmm... after some more experimentation I realized that libinput still detects some SWITCH_TOGGLE event, and even correctly recognizes it as a switch to tablet mode (see edit). It seems that there is another device (/dev/input/event8) than the lid switch which reacts to the screen being folded back. I will try to unbind it and see if it solves the issue. – Element-126 Jul 26 '18 at 16:19
  • I tried to unbind this Intel Virtual Button driver (see edit) using both echo 'PNP0C09:00' | sudo tee /sys/bus/acpi/drivers/ec/ and cd /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:11/PNP0C09:00/; echo 'PNP0C09:00' | sudo tee driver/unbind, but event8 is still present in /dev/input/ and a SWITCH_TOGGLE event is still recorded by libinput when the screen is folded back. Any ideas how to get rid of this one ? – Element-126 Jul 26 '18 at 17:11
  • Indeed I was trying to unbind the wrong device. Unbinding INT33D6:00 does remove /dev/input/event8 and suppresses the switch to tablet-mode. The touchscreen still gets disabled though, possibly at the hardware level. Thanks a lot for your help! – Element-126 Jul 26 '18 at 19:57

You can peristently ignore lid switch events by changing the systemd-logind configuration in /etc/systemd/logind.conf.

From my own system:


After making the change, you can systemctl restart systemd-logind to have it take effect.

  • Thanks for your suggestion. I edited my logind.conf as you proposed, but unfortunately the lid switch events are still logged, despite restarting the service and rebooting the laptop (restarting systemd-logind initially disabled all input sources, but everything went back to normal after a forced reboot) – Element-126 Jul 26 '18 at 9:40
  • @Element-126 You probably can't prevent the events from being logged. But you can certainly prevent the machine from suspending. – Michael Hampton Jul 26 '18 at 12:42
  • 1
    I was probably unclear. The issue is not the machine suspending (I disabled it using Gnome Tweak Tools, but your suggestion works as well). The problem is that even when the machine does not suspend, folding the screen back still disables input devices such as the keyboard, trackpad and, importantly, the touchscreen. – Element-126 Jul 26 '18 at 12:49
  • This is correlated with lid switch events, which in itself does not prove causation. But since the other relevant sensors (accelerometers & gyroscopes) lack proper drivers, I was assuming that the only way the system could react to the lid being folded back was by listening to lid switch events, hence why I am trying to inhibit them. It is entirely possible though that this happens at the hardware level (I saw the same behaviour with a clean install of Windows 10 with no drivers). – Element-126 Jul 26 '18 at 12:57
  • @Element-126 Hm. I've re-read your question in light of the input device failure you've pointed out. I suggest you disclose the specific hardware you're using. You aren't likely to get a "generic" solution for something that's specific to the device you are using. – Michael Hampton Jul 26 '18 at 12:59

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.