IVI/Mapping multiple touchscreen Wayland

From Tizen Wiki
< IVI
Jump to: navigation, search

Introduction

In a multitouchscreen scenario, it is important to be able to correctly map the touchscreen input to the right screen. Wayland/Weston provide a mechanism for doing just that that leverages udev so that you can also make this a permanent rule for your own system.

Collecting the right information

You really need two things to be able to define the mapping:

  • "<display name>", this can be obtained by looking at the weston log [1]. It typically is something like HDMI1, HDMI2, VGA1, UNKNOWN1, ...
  • Information about the touchscreen, e.g.: vendor_id, product_id
Note: You can get that information from /sys/class/input/inputX/[name|id/] where 'X' is the input number associated with the touchscreen.
Note2: It's frequently the case that you want to use multiple instances of the exact same device in which case the vendor_id and product_id alone are not sufficient to uniquely identify your device. In such case, you can also use the DEVPATH, e.g.: DEVPATH=="/devices/pci0000:00/0000:00:14.0/usb3/3-4/*". Be aware when doing so that you will have to adjust your DEVPATH value if you later use a different USB port.

How to get the right DEVPATH value for your device:

  1. $udevadm monitor
  2. Plug your USB touchscreen device
  3. Write down the DEVPATH value

Notes

[1] Log in as 'root' and use journalctl -b to view all system logs (for that boot), the weston output is captured as part of it.

Creating a customer udev rule

Once you have collected the relevant information, you can put it all together by creating a custom udev rule:

  • Typically put it under: /etc/udev/rules.d/
E.g.: /etc/udev/rules.d/multi-touch.rules
  • Put the following info in this file:
ENV{ID_VENDOR_ID}=="<vendor_id>",ENV{ID_MODEL_ID}=="<product_id>",DEVPATH=="/devices/pci0000:00/0000:00:14.0/usb3/3-4/*",ENV{WL_OUTPUT}="<display name>"

Where vendor_id, product_id, DEVPATH and display_name should be replaced by the values collected previously.

Applying the changes

  • Unplug and replug the touch device to apply the new udev rules
  • Restart Weston

... or simply reboot your device

Resources

Wayland