evdev always returns fixed XY values

Peter Korsgaard peter at korsgaard.com
Mon May 25 04:22:59 PDT 2015


>>>>> "Marco" == Marco Cavallini <info at koansoftware.com> writes:

Hi,

>> Driver claims to return X/Y in 0..4095 range.
 >> 
 >> > Event: time 1432134719.652423, type 3 (EV_ABS), code 0 (ABS_X), value 7823
 >> > Event: time 1432134719.652423, type 3 (EV_ABS), code 1 (ABS_Y), value 7987
 >> 
 >> But then returns values that are outside this range, confusing user space.
 >> 
 >> Garbage in is garbage out.
 >> 

 > So why ts_print is working?

Presumably because it just prints the kernel events without validating
that they are really in the min..max range.

> Couldn't this be related to xinput only?

No, the reason is your kernel driver. Some user space sw may be able to
more or less work with a kernel driver that provides out of range
events, but xinput clips them to the valid range.

Once again, the fix is to correct the kernel driver.

>From input/drivers/touchscreen/abs7846.c I see:

static int ads7846_probe(struct spi_device *spi)
{
...
        input_set_abs_params(input_dev, ABS_X,
                        pdata->x_min ? : 0,
                        pdata->x_max ? : MAX_12BIT,
                        0, 0);
        input_set_abs_params(input_dev, ABS_Y,
                        pdata->y_min ? : 0,
                        pdata->y_max ? : MAX_12BIT,
                        0, 0);

So presumably you just need to pass the correct x_max/y_max in your
platform data.

-- 
Venlig hilsen,
Peter Korsgaard 


More information about the xorg mailing list