Raw mouse input is distorted
hauberg at gmail.com
Thu Sep 18 02:35:19 PDT 2008
2008/9/18 Peter Hutterer <peter.hutterer at who-t.net>:
> On Wed, Sep 17, 2008 at 06:46:17AM -0700, Hauberg wrote:
>> Now, my problem is that X seems to somehow accelerate the output from the
>> 'usbtouchscreen' module, so that when I move my finger to the left, the
>> cursor moves about twice as far to the left as my finger did. This does not
>> correspond to the output from the 'usbtouchscreen' module. So, I'm a bit
>> confused here: does X place the cursor at the position outputted by the
>> kernel, or does it do some fancy things?
> after a quick 30s peek into the evtouch driver:
> it always inits x/y with a range of [0-1024]. you'd need to change this (in
> EVTouchPreInit) to reflect the real range of the coordinates you post from the
> driver module.
I don't see this in the evtouch driver, but since I don't know much
about X, this just might be my ignorance showing :-)
In general, I really want to avoid using the evtouch driver as it is
unmaintained. The only development on this driver appears to be done
by the Debian people. So the actual place to get the evtouch source
code is not the evtouch website, but actually the Debian package. This
difference could also explain why I don't see the 1024 stuff in
But I don't think I've been clear enough in my description of our
system. One way to get a functional setup is to use the
'usbtouchscreen' kernel module and the evtouch X11 driver. This works
fine for everyday use, but it is hard to perform calibration.
Another way to get a potentially working setup (this is what I'm
working on) is to alter the 'usbtouchscreen' kernel module such that
it can read the calibration data, and actually provide actual screen
coordinates. I have this working, such that I can give the kernel my
calibration parameters, and it will emit mouse events that corresponds
to actual screen coordinates. If I use the 'evdev' X11 driver to
handle these mouse events the cursor moves faster (I think that's the
best word I've got) than the output from the kernel. Instead of using
the 'evdev' X11 driver I can use the evtouch driver, and tell it not
to use the calibration data, and that works. But then I haven't gotten
rid of the evtouch driver, which is my main motivation.
> all events are posted as absolute from the evtouch driver
> (xf86PostMotionEvent, xf86PostButtonEvent), which means they will get scaled
> by the server into the screen space, i.e. if the screen has a resolution is
> 2048, this means that the device coordinate 512 will map to the screen
> coordinate 1024.
> This could be the reason for your scaling issue. Setting up the axes with the
> right values should fix that. alternatively, you could make sure the kernel
> driver pre-scales to a range of 0-1024.
I've tried to make the kernel send events with x in [0, 1023] and y in
[0, 1023], but that still behaves quite poorly. I'm sorry that I can't
give a better explanation, but I know sooo little about X that I
simply don't have the terminology.
More information about the xorg