The Librem 5 development board is supplied with an LCD screen with an overlaid touchscreen. User input from the screen is delivered to user-space via touch events. This guide describes how to receive and interpret these events.

Note: This guide assumes that you are using a device tree binary file that is configured for LCD display and touchscreen input. Follow the procedure in HDMI to copy the correct file into place on the development board.


The commands and script given in the next section will need to be executed using sudo unless the user is in the input group. We assume that the user has been added to this group from this point onwards.

Receiving Touch Events

Events from the touchscreen are typically delivered to the /dev/input/event1 file. This can be verified by using the lsinput tool from the input-utils Debian package. Install and run the tool like this:

sudo apt install input-utils

This should produce output like the following:

   bustype : BUS_HOST
   vendor  : 0x1
   product : 0x1
   version : 256
   name    : "gpio-keys"
   phys    : "gpio-keys/input0"
   bits ev : (null) (null)

   bustype : BUS_I2C
   vendor  : 0x416
   product : 0x1638
   version : 256
   name    : "Goodix Capacitive TouchScreen"
   phys    : "input/ts"
   bits ev : (null) (null) (null)

One way to examine these events is to run the evtest command:

evtest /dev/input/event1

This will listen for events from the touchscreen and write them in human-readable form to the console.

Events can also be read using the python-evdev package. The following program reads events from the device and prints their screen coordinates:

#!/usr/bin/env python3

import evdev
from evdev.ecodes import (ABS_MT_TRACKING_ID, ABS_MT_POSITION_X,
import select

# Obtain an object for the input device.
device = evdev.InputDevice('/dev/input/event1')

while True:

    # Wait for an event.
    r, w, x =[device.fd], [], [])

    id_ = -1
    x = y = 0

    # Read the events for the device.
    for event in

        if event.code == event.value == 0:
            if id_ != -1:
                print(x, y)
        elif event.code == ABS_MT_TRACKING_ID:
            id_ = event.value
        elif event.code == ABS_MT_POSITION_X:
            x = event.value
        elif event.code == ABS_MT_POSITION_Y:
            y = event.value

The python-evdev tutorial shows several ways of handling events that can be applied to various situations, using different techniques to read the event queue.