login
Header Space

 
 

Input device driver

August 1, 2008 - 5:27am
Submitted by Anonymous on August 1, 2008 - 5:27am.
Linux

Hi, i try to make generaltouch touchscreen working. usbtouchscreen driver handles it well, but there is some strange problem with coordinates. Just for a simple test i modified it so it executes this code:

========================================
.....

static int usbtouch_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
.....
input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
input_set_abs_params(input_dev, ABS_X, 0, 100, 0, 0); // <- modified
input_set_abs_params(input_dev, ABS_Y, 0, 100, 0, 0); // <- modified
if (type->max_press)
input_set_abs_params(input_dev, ABS_PRESSURE, type->min_press,
type->max_press, 0, 0);
.....
}

.....

static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch,
unsigned char *pkt, int len)
{
// first event is skipped
input_report_abs(usbtouch->input, ABS_X, 10);
input_report_abs(usbtouch->input, ABS_Y, 10);

input_sync(usbtouch->input);

input_report_abs(usbtouch->input, ABS_X, 50);
input_report_abs(usbtouch->input, ABS_Y, 50);

input_sync(usbtouch->input);
}

.....
========================================

so i expect cursor will be set to (50%,50%) of the screen, but it's not. it seems like it's position depends also on mouse driver or some other module. Could you tell me how to set it exactly to (50%,50%) so it wouldn't depend on anything.

Thank you.

device coordinates

August 2, 2008 - 4:41am

maybe input_set_abs_params() just defines the coordinates for the input device itself, and further layers (event generation, X server) interpret the input device positions in their own way? if you say 'the input device is using absolute coordinates' and 'lower left corner of the input device' the actual mouse moving code could still interpret that as a joystick/trackpoint (i.e. the mouse moves full speed into that direction) or translate relative movement into relative screen movement or convert it into an absolute screen coordinate, and even then it has to know the 'meant' absolute size to know the scale factor between device coordinates and screen coordinates. my guess is that the actual input code worked right the whole time but the device coordinate description was wrong... that would also explain why your first event is skipped, maybe you just set the reference point for relative movement, and the next event moves by (50-10, 50-10)?

Problem is solved, thank you

August 7, 2008 - 8:40am
Anonymous (not verified)

Problem is solved, thank you for response

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
speck-geostationary