如何将校准参数应用于 Elo 串行触摸屏?

如何将校准参数应用于 Elo 串行触摸屏?

在 Xubuntu 18.04 中,我尝试将校准参数应用于触摸屏,但没有成功。以下是我目前所得到的...

我可以手动连接设备并执行如下校准:

$ sudo /usr/bin/inputattach --daemon --always -elo /dev/ttyS2
$ xinput set-int-prop "Elo Serial TouchScreen" "Evdev Axis Calibration" 32 0 4095 0 4095
$ xinput_calibrator --output-type xinput
$ xinput set-int-prop "Elo Serial TouchScreen" "Evdev Axis Calibration" 32 -97 4087 -48 4108

但我设置的新参数没有效果,即使xinput列出了更新的值。我找到的所有信息都相当陈旧。有人建议应该evdev使用 代替libinput(稍后会详细介绍),但无法安装。

以下是我在图形服务器配置中自动附加输入和处理校准的操作:

$ cat /etc/udev/rules.d/99-elographics.rules
ACTION=="add|change", SUBSYSTEM=="tty|pnp", KERNEL=="ttyS2", TAG+="systemd", ENV{SYSTEMD_WANTS}+="elo-inputattach@%k.service"

$ cat /etc/systemd/system/[email protected]
[Unit]
Description=inputattach for elo serial devices

[Service]
Type=simple
ExecStart=/usr/bin/inputattach -elo /dev/%I

$ cat /usr/share/X11/xorg.conf.d/99-calibration.conf
Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "Elo Serial TouchScreen"
        Option  "MinX"  "-1587"
        Option  "MaxX"  "66954"
        Option  "MinY"  "-690"
        Option  "MaxY"  "67633"
        Option  "SwapXY"        "0" # unless it was already set to 1
        Option  "InvertX"       "0"  # unless it was already set
        Option  "InvertY"       "0"  # unless it was already set
EndSection

在 99-calibration.conf 中我尝试了各种选项,例如

Option  "Calibration"  "-97 4087 -48 4108"

evdev我也尝试在该部分中将驱动程序设置为,但它会恢复为libinput

以下是 /var/log/Xorg.0.log 的摘录:

[  1446.102] (II) config/udev: Adding input device Elo Serial TouchScreen (/dev/input/event15)
[  1446.102] (**) Elo Serial TouchScreen: Applying InputClass "libinput touchscreen catchall"
[  1446.102] (**) Elo Serial TouchScreen: Applying InputClass "calibration"
[  1446.102] (II) Using input driver 'libinput' for 'Elo Serial TouchScreen'
[  1446.102] (**) Elo Serial TouchScreen: always reports core events
[  1446.102] (**) Option "Device" "/dev/input/event15"
[  1446.102] (**) Option "_source" "server/udev"
[  1446.103] (II) event15 - Elo Serial TouchScreen: is tagged by udev as: Touchscreen
[  1446.103] (II) event15 - Elo Serial TouchScreen: device is a touch device
[  1446.103] (II) event15 - Elo Serial TouchScreen: device removed
[  1446.135] (**) Option "config_info" "udev:/sys/devices/pnp0/00:08/tty/ttyS2/serio1/input/input7/event15"
[  1446.135] (II) XINPUT: Adding extended input device "Elo Serial TouchScreen" (type: TOUCHSCREEN, id 13)
[  1446.135] (**) Option "AccelerationScheme" "none"
[  1446.135] (**) Elo Serial TouchScreen: (accel) selected scheme none/0
[  1446.135] (**) Elo Serial TouchScreen: (accel) acceleration factor: 2.000
[  1446.135] (**) Elo Serial TouchScreen: (accel) acceleration threshold: 4
[  1446.136] (II) event15 - Elo Serial TouchScreen: is tagged by udev as: Touchscreen
[  1446.136] (II) event15 - Elo Serial TouchScreen: device is a touch device
[  1446.137] (II) config/udev: Adding input device Elo Serial TouchScreen (/dev/input/mouse1)
[  1446.137] (**) Elo Serial TouchScreen: Applying InputClass "calibration"
[  1446.137] (II) No input driver specified, ignoring this device.
[  1446.137] (II) This device may have been added with another device file.

答案1

我从供应商那里收到了一个安装包,虽然它不起作用,但却帮助我找到了解决方案。

首先,要安装evdev,请执行以下操作:# apt install xserver-xorg-input-evdev-hwe-18.04。其次,需要额外的 X 配置才能使用该驱动程序。最后,校准参数语法不正确。改进和添加如下:

$ cat /etc/udev/rules.d/99-elographics.rules
ACTION=="add|change", SUBSYSTEM=="tty|pnp", KERNEL=="ttyS2", TAG+="systemd", ENV{SYSTEMD_WANTS}+="elo-inputattach@%k.service"

$ cat /etc/systemd/system/[email protected]
[Unit]
Description=Serial touch display enablement
Before=display-manager.service

[Service]
Type=simple
Restart=always
RestartSec=3s
ExecStart=/usr/bin/inputattach -elo /dev/%i

[Install]
WantedBy=graphical.target

$ cat /usr/share/X11/xorg.conf.d/50-touch-screen.conf
Section "InputClass"
    Identifier         "evdev touchscreen override"
    MatchIsTouchscreen "on"
    MatchDevicePath    "/dev/input/event*"
    Driver             "evdev"
EndSection

$ cat /usr/share/X11/xorg.conf.d/99-calibration.conf
Section "InputClass"
    Identifier   "calibration"
    MatchProduct "Elo Serial TouchScreen"
    Option       "Calibration" "10 4080 80 4100"
    Option       "SwapAxes"    "0"
EndSection

相关内容