]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From: Dan Streetman <ddstreet@ieee.org> |
2 | Subject: Input: usbtouchscreen - allow reporting calibrated data | |
3 | Patch-mainline: queued in input tree, will be in 2.6.29 | |
4 | References: bnc#444814 | |
5 | ||
6 | Input: usbtouchscreen - allow reporting calibrated data | |
7 | ||
8 | This patch adds a module parameter to report either the raw | |
9 | coordinate data or the hardware-calibrated coordinate data for | |
10 | MicroTouch/3M touchscreens. The default is set to the raw | |
11 | coordinates for backwards compatibilty. | |
12 | ||
13 | Signed-off-by: Dan Streetman <ddstreet@ieee.org> | |
14 | Signed-off-by: Dmitry Torokhov <dtor@mail.ru> | |
15 | Signed-off-by: Jiri Kosina <jkosina@suse.cz> | |
16 | --- | |
17 | ||
18 | diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c | |
19 | index 5080b26..6d27a1d 100644 | |
20 | --- a/drivers/input/touchscreen/usbtouchscreen.c | |
21 | +++ b/drivers/input/touchscreen/usbtouchscreen.c | |
22 | @@ -60,6 +60,10 @@ static int swap_xy; | |
23 | module_param(swap_xy, bool, 0644); | |
24 | MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped."); | |
25 | ||
26 | +static int hwcalib_xy; | |
27 | +module_param(hwcalib_xy, bool, 0644); | |
28 | +MODULE_PARM_DESC(hwcalib_xy, "If set hw-calibrated X/Y are used if available"); | |
29 | + | |
30 | /* device specifc data/functions */ | |
31 | struct usbtouch_usb; | |
32 | struct usbtouch_device_info { | |
33 | @@ -260,8 +264,13 @@ static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |
34 | ||
35 | static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |
36 | { | |
37 | - dev->x = (pkt[8] << 8) | pkt[7]; | |
38 | - dev->y = (pkt[10] << 8) | pkt[9]; | |
39 | + if (hwcalib_xy) { | |
40 | + dev->x = (pkt[4] << 8) | pkt[3]; | |
41 | + dev->y = 0xffff - ((pkt[6] << 8) | pkt[5]); | |
42 | + } else { | |
43 | + dev->x = (pkt[8] << 8) | pkt[7]; | |
44 | + dev->y = (pkt[10] << 8) | pkt[9]; | |
45 | + } | |
46 | dev->touch = (pkt[2] & 0x40) ? 1 : 0; | |
47 | ||
48 | return 1; | |
49 | @@ -294,6 +303,12 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) | |
50 | return ret; | |
51 | } | |
52 | ||
53 | + /* Default min/max xy are the raw values, override if using hw-calib */ | |
54 | + if (hwcalib_xy) { | |
55 | + input_set_abs_params(usbtouch->input, ABS_X, 0, 0xffff, 0, 0); | |
56 | + input_set_abs_params(usbtouch->input, ABS_Y, 0, 0xffff, 0, 0); | |
57 | + } | |
58 | + | |
59 | return 0; | |
60 | } | |
61 | #endif |