evdev touchscreen calibration problems

2010-02-01 Thread Abelenda
Hi,

I have a little problem calibrating my touchscreen using xinput.

I can invert the Y axis no problem, suppress acceleration, but there is
no way to get calibration right it seems that the numbers I put do not
influence the pointer.

for example I execute :
xinput set-int-prop 6 238 32 500 600 200 300
or
xinput set-int-prop 6 238 32 20 100 30 50

but the cursor is bound in the same rectangle (which is 1/3 of the
total screen size)

xinput list-props 6
shows 

Device 'S3C TouchScreen':
Device Enabled (112):   1
Device Accel Profile (231): -1
Device Accel Constant Deceleration (232):   1.00
Device Accel Adaptive Deceleration (234):   1.00
Device Accel Velocity Scaling (235):10.00
Evdev Reopen Attempts (236):10
Evdev Axis Inversion (237): 0, 1
Evdev Axis Calibration (238):   20, 100, 30, 50
Evdev Axes Swap (239):  0
Axis Labels (240):  Abs X, Abs Y, Abs Pressure


Versions:
xf86-input-evdev-2.3.0
xinput-1.5.0 (tested with 1.4.2 didn't change anything)
inputproto-2.0
xorg-server-1.7.4
kernel-2.6.24.7 (heavily patched... but this is the only thing I can't
do anything about)

my log is attached (it doesn't contain anything special though).

Anyone has a pointer if I do something wrong, if evdev can't be used
like this or anything else ?

Because I don't really want to change to tslib+kdrive (as you can't
calibrate tslib from within xorg).

X.Org X Server 1.7.4
Release Date: 2010-01-08
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.24.7 armv6l 
Current Operating System: Linux Mai 2.6.24.7-by-Aelia #1 PREEMPT Sun Jan 31 22:27:44 CET 2010 armv6l
Kernel command line: loglevel=6 rootwait s3cfb.backlight=80 root=/dev/mmcblk1p2 
Build Date: 31 January 2010  08:50:19AM
 
Current version of pixman: 0.17.2
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: /var/log/Xorg.0.log, Time: Mon Feb  1 09:20:30 2010
(==) Using config file: /etc/X11/xorg.conf
(==) No Layout section.  Using the first Screen section.
(==) No screen section available. Using defaults.
(**) |--Screen Default Screen Section (0)
(**) |   |--Monitor default monitor
(==) No monitor specified for screen Default Screen Section.
	Using a default monitor configuration.
(==) Automatically adding devices
(==) Automatically enabling devices
(WW) The directory /usr/share/fonts/misc/ does not exist.
	Entry deleted from font path.
(WW) The directory /usr/share/fonts/TTF/ does not exist.
	Entry deleted from font path.
(WW) The directory /usr/share/fonts/OTF does not exist.
	Entry deleted from font path.
(WW) The directory /usr/share/fonts/Type1/ does not exist.
	Entry deleted from font path.
(WW) The directory /usr/share/fonts/100dpi/ does not exist.
	Entry deleted from font path.
(WW) The directory /usr/share/fonts/75dpi/ does not exist.
	Entry deleted from font path.
(==) FontPath set to:
	
(==) ModulePath set to /usr/lib/xorg/modules
(II) Cannot locate a core pointer device.
(II) Cannot locate a core keyboard device.
(II) The server relies on HAL to provide the list of input devices.
	If no devices become available, reconfigure HAL or disable AutoAddDevices.
(II) Loader magic: 0x1820c4
(II) Module ABI versions:
	X.Org ANSI C Emulation: 0.4
	X.Org Video Driver: 6.0
	X.Org XInput driver : 7.0
	X.Org Server Extension : 2.0
(--) using VT number 3

(II) Open APM successful
(II) LoadModule: extmod
(II) Loading /usr/lib/xorg/modules/extensions/libextmod.so
(II) Module extmod: vendor=X.Org Foundation
	compiled for 1.7.4, module version = 1.0.0
	Module class: X.Org Server Extension
	ABI class: X.Org Server Extension, version 2.0
(II) Loading extension MIT-SCREEN-SAVER
(II) Loading extension XFree86-VidModeExtension
(II) Loading extension XFree86-DGA
(II) Loading extension DPMS
(II) Loading extension XVideo
(II) Loading extension XVideo-MotionCompensation
(II) Loading extension X-Resource
(II) LoadModule: dbe
(II) Loading /usr/lib/xorg/modules/extensions/libdbe.so
(II) Module dbe: vendor=X.Org Foundation
	compiled for 1.7.4, module version = 1.0.0
	Module class: X.Org Server Extension
	ABI class: X.Org Server Extension, version 2.0
(II) Loading extension DOUBLE-BUFFER
(II) LoadModule: glx
(II) Loading /usr/lib/xorg/modules/extensions/libglx.so
(II) Module glx: vendor=X.Org Foundation
	compiled for 1.7.4, module version = 1.0.0
	ABI class: X.Org Server Extension, version 2.0
(==) AIGLX enabled
(II) Loading extension GLX
(II) LoadModule: record
(II) Loading /usr/lib/xorg/modules/extensions/librecord.so
(II) Module record: vendor=X.Org Foundation
	compiled for 1.7.4, module version = 1.13.0
	Module class: X.Org Server Extension
	ABI class: X.Org Server Extension, version 2.0
(II) Loading 

Re: evdev touchscreen calibration problems

2010-02-01 Thread Marco Cavallini
Abelenda ha scritto, Il 01/02/2010 17:18:
 Hi,
 
 I have a little problem calibrating my touchscreen using xinput.
 
 I can invert the Y axis no problem, suppress acceleration, but there is
 no way to get calibration right it seems that the numbers I put do not
 influence the pointer.
 
 for example I execute :
 xinput set-int-prop 6 238 32 500 600 200 300
 or
 xinput set-int-prop 6 238 32 20 100 30 50
 

I am facing exactly to the same problem here with my ARM based board.


Cordiali Saluti / Kindest Regards / mit freundlichen Grüssen
--
Marco Cavallini | KOAN sas | Bergamo - Italia
 embedded and real-time software engineering
   Atmel third party certified consultant
Phone:+39-035-255.235 - Fax:+39-178-22.39.748
  http://www.KoanSoftware.com
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

Re: Evdev touchscreen calibration?

2009-07-23 Thread Søren Hauberg
2009/7/22 Florian Echtler f...@butterbrot.org:
 I've recently written an input event driver for a touchscreen, and it's
 working out-of-the box with the evdev driver. However, the scaling is a
 bit off, so I'd like to do a four-point calibration and set the Evdev
 Axis Calibration property accordingly. Is there a tool which does that?
 I've only found ts_calibrate so far, which is just for framebuffer
 devices.

I wrote some code a while back that should compute the calibration
parameters, and it's just running inside X (I'm attaching the code).
It doesn't actually set the parameters as that wasn't supported at the
time, but you should be able to do this in run-time these days.

Søren
/*
 * Copyright © 2008 Soren Hauberg
 *
 * Permission to use, copy, modify, distribute, and sell this software
 * and its documentation for any purpose is hereby granted without
 * fee, provided that the above copyright notice appear in all copies
 * and that both that copyright notice and this permission notice
 * appear in supporting documentation, and that the name of Red Hat
 * not be used in advertising or publicity pertaining to distribution
 * of the software without specific, written prior permission.  Red
 * Hat makes no representations about the suitability of this software
 * for any purpose.  It is provided as is without express or implied
 * warranty.
 *
 * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
 * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 * Authors:
 *	Soren Hauberg (haub...@gmail.com)
 */

/*
 * This program performs calibration of a touchscreen that uses the 'usbtouchscreen'
 * Linux kernel module. A calibration consists of finding the following parameters:
 *
 *   'flip_x'
 *  a boolean parameter that determines if the x-coordinate should be flipped.
 * 
 *   'flip_y'
 *  same as 'flip_x' except for the y-coordinate.
 *
 *   'swap_xy'
 *  a boolean parameter that determines if the x and y-coordinates should
 *  be swapped.
 *
 *   'min_x', 'max_x', 'min_y', and 'max_y'
 *  the minimum and maximum x and y values that the screen can report. In principle
 *  we could get these parameters by letting the user press the corners of the
 *  screen. In practice this doesn't work, because the screen doesn't always have
 *  sensors at the corners. So, what we do is we ask the user to press points that
 *  have been pushed a bit closer to the center, and then we extrapolate the
 *  parameters.
 */

#include cstring

#include gtkmm/main.h
#include gtkmm/window.h
#include gtkmm/drawingarea.h
#include cairomm/context.h

/* Number of points the user should click */
const int num_points = 4;

/* Number of blocks. We partition we screen into 'num_blocks' x 'num_blocks'
 * rectangles of equal size. We then ask the user to press points that are
 * located at the corner closes to the center of the four blocks in the corners
 * of the screen. The following ascii art illustrates the situation. We partition
 * the screen into 8 blocks in each direction. We then let the user press the
 * points marked with 'O'.
 * 
 *   +--+--+--+--+--+--+--+--+
 *   |  |  |  |  |  |  |  |  |
 *   +--O--+--+--+--+--+--O--+
 *   |  |  |  |  |  |  |  |  |
 *   +--+--+--+--+--+--+--+--+
 *   |  |  |  |  |  |  |  |  |
 *   +--+--+--+--+--+--+--+--+
 *   |  |  |  |  |  |  |  |  |
 *   +--+--+--+--+--+--+--+--+
 *   |  |  |  |  |  |  |  |  |
 *   +--+--+--+--+--+--+--+--+
 *   |  |  |  |  |  |  |  |  |
 *   +--+--+--+--+--+--+--+--+
 *   |  |  |  |  |  |  |  |  |
 *   +--O--+--+--+--+--+--O--+
 *   |  |  |  |  |  |  |  |  |
 *   +--+--+--+--+--+--+--+--+
 */
const int num_blocks = 8;

/* Names of the points */
enum {
  UL = 0, /* Upper-left */
  UR = 1, /* Upper-right */
  LL = 2, /* Lower-left */
  LR = 3  /* Lower-right */
};

/* Output ranges. The final output will be scaled to [0, range_x] x [0, range_y] */
const int range_x = 1023;
const int range_y = 1023;

/* The file to which the calibration parameters are saved. (XXX: is this distribution dependend?) */
const char *modprobe_conf_local = /etc/modprobe.conf.local;

/* Prefix to the kernel path where we can set the parameters */
const char *module_prefix = /sys/module/usbtouchscreen/parameters;

/* Names of kernel parameters */
const char *p_range_x = range_x;
const char *p_range_y = range_y;
const char *p_min_x = min_x;
const char *p_min_y = min_y;
const char *p_max_x = max_x;
const char *p_max_y = max_y;
const char *p_transform_xy = transform_xy;
const char *p_flip_x = flip_x;
const char *p_flip_y = flip_y;
const char *p_swap_xy = swap_xy;

/* Threshold to keep the same point from 

Re: Evdev touchscreen calibration?

2009-07-23 Thread Simon Thum
Peter Hutterer wrote:
 XI 1 gives you access to the valuators as well, so this should work in
 principle if you register for DeviceButtonPress and friends.
Ok, big sorry if I'm wrong, but to clarify: untranslated valuators are
stored in valuators.data_raw, which is picked up solely by
eventToRawEvent(), again used solely for Xi2 processing. So by inference
Xi2 is the only option if you want raw coordinates (which are what evdev
calibration needs). What am I missing?

Cheers,

Simon

Disclaimer: I don't have an absolute device to test, nor do I fully
grasp what's going on around GetPointerEvents(). But maybe it's worth
looking at it again.
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Evdev touchscreen calibration?

2009-07-22 Thread Florian Echtler
Hello everyone,

I've recently written an input event driver for a touchscreen, and it's
working out-of-the box with the evdev driver. However, the scaling is a
bit off, so I'd like to do a four-point calibration and set the Evdev
Axis Calibration property accordingly. Is there a tool which does that?
I've only found ts_calibrate so far, which is just for framebuffer
devices.

Yours, Florian
-- 
0666 - Filemode of the Beast

___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: Evdev touchscreen calibration?

2009-07-22 Thread Dan Nicholson
On Wed, Jul 22, 2009 at 6:24 AM, Florian Echtlerf...@butterbrot.org wrote:
 Hello everyone,

 I've recently written an input event driver for a touchscreen, and it's
 working out-of-the box with the evdev driver. However, the scaling is a
 bit off, so I'd like to do a four-point calibration and set the Evdev
 Axis Calibration property accordingly. Is there a tool which does that?
 I've only found ts_calibrate so far, which is just for framebuffer
 devices.

You can set any input properties with a recent xinput tool.

--
Dan
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: Evdev touchscreen calibration?

2009-07-22 Thread Simon Thum
Florian Echtler wrote:
 Hello everyone,
 
 I've recently written an input event driver for a touchscreen, and it's
 working out-of-the box with the evdev driver. However, the scaling is a
 bit off, so I'd like to do a four-point calibration and set the Evdev
 Axis Calibration property accordingly. Is there a tool which does that?
 I've only found ts_calibrate so far, which is just for framebuffer
 devices.
I don't think it could be written without XI2, since AFAIK you've got no
access to raw coordinates. One might exploit special assumptions/setups,
though.
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: Evdev touchscreen calibration?

2009-07-22 Thread Peter Hutterer
On Wed, Jul 22, 2009 at 06:33:41PM +0200, Simon Thum wrote:
 Florian Echtler wrote:
  Hello everyone,
  
  I've recently written an input event driver for a touchscreen, and it's
  working out-of-the box with the evdev driver. However, the scaling is a
  bit off, so I'd like to do a four-point calibration and set the Evdev
  Axis Calibration property accordingly. Is there a tool which does that?
  I've only found ts_calibrate so far, which is just for framebuffer
  devices.
 I don't think it could be written without XI2, since AFAIK you've got no
 access to raw coordinates. One might exploit special assumptions/setups,
 though.

XI 1 gives you access to the valuators as well, so this should work in
principle if you register for DeviceButtonPress and friends.

Cheers,
  Peter
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg