This seems to be libinput that receives a
SW_TABLET_MODE event from one of the laptops input devices. I don't know why they disable the keyboard and touchpad when receiving that event, but I would guess it was to avoid button presses on laptops you can flip the screen all the way around so the keyboard/touchpad is underneath the touch screen.
However, some laptop models emit this event even when the keyboard is not flipped around. Dell Precision 5760 has an "Intel HID switches" input device which triggers this event when the laptop is moved. So every time I triggered the accelerometer the internal keyboard and touchpad stopped working for some time. Before it went back to laptop mode. This bug seems to have been [fixed a few weeks ago], so hopefully it gets rolled out in a stable release soon.
Others have suggested blacklisting
intel_vbtn, but that didn't work for me. Probably because of a different driver in use. But I found a different workaround, which is a solution in libinput for this exact problem; register a quirk for the input device triggering tablet mode:
First you need to figure out which input device is triggering the
SW_TABLET_MODE event. Install libinput-tools to help you debug the problem:
$ sudo atp install libinput-tools
Now we need to record all input events with
sudo libinput debug-events. Start it, and try to trigger the
SW_TABLET_MODE event. It should look something like this:
-event27 SW_TABLET_MODE .....
That means it is
/dev/input/event27 which is triggering the tablet mode. It is probably a different number for others. Let's list the input devices to find out it's name:
$ sudo libinput list-devices
Look for the event number you got earlier and note down the device name:
Device: Intel HID switches
Now we need some identifiers for your computers modalias:
$ cat /sys/class/dmi/id/modalias
It doesn't really matter what part of it you pick, but I chose
svnDellInc.:pnPrecision5760: since it includes the manufacturer and model of my computer.
As root, create a file
MatchDMIModalias=dmi:*PART OF MODALIAS*
For my Dell Precision 5760 it looks like this:
[Precision 5760 Disable Tablet Mode]
MatchName=*Intel HID switches*
Save the file. To verify the quirk matches the device, try:
$ libinput quirks list /dev/input/event27
It should output the
Reboot your computer, and the
SW_TABLET_MODE events should be ignored.