thoughtexpo

Disable Touchscreen in Fedora

Published: Aug 13, 2023 • Lastmod: Aug 14, 2023 • Author: Leela Venkaiah G • 4 min read

Tags: #fedora

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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-> sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      Sleep Button
/dev/input/event1:      Lid Switch
/dev/input/event10:     Video Bus
/dev/input/event11:     Intel HID events
/dev/input/event12:     PC Speaker
/dev/input/event13:     ThinkPad Extra Buttons
/dev/input/event14:     sof-hda-dsp Mic
/dev/input/event15:     sof-hda-dsp Headphone
/dev/input/event16:     sof-hda-dsp HDMI/DP,pcm=3
/dev/input/event17:     sof-hda-dsp HDMI/DP,pcm=4
/dev/input/event18:     sof-hda-dsp HDMI/DP,pcm=5
/dev/input/event2:      Power Button
/dev/input/event3:      AT Translated Set 2 keyboard
/dev/input/event4:      TPPS/2 Elan TrackPoint
/dev/input/event5:      ELAN0672:00 04F3:3187 Mouse
/dev/input/event6:      ELAN0672:00 04F3:3187 Touchpad
/dev/input/event7:      ELAN901C:00 04F3:2C29
/dev/input/event8:      ELAN901C:00 04F3:2C29 UNKNOWN
/dev/input/event9:      ELAN901C:00 04F3:2C29 UNKNOWN
Select the device event number [0-18]: ^C

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.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[...]
/dev/input/event9:      ELAN901C:00 04F3:2C29 UNKNOWN
Select the device event number [0-18]: 7
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x4f3 product 0x2c29 version 0x100
Input device name: "ELAN901C:00 04F3:2C29"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 330 (BTN_TOUCH)
[...]
# below are the generated events
Properties:
  Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)
Event: time 1691912451.145747, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 28
Event: time 1691912451.145747, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 2482
Event: time 1691912451.145747, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 1392
[...]
Event: time 1691912451.381050, -------------- SYN_REPORT ------------
Event: time 1691912451.387687, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value -1
Event: time 1691912451.387687, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 1691912451.387687, type 4 (EV_MSC), code 5 (MSC_TIMESTAMP), value 238800
Event: time 1691912451.387687, -------------- SYN_REPORT ------------
^C

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.


Thanks for your time and I hope it is well spent, I'll be very happy to hear your thoughts in comments section or you can contact me by any means mentioned in the footer 😄.

Share on ...

So long 👋 ...