Does touchpads have buttons?

Søren Hauberg hauberg at gmail.com
Tue Sep 30 06:14:17 PDT 2008


2008/9/30 Peter Hutterer <peter.hutterer at who-t.net>:
> On Tue, Sep 30, 2008 at 11:53:44AM +0200, Søren Hauberg wrote:
>> Okay, so I'm attaching my latest patch. This should handle everything
>> except setting/getting calibration parameters. I'll look into this
>> after lunch today. I'd love some feedback on the patch, as I think
>> this is the best structure, but since I'm a newbie I just might be
>> mistaken.
>
>
> +    /* Touch screen parameters */
> +    struct {
> +        BOOL                flip_x;
> +        BOOL                flip_y;
> +        BOOL                swap_xy; /* Some devices send (y, x) instead of (x, y). Currently not used */
> +        int                 min_x;
> +        int                 max_x;
> +        int                 min_y;
> +        int                 max_y;
> +    } touchscreen;
>
> the last four fields are redundant, since the EvdevRec already has those.

My impression is that the ones in EvdevRec means something different.
The ones in the 'touchscreen' struct are the calibration parameters.
'min_x' is the smallest x value that the hardware actually sends, and
similar for the other fields. So, I get x values in the range

  [EvdevRec.touchscreen.min_x, EvdevRec.touchscreen.max_x]

and I need to transform these linearly into the range

  [EvdevRec.min_x, EvdevRec.max_x]

So, I don't think the fields are the same. The ones in 'touchscreen'
might need renaming, but I just used the standard terminology.

> flip_x/y should also be moved into the EvdevRec, as it allows other devices to
> benefit from it. For relative devices flip would be simply inverted. For
> absolute ones - you can do the inversion before the call to
> xf86PostMotionEvent.
> On that note - please replace "flip_x" with "invert_x" etc. Flip is
> ambiguous.

Okay, will make that change.


> regarding swap_x/y:
> do i read that right that these devices advertise x/y but then send y/x
> coordinates?
>
> So the kernel driver says that X, Y have ranges of - say - [0, 1000], [-1000,
> 0], the actual coordinates come through as -500, 500?
> If this is the case, please fix the kernel driver, I don't really like the
> current solution.

So, yes, you understand correctly. From what I understand, some
devices (including mine) does this, and there is no way for the kernel
to detect it (this is my understanding, it might not be the truth).
Currently, the 'usbtouchscreen' kernel module has a parameter
'swap_xy' that makes the swap, but from what I understand, the kernel
developers are likely to remove this in the future, since it won't
work when you have multiple touch screens attached. I doubt we'll see
it fixed in the kernel (I don't know how to do it), which is why I
wanted the parameter in this driver. I can remove it if you don't want
it, but I think it's needed.

> +
> +    if (pEvdev->flags & EVDEV_TOUCHSCREEN)
> +        EvdevInitTouchscreen(pInfo);
>
> I trust that'll disappear from the final patch.

Why? (remember, I'm an X-newbie) I need to initialize the device to
get parameters. How would you like me to do this?

Søren



More information about the xorg mailing list