I wasn’t able to find any option in BIOS to disable the touchscreen in my ThinkPad X1C laptop and even after spending a considerable time in searching for the same I didn’t land on any post explaining a straight forward solution.
Here I’m noting down the solution which is working for almost half an year without any changes. I tried a fair share of experimenting with udev rules, however due to how the PCI enumerates devices the results weren’t consistent.
Another challenge was multiple devices sharing same driver and when the driver itself is unloaded then all these devices would fail to work, for example, intel-lpss
is shared by touchpad and touchscreen.
Find the input device §
It goes without saying that touchscreen is one of the input devices and so we start off finding all the input devices, then isolate the device which responds to touchscreen events.
I found evtest
over lshw
more helpful at this task. First install the package via sudo dnf install evtest
Below is the output when evtest
is run on my laptop:
|
|
One of the input devices highlighted above should be responding to touchscreen events. The reason for choosing these are ELAN
(touch controller electronics) and Mouse/Tochpad
.
In my case I’ve selected 7
, touched the screen and can see the events generated in output of evtest
, it can be different in your case.
|
|
Find the Kernel representation of the device §
Find the device under /sys/bus/hid/devices
corresponding to the ID highlighted in above listing, i.e, bus 0x18 vendor 0x4f3 product 0x2c29
. /sys/bus
is the generic path to find the devices & drivers, hid
is Human Interface Devices
.
-> ls /sys/bus/hid/devices/*2C29* -d
/sys/bus/hid/devices/0018:04F3:2C29.0002
All that’s left is to unbind the driver for this device, thereby we don’t respond to the events generated by this device.
Unbind the device §
We can simply echo
the device ID to /sys/bus/hid/drivers/hid-multitouch/unbind
and all the events from touchscreen will be dropped.
-> echo 0018:04F3:2C29.0002 | sudo tee /sys/bus/hid/drivers/hid-multitouch/unbind
0018:04F3:2C29.0002
The ID after the dot (0002
) can change after a reboot during PCI device enumeration, as a result we need to grab the device ID from /sys/bus/hid/devices
and unbind it.
After performing above, we can confirm that this device doesn’t show up in sudo evtest
.
Create systemd
unit to automate unbind §
Create a systemd
unit file, reload the daemon and enable the unit. After reboot, events from touchscreen will be dropped.
# replace the value with your device product id
# note: use capitalized hex values
-> product_id="2C29"
-> sudo tee /etc/systemd/system/disable-touchscreen.service > /dev/null << EOF
[Unit]
Description=Unbind touchscreen device
[Service]
Type=oneshot
ExecStart=/bin/bash -c "basename \$(ls /sys/bus/hid/devices/*$product_id* -d) > /sys/bus/hid/drivers/hid-multitouch/unbind"
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
EOF
-> sudo systemctl daemon-reload && sudo systemctl enable disable-touchscreen.service
Please drop a note if you find a way to disable the touchscreen in the BIOS/UEFI, I believe above solution just stops responding to the events generated by this device but not forget this device altogether, so I suspect this still draws battery even though a reduced amount.