[PATCH] evdev: handle touchscreens without BTN_TOUCH

Peter Hutterer peter.hutterer at who-t.net
Mon May 23 22:11:30 PDT 2011


On Mon, May 23, 2011 at 12:16:01PM +0200, Peter Korsgaard wrote:
> Some touchscreens (like the Lumio crystaltouch in single touch mode) send
> BTN_LEFT rather than BTN_TOUCH:
> 
> Input driver version is 1.0.1
> Input device ID: bus 0x3 vendor 0x202e product 0x5 version 0x111
> Input device name: "LUMIO Inc LUMIO CrystalTouch ver 1.1C"
> Supported events:
>   Event type 0 (Sync)
>   Event type 1 (Key)
>     Event code 272 (LeftBtn)
>     Event code 273 (RightBtn)
>     Event code 274 (MiddleBtn)
>   Event type 2 (Relative)
>     Event code 9 (Misc)
>   Event type 3 (Absolute)
>     Event code 0 (X)
>       Value    650
>       Min        0
>       Max     4095
>     Event code 1 (Y)
>       Value   3221
>       Min        0
>       Max     4095
>   Event type 4 (Misc)
>     Event code 4 (ScanCode)
> Testing ... (interrupt to exit)
> Event: time 1305882024.934011, type 4 (Misc), code 4 (ScanCode), value 90001
> Event: time 1305882024.934017, type 1 (Key), code 272 (LeftBtn), value 1
> Event: time 1305882024.934029, type 3 (Absolute), code 0 (X), value 270
> Event: time 1305882024.934034, type 3 (Absolute), code 1 (Y), value 1513
> Event: time 1305882024.934039, type 2 (Relative), code 9 (Misc), value 1
> 
> This causes evdev to handle these device as a mouse rather than a
> touchscreen, which naturally doesn't work very well. We already internally
> translate BTN_TOUCH as BTN_LEFT, so accept this kind of devices as
> touchscreens by checking for devices with absolute X/Y and NO relative X/Y
> axes.
> 
> Signed-off-by: Peter Korsgaard <jacmet at sunsite.dk>
> ---
>  src/evdev.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/evdev.c b/src/evdev.c
> index b1a822b..4f9307f 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -1683,8 +1683,10 @@ EvdevProbe(InputInfoPtr pInfo)
>                      pEvdev->flags |= EVDEV_BUTTON_EVENTS;
>                  }
>              } else if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask) ||
> -                TestBit(BTN_TOUCH, pEvdev->key_bitmask)) {
> -                if (has_lmr || TestBit(BTN_TOOL_FINGER, pEvdev->key_bitmask)) {
> +                TestBit(BTN_TOUCH, pEvdev->key_bitmask) ||
> +                !(TestBit(REL_X, pEvdev->rel_bitmask) &&
> +                  TestBit(REL_Y, pEvdev->rel_bitmask))) {
> +                if (TestBit(BTN_TOOL_FINGER, pEvdev->key_bitmask)) {

did you drop the has_lmr intentionally?

these checks are getting mighty confusing, I wonder if we could simplify
this in some other way. Also, I really wonder if we still need all this
since xserver 
commit 9f462ff9082634719e64d2d8d4dbd09ec7deaf2e 
Refs: xorg-server-1.7.99.901-43-g9f462ff

This should allow us to have both relative and absolute axes on a device
and as long as we keep the mode correct, we can exceed the valuator range (I
think). Either way, one of the things I'd like to have in ABI 14/server 1.12
are the proper driver hooks to change devices on-the-fly.

Cheers,
  Peter



>                      xf86IDrvMsg(pInfo, X_PROBED, "Found absolute touchpad.\n");
>                      pEvdev->flags |= EVDEV_TOUCHPAD;
>                  } else {
> -- 
> 1.7.5.1
> 


More information about the xorg-devel mailing list