Touchscreen on embedded Linux can't tap / click

Peter Hutterer peter.hutterer at who-t.net
Sun Jul 3 23:28:19 UTC 2016


On Fri, Jul 01, 2016 at 08:42:47PM +0200, Walter Hofstädtler wrote:
> Benjamin,
> 
> now I managed to install evemu and tools. 
> 
> I recorded the events as requested:
> 
> # evemu-record /dev/input/event0 > evemu-record.txt
> 
> # EVEMU 1.3
> # Kernel: 3.10.17-1.0.2_ga+g33597e3
> # Input device name: "max11801_ts"
> # Input device ID: bus 0x18 vendor 0000 product 0000 version 0000
> # Supported events:
> #   Event type 0 (EV_SYN)
> #     Event code 0 (SYN_REPORT)
> #     Event code 1 (SYN_CONFIG)
> #     Event code 2 (SYN_MT_REPORT)
> #     Event code 3 (SYN_DROPPED)
> #     Event code 4 ((null))
> #     Event code 5 ((null))
> #     Event code 6 ((null))
> #     Event code 7 ((null))
> #     Event code 8 ((null))
> #     Event code 9 ((null))
> #     Event code 10 ((null))
> #     Event code 11 ((null))
> #     Event code 12 ((null))
> #     Event code 13 ((null))
> #     Event code 14 ((null))
> #   Event type 1 (EV_KEY)
> #     Event code 330 (BTN_TOUCH)
> #   Event type 3 (EV_ABS)
> #     Event code 0 (ABS_X)
> #       Value   1055
> #       Min        0
> #       Max     4095
> #       Fuzz       0
> #       Flat       0
> #       Resolution 0
> #     Event code 1 (ABS_Y)
> #       Value   2175
> #       Min        0
> #       Max     4095
> #       Fuzz       0
> #       Flat       0
> #       Resolution 0
> #     Event code 24 (ABS_PRESSURE)
> #       Value      0
> #       Min        0
> #       Max        1
> #       Fuzz       0
> #       Flat       0
> #       Resolution 0
> # Properties:
> N: max11801_ts
> I: 0018 0000 0000 0000
> P: 00 00 00 00 00 00 00 00
> B: 00 0b 00 00 00 00 00 00 00
> B: 01 00 00 00 00 00 00 00 00
> B: 01 00 00 00 00 00 00 00 00
> B: 01 00 00 00 00 00 00 00 00
> B: 01 00 00 00 00 00 00 00 00
> B: 01 00 00 00 00 00 00 00 00
> B: 01 00 04 00 00 00 00 00 00
> B: 01 00 00 00 00 00 00 00 00
> B: 01 00 00 00 00 00 00 00 00
> B: 01 00 00 00 00 00 00 00 00
> B: 01 00 00 00 00 00 00 00 00
> B: 01 00 00 00 00 00 00 00 00
> B: 01 00 00 00 00 00 00 00 00
> B: 02 00 00 00 00 00 00 00 00
> B: 03 03 00 00 01 00 00 00 00
> B: 04 00 00 00 00 00 00 00 00
> B: 05 00 00 00 00 00 00 00 00
> B: 11 00 00 00 00 00 00 00 00
> B: 12 00 00 00 00 00 00 00 00
> B: 14 00 00 00 00 00 00 00 00
> B: 15 00 00 00 00 00 00 00 00
> B: 15 00 00 00 00 00 00 00 00
> A: 00 0 4095 0 0 0
> A: 01 0 4095 0 0 0
> A: 18 0 1 0 0 0
> ################################
> #      Waiting for events      #
> ################################
> E: 0.000001 0003 0000 1099	# EV_ABS / ABS_X                1099
> E: 0.000001 0003 0001 2267	# EV_ABS / ABS_Y                2267
> E: 0.000001 0003 0018 0001	# EV_ABS / ABS_PRESSURE         1
> E: 0.000001 0000 0000 0000	# ------------ SYN_REPORT (0) ---------- +0ms
> E: 0.008188 0003 0000 1101	# EV_ABS / ABS_X                1101
> E: 0.008188 0003 0001 2269	# EV_ABS / ABS_Y                2269
> E: 0.008188 0000 0000 0000	# ------------ SYN_REPORT (0) ---------- +8ms
> E: 0.016291 0003 0000 1102	# EV_ABS / ABS_X                1102
> E: 0.016291 0003 0001 2272	# EV_ABS / ABS_Y                2272
> E: 0.016291 0000 0000 0000	# ------------ SYN_REPORT (0) ---------- +8ms
> E: 0.024413 0003 0000 1105	# EV_ABS / ABS_X                1105
> E: 0.024413 0003 0001 2276	# EV_ABS / ABS_Y                2276
> E: 0.024413 0000 0000 0000	# ------------ SYN_REPORT (0) ---------- +8ms
> E: 0.048606 0003 0018 0000	# EV_ABS / ABS_PRESSURE         0
> E: 0.048606 0000 0000 0000	# ------------ SYN_REPORT (0) ---------- +24ms
> E: 0.175553 0003 0000 1097	# EV_ABS / ABS_X                1097
> E: 0.175553 0003 0001 2309	# EV_ABS / ABS_Y                2309
> E: 0.175553 0003 0018 0001	# EV_ABS / ABS_PRESSURE         1
> ...
> 
> X11 with evdev do not see the touch/tap events.

disclosure: I didn't read the full backlog her, sorry

but based on the evemu output: evdev relies on BTN_TOUCH to send the event
and that's required by the kernel evdev protocol. and because the device
isn't a MT device and only sends normal x/y events, we don't send normal
touch sequences for it.

I suspect tslib looks at pressure rather than BTN_TOUCH for the left button
press. if this is your own kernel driver just send BTN_TOUCH with the
pressure and you shoudl be fine.

Cheers,
   Peter


> 
> 
> So I configured X11 to use tslib with this configuration file: /etc/X11/xorg.conf.d/tslib.conf 
> ~~~
> Section "InputDevice"
>     Identifier "tslib"
>     Driver "tslib"
>     Option "CorePointer"
>     Option "SendCoreEvent" "yes"
>     Option "Protocol" "Auto"
>     Option "Device"    "/dev/input/event0"
>     Option "ScreenNumber"  "0"
>     Option "Width" "0"
>     Option "Height"    "0"
>     Option "Rotate"    "NONE"
> EndSection
> 
> Section "InputClass"
>         Identifier "evdev touchscreen fallback"
>         Option "Ignore" "true"
> EndSection
> ~~~
> Using tslib, everything works, X11 recognizes all touch/tap events.
> 
> Using tslib, X11 treats " EV_ABS / ABS_PRESSURE 1" as an touch / tab event as expected.
>  
> 
> I am curious why X11 can't work when using evdev but successfully works when using tslib?
> An idea what's wrong?
> 
> Walter
> 
> -----Ursprüngliche Nachricht-----
> Von: Benjamin Tissoires [mailto:benjamin.tissoires at gmail.com] 
> Gesendet: Donnerstag, 23. Juni 2016 08:32
> An: Walter Hofstädtler
> Cc: Input Tools
> Betreff: Re: Touchscreen on embedded Linux can't tap / click
> 
> On Thu, Jun 23, 2016 at 8:24 AM, Walter Hofstädtler <walter at hofstaedtler.com> wrote:
> > Benjamin,
> >
> > sorry for the long delay, I tried to install evemu-record into my image.
> > I did not found an evemu.bb file, so I created my own "evemu_1.0.bb" file.
> >
> >  ~~~
> > SUMMARY = "Kernel evdev device emulation"
> > DESCRIPTION = "The evemu library and tools are used to describe devices, record data, create devices and replay data from kernel evdev devices. "
> > HOMEPAGE = "https://www.freedesktop.org/wiki/Evemu/"
> >
> > LICENSE = "GPLv3"
> > LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
> >
> > inherit autotools
> >
> > # this is the rev of your recipe. Bumping it will toss the cache and 
> > redo everything PR = "r2"
> >
> > # pick up latest svn rev for this module. Note this a deferred evaluation!
> > SRCREV = "${AUTOREV}"
> >
> > # ${PV} is pulled from the recipe filename, e.g. helloworld_2.7.bb -> ${PV} expands to "2.7".
> > # We use immediate evaluation to define a new var PVBASE holding the original value of ${PV}.
> > PVBASE := "${PV}"
> >
> > # We need to tell bitbake about our current directory structure or we 
> > won't be able to find patches after we mess with ${PV} FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PVBASE}:"
> >
> > # Then redefine PV to tack the svn rev onto the base version. This is evaluated at fetch time.
> > # Then the package will get rebuilt any time the relevant part of the source tree changes.
> > PV = "${PVBASE}.${SRCPV}"
> >
> > # Now we format the source code URI.
> > SRC_URI = "git://git.freedesktop.org/git/evemu"
> >
> > # build will fail without this; it specifies where in the workdir to 
> > find the source. The # name must be the same as the "module" name in SRC_URI.
> > # S = "${WORKDIR}/example"
> > S = "${WORKDIR}/git"
> >
> > PARALLEL_MAKE = ""
> >  ~~~
> >
> > But this will not compile, I always see this error:
> >
> >  ---
> > | /home/user/yocto_daisy/fsl-community-bsp/WH_icedtea/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/evemu/1.0.AUTOINC+4fc604554c-r2/git/configure: line 16167: syntax error near unexpected token `LIBEVDEV,'
> > | /home/user/yocto_daisy/fsl-community-bsp/WH_icedtea/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/evemu/1.0.AUTOINC+4fc604554c-r2/git/configure: line 16167: `PKG_CHECK_MODULES(LIBEVDEV, libevdev >= 1.2.99.902)'
> > | Configure failed. The contents of all config.log files follows to 
> > | aid debugging
> > | ERROR: oe_runconf failed
> > | WARNING: exit code 1 from a shell command.
> > | ERROR: Function failed: do_configure (log file is located at 
> > | /home/user/yocto_daisy/fsl-community-bsp/WH_icedtea/tmp/work/cortexa
> > | 9hf-vfp-neon-poky-linux-gnueabi/evemu/1.0.AUTOINC+4fc604554c-r2/temp
> > | /log.do_configure.13923)
> > ERROR: Task 329 (/home/user/yocto_daisy/fsl-community-bsp/sources/meta-wh/recipes-core/evemu/evemu_1.0.bb, do_configure) failed with exit code '1'
> > NOTE: Tasks Summary: Attempted 5583 tasks of which 5582 didn't need to be rerun and 1 failed.
> > No currently running tasks (3816 of 5593)
> >  ---
> >
> > Do you know how to fix this error: " syntax error near unexpected token `LIBEVDEV,'" ?
> 
> libevdev is a hard dependency for evemu. You need to have the development files for this lib installed too (https://www.freedesktop.org/wiki/Software/libevdev/).
> 
> Cheers,
> Benjamin
> 
> >
> >
> > Walter
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Benjamin Tissoires [mailto:benjamin.tissoires at gmail.com]
> > Gesendet: Mittwoch, 1. Juni 2016 09:56
> > An: Walter Hofstädtler
> > Cc: Input Tools
> > Betreff: Re: Touchscreen on embedded Linux can't tap / click
> >
> > On Tue, May 31, 2016 at 9:21 PM, Walter Hofstädtler <walter at hofstaedtler.com> wrote:
> >> Benjamin,
> >>
> >> attached you find dmesg log.
> >>
> >> Touch driver is a: max11801_ts.
> >
> > OK thanks.
> > The max11801_ts driver has basically had no changes since its inclusion in 3.0. And there, it reports BTN_TOUCH correctly. So both the 3.10 and 3.14 reports correct events according to the sources:
> > http://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto-3.10/tree/driver
> > s/input/touchscreen/max11801_ts.c#n139
> > http://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto-3.14/tree/driver
> > s/input/touchscreen/max11801_ts.c#n138
> >
> > Now, the weird part is that your evtest output shows ABS_PRESSURE events while nothing in the code suggests that the driver will report those events.
> >
> > So either you are using a different max11801_ts driver (which seems unlikely), or maybe something in userspace corrupts the event node (with some udev rules), or evtest is just lost as it's not maintained anymore.
> >
> > Please try recording the event node through evemu-record[1] which is known to work better.
> >
> >>
> >> I tried other touch tools and find some of this tools are working.
> >> The most interesting part is: ts_calibrate, this tool works but xinput_calibrator do not work.
> >
> > xinput_calibrator works at the X level, while ts_calibrate might not.
> > If X is not happy because it doesn't see the BTN_TOUCH events, xinput_calibrator will not be happy either.
> >
> >> All of this programs uses the same /dev/input/event0 device.
> >> I am curious about why ts_calibrate works (sees tap / click events) but other programs like xinput_calibrator do not work?
> >
> >
> > Cheers,
> > Benjamin
> >
> > [1] https://www.freedesktop.org/wiki/Evemu/
> >
> >>
> >>
> >> With best regards
> >>
> >> Walter
> >>
> >>
> >> -----Ursprüngliche Nachricht-----
> >> Von: Benjamin Tissoires [mailto:benjamin.tissoires at gmail.com]
> >> Gesendet: Dienstag, 31. Mai 2016 17:06
> >> An: Walter Hofstädtler
> >> Cc: input-tools at lists.freedesktop.org
> >> Betreff: Re: Touchscreen on embedded Linux can't tap / click
> >>
> >> On Sat, May 28, 2016 at 3:05 PM, Walter Hofstädtler <walter at hofstaedtler.com> wrote:
> >>> Benjamin,
> >>>
> >>>
> >>> thank you for your answer.
> >>>
> >>> The issue about updating is, the board support package supports 
> >>> Yocto
> >>> 1.7 with kernel 3.10.17 and some tests are done with Yocto 1.8 with 
> >>> kernel 3.14.38.
> >>>
> >>> Kernel 3.14.38 is also quite old. Do you believe that kernel 3.14.38 
> >>> fixes this issue?
> >>>
> >>
> >> Well, I know nothing about your touchscreen so I can't give you more information. At least please provide a dmesg or the name of the actual module used so we can check whether it has been updated between 3.10 and 3.14.
> >> Worse case, you are not using an upstream driver, and you will have to request the Yocto community to fix it.
> >>
> >> Cheers,
> >> Benjamin
> >>
> >>>
> >>> Walter
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> -----Ursprüngliche Nachricht-----
> >>> Von: Benjamin Tissoires <benjamin.tissoires at gmail.com>
> >>> Gesendet: Sam 28 Mai 2016 14:09
> >>> An: Walter Hofstädtler <walter at hofstaedtler.com>
> >>> CC: input-tools at lists.freedesktop.org
> >>> Betreff: Re: Touchscreen on embedded Linux can't tap / click
> >>>
> >>> Hi Walter,
> >>>
> >>> On Sat, May 28, 2016 at 1:13 PM, Walter Hofstädtler 
> >>> <walter at hofstaedtler.com> wrote:
> >>>> Hi,
> >>>>
> >>>>
> >>>> I use a 7" display with resistive touchscreen, embedded Linux for ARM CPU.
> >>>> Manufacturer Engicam, design is similar to Freescale / NXP i.MX6 
> >>>> Sabre board.
> >>>>
> >>>>
> >>>> With Yocto 1.7.3 and Engicam board support package I created an X11 
> >>>> application, basically a Firefox browser. Most of this application 
> >>>> work with one exception: I can't tap / click on any item. When I 
> >>>> touch the screen and move around, cursor will follow my finger, 
> >>>> unfortunately a tap / click will not work. I searched with Google 
> >>>> and find some tips but nothing solved this issue.
> >>>>
> >>>>
> >>>> 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
> >>>>
> >>>>
> >>>> Doing some debugging, I found that ts_test gets the BTN_TOUCH 
> >>>> events but evtest do *not* see any BTN_TOUCH events.
> >>>>
> >>>>
> >>>>
> >>>> # 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 ------------
> >>>>
> >>>>
> >>>> While capturing this output, I touched the screen but I did *not* 
> >>>> get BTN_TOUCH events.
> >>>
> >>> Yep, that's a driver bug. Please check which driver you are using (I 
> >>> guess not hid-multitouch given the bus is i2c and the VID/PID are 
> >>> 0/0), and check whether an updated driver fixes your problem.
> >>>
> >>>>
> >>>>
> >>>> # 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
> >>>>
> >>>>
> >>>> Fortunately ts_test gets BTN_TOUCH events, I assume last column are 
> >>>> the BTN_TOUCH events.
> >>>
> >>> Well, no, the last column would suggest that the client interprets 
> >>> the finger as touch through the pressure information, not that it 
> >>> gets actual BTN_TOUCH event. I believe ts_test is less strict 
> >>> regarding BTN_TOUCH and consider pressure > 0 meanining touch.
> >>>
> >>>>
> >>>>
> >>>> Worth to mention, ts_calibrate works (I am able to tap / click) but 
> >>>> xinput_calibrator do not work, cursor follows pen but do not accept 
> >>>> tap / click.
> >>>>
> >>>>
> >>>> As evtest do not see the BTN_TOUCH events I assume X11 will also 
> >>>> not see BTN_TOUCH events so I can't tap / click in X11.
> >>>>
> >>>>
> >>>> Question why evtest do not see the BTN_TOUCH events? Is this an 
> >>>> configuration issue or a bug?
> >>>
> >>> Definitively kernel bug. 3.10 is quite old now, so it would be 
> >>> interesting to upgrade the kernel first if possible, and also check 
> >>> if the kernel driver has been updated since.
> >>>
> >>> Cheers,
> >>> Benjamin
> >>>
> >>>>
> >>>>
> >>>> Any help would be greatly appreciated.
> >>>>
> >>>>
> >>>> With best regards
> >>>>
> >>>> Walter
> >>>>
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> Input-tools mailing list
> >>>> Input-tools at lists.freedesktop.org
> >>>> https://lists.freedesktop.org/mailman/listinfo/input-tools
> >
> 
> _______________________________________________
> Input-tools mailing list
> Input-tools at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/input-tools
> 


More information about the Input-tools mailing list