The core-image-sato default image in Yocto has touch support, but chances are it takes some tweaking to make it work. In my case I am using Digi’s ConnectCore for MX51 JumpStart Kit with a custom Yocto image, based in core-image-sato, and a resistive touch. The touch is driven by the MXC_TS driver from the Freescale BSP for the i.MX5X.
Testing the kernel touch support
Some basics checks to make sure the touch is functional:
input: mxc_ts as /devices/virtual/input/input0
mxc input touchscreen loaded
cat /sys/devices/virtual/input/input0/uevent
PRODUCT=0/0/0/0
NAME="mxc_ts"
EV==b
KEY==400 0 0 0 0 0 0 0 0 0 0
ABS==1000003
MODALIAS=input:b0000v0000p0000e0000-e0,1,3,k14A,ra0,1,18,mlsfw
cat /sys/devices/virtual/input/input0/event0/uevent
MAJOR=13
MINOR=64
DEVNAME=input/event0
cat /dev/input/event0 | hexdump
0000000 002e 0000 f889 0008 0003 0000 06cb 0000
0000010 002e 0000 f89f 0008 0003 0001 03c2 0000
0000020 002e 0000 f8a5 0008 0003 0018 0001 0000
0000030 002e 0000 f8ab 0008 0000 0000 0000 0000
0000040 002e 0000 f27b 0009 0003 0000 001f 0000
User space touch support
Usually embedded distributions have been using tslib for touch support, so I like starting with tslib and its test applications ts_calibrate and ts_test over the framebuffer.
export TSLIB_TSDEVICE="/dev/input/event0"
export TSLIB_CONFFILE="/etc/ts.conf"
/usr/bin/ts_calibrate
cat /etc/X11/xorg.conf
Section "Device"
Identifier "i.MX Accelerated Framebuffer Device"
Driver "imx"
Option "fbdev" "/dev/fb0"
# This option only recognized when "mxc_epdc_fb" frame buffer driver in
# use. Values are "RGB565" (default, 16-bit RGB), "Y8" (8-bit gray),
# and "Y8INV" (8-bit gray inverted).
Option "FormatEPDC" "Y8INV"
EndSection
Section "ServerFlags"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSection
cat 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"
EndSection
sh-4.2# xinput list
Virtual core pointer id=2 [master pointer (3)]
Virtual core XTEST pointer id=4 [slave pointer (2)]
Dell Dell USB Optical Mouse id=7 [slave pointer (2)]
mxc_ts id=8 [slave pointer (2)]
Virtual core keyboard id=3 [master keyboard (2)]
Virtual core XTEST keyboard id=5 [slave keyboard (3)]
DELL Dell QuietKey Keyboard id=6 [slave keyboard (3)]
sh-4.2# xinput list-props mxc_ts
Device 'mxc_ts':
Device Enabled (112): 1
Coordinate Transformation Matrix (113): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (233): 0
Device Accel Constant Deceleration (234): 1.000000
Device Accel Adaptive Deceleration (235): 1.000000
Device Accel Velocity Scaling (236): 10.000000
Device Product ID (230): 0, 0
Device Node (231): "/dev/input/event0"
Evdev Axis Inversion (237): 0, 0
Evdev Axis Calibration (238): 985, 42, 935, 58
Evdev Axes Swap (239): 1
Axis Labels (240): "Abs X" (254), "Abs Y" (255), "Abs Pressure" (256)
Button Labels (241): "Button Unknown" (232), "Button Unknown" (232), "Button Unknown" (232), "Button Wheel Up" (118), "Button Wheel Down" (119)
Evdev Middle Button Emulation (242): 0
Evdev Middle Button Timeout (243): 50
Evdev Third Button Emulation (244): 0
Evdev Third Button Emulation Timeout (245): 1000
Evdev Third Button Emulation Button (246): 3
Evdev Third Button Emulation Threshold (247): 20
Evdev Wheel Emulation (248): 0
Evdev Wheel Emulation Axes (249): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (250): 10
Evdev Wheel Emulation Timeout (251): 200
Evdev Wheel Emulation Button (252): 4
Evdev Drag Lock Buttons (253): 0
Manual touch calibration
For manual calibration you need to use the evtest application. If using Yocto just do:
bitbake evtest
evtest /dev/input/event0
evtest /dev/input/event0
Input driver version is 1.0.0
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "mxc_ts"
Supported events:
Event type 0 (Sync)
Event type 1 (Key)
Event code 330 (Touch)
Event type 3 (Absolute)
Event code 0 (X)
Value 340
Min 0
Max 1023
Event code 1 (Y)
Value 430
Min 0
Max 1023
Event code 24 (Pressure)
Value 0
Min 0
Max 1023
Testing ... (interrupt to exit)
Event: time 3872.440377, type 3 (Absolute), code 0 (X), value 914
Event: time 3872.440383, type 3 (Absolute), code 1 (Y), value 966
Event: time 3872.440386, type 3 (Absolute), code 24 (Pressure), value 46
Event: time 3872.440388, type 1 (Key), code 330 (Touch), value 1
Event: time 3872.440391, -------------- Report Sync ------------
Event: time 3872.470939, type 3 (Absolute), code 0 (X), value 909
Event: time 3872.470945, type 3 (Absolute), code 1 (Y), value 970
Event: time 3872.470950, -------------- Report Sync ------------
Event: time 3872.501124, type 3 (Absolute), code 24 (Pressure), value 0
Event: time 3872.501130, type 1 (Key), code 330 (Touch), value 0
Event: time 3872.501132, -------------- Report Sync ------------
xinput set-prop "mxc_ts" "Evdev Axis Calibration" xmin xmax ymin ymax
xinput set-prop "mxc_ts" "Evdev Axes Swap" 1
Section "InputClass"
Identifier "evdev touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "Calibration" "xmin xmax ymix ymax"
Option "SwapAxes" "1"
EndSection