Eu uso um monitor de 7 "com touchscreen resistivo, Linux embarcado para CPU ARM. Fabricante Engicam, o design é similar ao Freesale / NXP i.MX6 Sabre board.
Com o pacote de suporte a placas Yocto 1.7.3 e Engicam, criei um aplicativo X11, basicamente um navegador Firefox. A maior parte deste aplicativo funciona com uma exceção: não consigo tocar / clicar em nenhum item. Quando eu toco na tela e me movo, o cursor segue meu dedo, infelizmente um clique ou um clique duplo não funciona.
Minha configuração:
Kernel: Linux display 3.10.17-1.0.2_ga+g33597e3 #1 SMP PREEMPT Sun May 22 20:00:34 CEST 2016 armv7l GNU/Linux
Driver de toque resistivo: max11801_ts
e driver de evento evdev
.
O arquivo de configuração para evdev ( /usr/share/X11/xorg.conf.d/10-evdev.conf
):
#
# Catch-all evdev loader for udev-based systems
# We don't simply match on any device since that also adds accelerometers
# and other devices that we don't really want to use. The list below
# matches everything but joysticks.
Section "InputClass"
Identifier "evdev pointer catchall"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev keyboard catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev tablet catchall"
MatchIsTablet "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "SHMConfig" "true"
Option "TapButton1" "1"
Option "EmulateThirdButton" "1"
Option "EmulateThirdButtonTimeout" "750"
Option "EmulateThirdButtonMoveThreshold" "30"
Option "Calibration" "0 4095 0 4095"
EndSection
A última seção é usada pelo evdev para touchscreen.
No log do X11, vejo que o X11 carrega o evdev e aceita as configurações:
Parte do log X11 ( /var/log/Xorg.0.log
):
[3738325.274] (**) max11801_ts: Applying InputClass "evdev touchscreen catchall"
[3738325.274] (II) LoadModule: "evdev"
[3738325.275] (II) Loading /usr/lib/xorg/modules/input/evdev_drv.so
[3738325.289] (II) Module evdev: vendor="X.Org Foundation"
[3738325.289] compiled for 1.14.4, module version = 2.9.0
[3738325.289] Module class: X.Org XInput Driver
[3738325.289] ABI class: X.Org XInput driver, version 19.1
[3738325.289] (II) Using input driver 'evdev' for 'max11801_ts'
[3738325.290] (**) max11801_ts: always reports core events
[3738325.293] (**) evdev: max11801_ts: Device: "/dev/input/event0"
[3738325.294] (--) evdev: max11801_ts: Vendor 0 Product 0
[3738325.295] (--) evdev: max11801_ts: Found absolute axes
[3738325.295] (--) evdev: max11801_ts: Found x and y absolute axes
[3738325.295] (--) evdev: max11801_ts: Found absolute touchscreen
[3738325.295] (II) evdev: max11801_ts: Configuring as touchscreen
[3738325.296] (**) Option "EmulateThirdButton" "1"
[3738325.296] (**) Option "EmulateThirdButtonTimeout" "750"
[3738325.296] (**) Option "EmulateThirdButtonMoveThreshold" "30"
[3738325.297] (**) evdev: max11801_ts: YAxisMapping: buttons 4 and 5
[3738325.297] (**) evdev: max11801_ts: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
[3738325.297] (**) Option "config_info" "udev:/sys/devices/soc0/soc.1/2100000.aips-bus/21a0000.i2c/i2c-0/0- 0048/input/input0/event0"
[3738325.297] (II) XINPUT: Adding extended input device "max11801_ts" (type: TOUCHSCREEN, id 6)
[3738325.299] (II) evdev: max11801_ts: initialized for absolute axes.
[3738325.300] (**) max11801_ts: (accel) keeping acceleration scheme 1
[3738325.301] (**) max11801_ts: (accel) acceleration profile 0
[3738325.301] (**) max11801_ts: (accel) acceleration factor: 2.000
[3738325.301] (**) max11801_ts: (accel) acceleration threshold: 4
[3738325.305] (II) config/udev: Adding input device max11801_ts (/dev/input/mouse0)
[3738325.305] (II) No input driver specified, ignoring this device.
[3738325.305] (II) This device may have been added with another device file.
O xinput também vê o dispositivo de toque:
# xinput list
| Virtual core pointer id=2 [master pointer (3)]
| > Virtual core XTEST pointer id=4 [slave pointer (2)]
| > max11801_ts id=6 [slave pointer (2)]
| Virtual core keyboard id=3 [master keyboard (2)]
| Virtual core XTEST keyboard id=5 [slave keyboard (3)]
Infelizmente, o evtest não vê nenhum evento de clique (EV_KEY) (BTN_TOUCH):
# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: max11801_ts
Select the device event number [0-0]: 0
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
Input device name: "max11801_ts"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 330 (BTN_TOUCH)
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 1308
Min 0
Max 4095
Event code 1 (ABS_Y)
Value 476
Min 0
Max 4095
Event code 24 (ABS_PRESSURE)
Value 0
Min 0
Max 1
Properties:
Testing ... (interrupt to exit)
Event: time 1464027536.266584, type 3 (EV_ABS), code 0 (ABS_X), value 1167
Event: time 1464027536.266584, type 3 (EV_ABS), code 1 (ABS_Y), value 2282
Event: time 1464027536.266584, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 1
Event: time 1464027536.266584, -------------- EV_SYN ------------
Event: time 1464027536.282916, type 3 (EV_ABS), code 0 (ABS_X), value 1168
Event: time 1464027536.282916, -------------- EV_SYN ------------
Event: time 1464027536.299472, type 3 (EV_ABS), code 0 (ABS_X), value 1169
Event: time 1464027536.299472, -------------- EV_SYN ------------
Event: time 1464027536.315900, type 3 (EV_ABS), code 0 (ABS_X), value 1171
Event: time 1464027536.315900, type 3 (EV_ABS), code 1 (ABS_Y), value 2281
Event: time 1464027536.315900, -------------- EV_SYN ------------
Event: time 1464027536.340587, type 3 (EV_ABS), code 0 (ABS_X), value 1172
Event: time 1464027536.340587, -------------- EV_SYN ------------
Event: time 1464027536.348821, type 3 (EV_ABS), code 0 (ABS_X), value 1173
Event: time 1464027536.348821, -------------- EV_SYN ------------
Event: time 1464027536.357047, type 3 (EV_ABS), code 0 (ABS_X), value 1174
Event: time 1464027536.357047, type 3 (EV_ABS), code 1 (ABS_Y), value 2283
Event: time 1464027536.357047, -------------- EV_SYN ------------
Event: time 1464027536.365190, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 0
Event: time 1464027536.365190, -------------- EV_SYN ------------
evtest do não não vê eventos EV_KEY / BTN_TOUCH.
Fiz mais pesquisas e descobri que o ts_test vai ver eventos BTN_TOUCH:
# TSLIB_TSDEVICE=/dev/input/touchscreen0 ts_test
1464048778.716232: 399 239 1
1464048778.724452: 399 239 1
1464048778.732621: 399 239 1
1464048778.740965: 399 238 1
1464048778.749177: 399 237 1
1464048778.757422: 399 236 0
Eu suponho que a última coluna são os eventos BTN_TOUCH.
Eu também tentei xinput_calibrator
# xinput_calibrator
Calibrating EVDEV driver for "max11801_ts" id=6
current calibration values (from XInput): min_x=0, max_x=4095 and min_y=0, max_y=4095
A cruz superior esquerda será exibida, quando eu toco a mira com uma caneta, o cursor se move para essa posição, mas xinput_calibrator
não recebe um evento de clique.
O mesmo problema com o Firefox, não consigo tocar / clicar em nenhum item.
Por que não vêem os eventos BTN_TOUCH? Isso é um problema de configuração ou um bug?
Como posso obter eventos de cliques?
Tags x11 linux touch-screen yocto