handling BTN_TOUCH in evdev driver

Søren Hauberg hauberg at gmail.com
Tue Sep 23 00:18:02 PDT 2008

2008/9/22 Adam Jackson <ajax at nwnk.net>:
> On Mon, 2008-09-22 at 08:56 +0200, Søren Hauberg wrote:
>> Hi,
>>   I've making some changes tu the usbtouchscreen module to handle
>> calibration stuff (see another thread on this list). This module
>> currently emits BTN_TOUCH whenever the user touches the screen (I
>> haven't changed this). When I'm using the evdev X driver to handle the
>> touch screen I can move the cursor just fine, but I can't click any
>> buttons in GUI's such as KDE or GNOME. If I instead use the evtouch
>> X11 driver this works fine. So, it seems the evtouch and the evdev
>> drivers handle BTN_TOUCH differently. Is there a reason why the evdev
>> driver handles BTN_TOUCH as it does, or is it simply because nobody
>> has tested it with a touchscreen? If the current behavior is on
>> purpose, then I don't think my approach with changing the kernel
>> driver and relying on evdev in X will work.
> How does evtouch distinguish between "I want to move the cursor here"
> and "I want to click here"?

Since I'm quite new to X, I find the evtouch code [1] quite hard to
read, so I cannot tell for sure. It does treat it differently than
BTN_LEFT, though. If I move my stylus around on the KDE desktop (with
'evtouch') it only moves the cursor -- it does not try to select the
icons on the desktop, like it would if I was moving a mouse around
with the left button down. I'm not sure this is a particular good
behavior, though...

> Other than that, there's no particularly deep reason to not treat
> BTN_TOUCH as a click in evdev.  I did test evdev with a touchscreen, but
> apparently the one I had would give you distinct events for BTN_LEFT
> versus BTN_TOUCH.

I guess that also depends on the kernel. The 'usbtouchscreen'  kernel
module only sends BTN_TOUCH, but I don't know about other modules in
the kernel. Anyway, I have two goals, 1) get a short term solution,
that'll work right now, and 2) get a long term solution that'll reduce
the amount of patches we have to maintain in the company. As the short
term solution, I've changed 'usbtouchscreen' to send BTN_LEFT instead
of BTN_TOUCH, and this works perfectly fine for me. So, for me,
changing 'evdev' to treat BTN_TOUCH like BTN_LEFT would be wonderful.
I don't know about other touchscreens, though...


[1] http://git.debian.org/?p=pkg-xorg/driver/xserver-xorg-input-evtouch.git;a=blob;f=evtouch.c;h=c004846d2086224bca382a549483c949fb3c99e3;hb=HEAD

More information about the xorg mailing list