Troubleshooting:touchscreen

From postmarketOS Wiki

Generic debugging steps

Test with evtest

You can test if the touchscreen emits any events with evtest. Details may vary even between different working screens and their drivers. See Linux kernel Multi-touch Protocol documentation for what a correctly working touchscreen driver should emit.

In the working case, evtest might output something like below when the screen is touched.

Testing ... (interrupt to exit)
Event: time 1262306351.564957, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1262306351.564957, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 0
Event: time 1262306351.564957, type 3 (EV_ABS), code 48 (ABS_MT_TOUCH_MAJOR), value 8
Event: time 1262306351.564957, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 101
Event: time 1262306351.564957, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 163
Event: time 1262306351.564957, ++++++++++++++ SYN_MT_REPORT ++++++++++++
Event: time 1262306351.564957, -------------- SYN_REPORT ------------
Event: time 1262306351.590508, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 0
Event: time 1262306351.590508, type 3 (EV_ABS), code 48 (ABS_MT_TOUCH_MAJOR), value 8
Event: time 1262306351.590508, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 103
Event: time 1262306351.590508, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 155
Event: time 1262306351.590508, ++++++++++++++ SYN_MT_REPORT ++++++++++++
Event: time 1262306351.590508, -------------- SYN_REPORT ------------

Test with libinput debug-events

You can check if libinput understands the events your touchscreen driver emits with libinput debug-events.

For example it's possible that libinput doesn't get any events or that it doesn't get TOUCH_DOWN/TOUCH_UP events. You can see the raw events libinput receives with libinput record.

Following is example output from libinput debug-events when the screen is briefly touched in a case where the touchscreen is working correctly:

$ libinput debug-events
 event10  TOUCH_DOWN       +0.000s	0 (0) 53.40/23.11 (385.00/296.00mm)
 event10  TOUCH_FRAME      +0.000s	
 event10  TOUCH_MOTION     +0.010s	0 (0) 52.84/24.04 (381.00/308.00mm)
 event10  TOUCH_FRAME      +0.010s	
 event10  TOUCH_MOTION     +0.020s	0 (0) 52.70/24.36 (380.00/312.00mm)
 event10  TOUCH_FRAME      +0.020s	
 event10  TOUCH_MOTION     +0.039s	0 (0) 52.70/24.51 (380.00/314.00mm)
 event10  TOUCH_FRAME      +0.039s	
 event10  TOUCH_UP         +0.065s	
 event10  TOUCH_FRAME      +0.065s

Mediatek devices

Some touchscreen drivers on Mediatek devices have issues because they don't follow the standards. You can compare the driver source of your driver (especially the functions tpd_up and tpd_down) with the Fairphone 1 touchscreen driver and see if adjusting your touchscreen driver to mostly match that behavior helps.

sec_touchscreen: kernel bug

event3 - sec_touchscreen: kernel bug: device has min == max on ABS_MT_PRESSURE from libinput debug-events

This message, which can be found in libinput debug-events indicates that the touchscreen driver in the kernel is misbehaving and that libinput won't accept the input.

In this case, solving the issue means patching the touchscreen driver, which will require you to modify your kernel code. While the device is running, figure out which driver is being used, perhaps by running find /sys -name "input*" or find /sys -name "event*", use grep in your kernel source to find the line line that contains input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 0);, and comment it out. Rebuild the kernel and try again. See our patching guide for more information about how to make these changes correctly.

See also