]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.drivers/input-usbtouchscreen-hw-calibration.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.drivers / input-usbtouchscreen-hw-calibration.patch
CommitLineData
2cb7cef9
BS
1From: Dan Streetman <ddstreet@ieee.org>
2Subject: Input: usbtouchscreen - allow reporting calibrated data
3Patch-mainline: queued in input tree, will be in 2.6.29
4References: bnc#444814
5
6Input: usbtouchscreen - allow reporting calibrated data
7
8This patch adds a module parameter to report either the raw
9coordinate data or the hardware-calibrated coordinate data for
10MicroTouch/3M touchscreens. The default is set to the raw
11coordinates for backwards compatibilty.
12
13Signed-off-by: Dan Streetman <ddstreet@ieee.org>
14Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
15Signed-off-by: Jiri Kosina <jkosina@suse.cz>
16---
17
18diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
19index 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