Calibration of resistive touchscreens: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
Create page for calibration of touchscreen, it is meant to be included in other pages
 
m Remove headings
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
At our yocto images, we usually use libinput as library for handling input.
At our yocto images, we usually use libinput as library for handling input.


==== Prerequisites ====
'''<big>Prerequisites</big>'''
 
* Yocto packages ''weston'', ''weston-init'' and ''weston-examples'' have to be installed inside the image.
* Yocto packages ''weston'', ''weston-init'' and ''weston-examples'' have to be installed inside the image.
* The config file <tt>/etc/xdg/weston/weston.ini</tt> needs the following lines (to enable touchscreen calibration):
* The config file <tt>/etc/xdg/weston/weston.ini</tt> needs the following lines (to enable touchscreen calibration):
Line 14: Line 15:
|}
|}


==== Steps for calibration ====
'''<big>Steps for calibration</big>'''


'''1.''' Get the touchscreen device name with weston-touch-calibrator
'''1.''' Get the touchscreen device name with weston-touch-calibrator

Latest revision as of 07:39, 20 October 2023

On devices with resistive touchscreens, the touchscreen has to be calibrated.

At our yocto images, we usually use libinput as library for handling input.

Prerequisites

  • Yocto packages weston, weston-init and weston-examples have to be installed inside the image.
  • The config file /etc/xdg/weston/weston.ini needs the following lines (to enable touchscreen calibration):
[libinput]
touchscreen_calibrator=true

After changing the configuration of weston, weston needs to be restarted:

systemctl restart weston

Steps for calibration

1. Get the touchscreen device name with weston-touch-calibrator

XDG_RUNTIME_DIR=/var/run/user/$(id -u weston) weston-touch-calibrator

Example result (bold part is needed for next steps):

device "/sys/devices/platform/soc/2100000.bus/21a8000.i2c/i2c-2/2-0049/input/input0/event0" - head "DPI-1"

2. Run weston-touch-calibrator on the device for starting the calibration. With the example part of the last result, the command looks like this (bold part is from the last result):

XDG_RUNTIME_DIR=/var/run/user/$(id -u weston) weston-touch-calibrator -v /sys/devices/platform/soc/2100000.bus/21a8000.i2c/i2c-2/2-0049/input/input0/event0

Now you press the highlighted points at the touchscreen to calibrate it. You will now get an output on the console like this (the important part is marked bold):

Calibration values: -0.001472 -1.081086 1.033880 -1.135099 0.000319 1.082698

3. To make the calibration permanent, you need to add a udev rule. Create the file /etc/udev/rules.d/touchscreen-cal.rules and use the calibration values there. With the result of the previous example, the file looks like this (bold part is the result of the last example):

SUBSYSTEM=="input", KERNEL=="event[0-9]*", ENV{ID_INPUT_TOUCHSCREEN}=="1", ENV{LIBINPUT_CALIBRATION_MATRIX}="-0.001472 -1.081086 1.033880 -1.135099 0.000319 1.082698"