[PATCH] evdev: handle touchscreens without BTN_TOUCH

Peter Hutterer peter.hutterer at who-t.net
Mon May 23 23:01:45 PDT 2011


On Tue, May 24, 2011 at 07:31:53AM +0200, Peter Korsgaard wrote:
> >>>>> "Peter" == Peter Hutterer <peter.hutterer at who-t.net> writes:
> 
> Hi,
> 
>  >> +++ 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)) {
> 
>  Peter> did you drop the has_lmr intentionally?
> 
> Yes, as the touchscreen sends BTN_LEFT instead of BTN_TOUCH, has_lmr
> will be true, so we cannot use it in the check.
> 
> With this change, the only thing differentiating between touchpads and
> touchscreens is the presence of BTN_TOOL_FINGER.

Right, but if I read this correctly, you've removed a condition and now
any device with absolute axes would get labeled as touchscreen, including
keyboards with absolute axes.

before the test was
    if (pressure || touch)
    {
        if (lmr || finger) touchpad
        else touchscreen
    }

whereas now you have 
    if (pressure || touch || !(x/y relative))
    {
        if (finger) touchpad
        else touchscreen
    }

so, any device that doesn't have relative x/y axes will fall into this
branch. there are a few keyboards out there with axes (volume control,
zoom), we probably shouldn't label them as touchscreens.

Cheers,
  Peter

>  Peter> these checks are getting mighty confusing, I wonder if we could
>  Peter> simplify this in some other way. Also, I really wonder if we
>  Peter> still need all this since xserver
> 
>  Peter> commit 9f462ff9082634719e64d2d8d4dbd09ec7deaf2e 
>  Peter> Refs: xorg-server-1.7.99.901-43-g9f462ff
> 
>  Peter> This should allow us to have both relative and absolute axes on
>  Peter> a device and as long as we keep the mode correct, we can exceed
>  Peter> the valuator range (I think).
> 
> Maybe, but that's a bit too big a change than I feel comfortable with.


>  Peter> Either way, one of the things I'd like to have in ABI 14/server
>  Peter> 1.12 are the proper driver hooks to change devices on-the-fly.
> 
> That sounds good.
> 
> -- 
> Bye, Peter Korsgaard


More information about the xorg-devel mailing list