How to map a touchscreen#
With our Weston
display compositor, you will need to explicitly configure which display the
touchscreen should belong to.
For SimpleCore™ images, the main configuration file is /etc/touchscreens.json
.
It is a key-value map that is probed in the following order
<ID_VENDOR_ID>:<ID_MODEL_ID>:<ID_SERIAL>
<ID_VENDOR_ID>:<ID_MODEL_ID>:<ID_PATH_TAG>
<ID_VENDOR_ID>:<ID_MODEL_ID>
if found the value of that key is the display name.
Available display names can be found with
$ cat /run/simplecore-weston.ini | grep -C 2 "output" | grep "name" | cut -d'=' -f2
An example#
Let’s say your USB input device is announced as /dev/input/event1
.
Now you can get all the needed attributes by running
$ udevadm info -n /dev/input/event1
P: /devices/platform/soc@0/32f10108.usb/38200000.dwc3/xhci-hcd.2.auto/usb3/3-1/3-1.2/3-1.2.3/3-1.2.3:1.0/0003:222A:0001.0001/input/input1/event1
N: input/event1
L: 0
S: input/touchscreen0
S: input/by-path/platform-xhci-hcd.2.auto-usb-0:1.2.3:1.0-event
S: input/by-id/usb-ILITEK_ILITEK-TP-event-if00
E: DEVPATH=/devices/platform/soc@0/32f10108.usb/38200000.dwc3/xhci-hcd.2.auto/usb3/3-1/3-1.2/3-1.2.3/3-1.2.3:1.0/0003:222A:0001.0001/input/input1/event1
E: DEVNAME=/dev/input/event1
E: MAJOR=13
E: MINOR=65
E: SUBSYSTEM=input
E: USEC_INITIALIZED=8071563
E: ID_INPUT=1
E: ID_INPUT_TOUCHSCREEN=1
E: ID_INPUT_WIDTH_MM=215
E: ID_INPUT_HEIGHT_MM=135
E: ID_VENDOR=ILITEK
E: ID_VENDOR_ENC=ILITEK
E: ID_VENDOR_ID=222a
E: ID_MODEL=ILITEK-TP
E: ID_MODEL_ENC=ILITEK-TP
E: ID_MODEL_ID=0001
E: ID_REVISION=0000
E: ID_SERIAL=ILITEK_ILITEK-TP
E: ID_TYPE=hid
E: ID_BUS=usb
E: ID_USB_INTERFACES=:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=usbhid
E: ID_PATH=platform-xhci-hcd.2.auto-usb-0:1.2.3:1.0
E: ID_PATH_TAG=platform-xhci-hcd_2_auto-usb-0_1_2_3_1_0
E: LIBINPUT_DEVICE_GROUP=3/222a/1:usb-xhci-hcd.2.auto-1.2
E: DEVLINKS=/dev/input/touchscreen0 /dev/input/by-path/platform-xhci-hcd.2.auto-usb-0:1.2.3:1.0-event /dev/input/by-id/usb-ILITEK_ILITEK-TP-event-if00
In case you can describe the device uniquely with the help of <ID_VENDOR_ID>
an <ID_MODEL_ID>
(or you only have a single touchscreen of the
corresponding manufacturer), add
"222a:0001": "<DISPLAY_NAME>"
to the configuration file (/etc/touchscreens.json
).
In case you have multiple touchscreens of the same manufacturer (and ID_SERIAL
is not a per-device value), add the values suffixed with the USB
port they are connected to (ID_PATH_TAG
)
"222a:0001:platform-xhci-hcd_2_auto-usb-0_1_2_3_1_0": "<DISPLAY_NAME_1>",
"222a:0001:platform-xhci-hcd_2_auto-usb-0_1_2_4_1_0": "<DISPLAY_NAME_2>",
Only static connection schemes are supported
This will not work if the USB port is set dynamically. Only static connections are possible.
If, for instance, we have two touchscreens of
<ID_VENDOR_ID>=1111
and<ID_MODEL_ID>=0001
, connected to displayLVDS-1
as well as
<ID_VENDOR_ID>=2222
and<ID_MODEL_ID>=0001
, connected toHDMI-1
the resulting configuration looks like
Automatic fallback
If the configured display isn’t available Weston
will automatically fall back to
the first display (usually LVDS
, if available)