aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@ieee.org>2009-01-11 02:44:22 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-01-11 02:45:51 -0500
commitc9cbf3d3b35f198fab39e98d696312dd0b97a69a (patch)
tree3cdd49931344e82678c6820c4dc822922a23e4b2 /drivers
parent9334e90d5ac5ee1fa6d8b75acb7c64a8907787d1 (diff)
Input: usbtouchscreen - allow reporting calibrated data
This patch adds a module parameter to report either the raw coordinate data or the hardware-calibrated coordinate data for MicroTouch/3M touchscreens. The default is set to the raw coordinates for backwards compatibilty. Signed-off-by: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 5080b26ba160..6d27a1d661e6 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -60,6 +60,10 @@ static int swap_xy;
60module_param(swap_xy, bool, 0644); 60module_param(swap_xy, bool, 0644);
61MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped."); 61MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
62 62
63static int hwcalib_xy;
64module_param(hwcalib_xy, bool, 0644);
65MODULE_PARM_DESC(hwcalib_xy, "If set hw-calibrated X/Y are used if available");
66
63/* device specifc data/functions */ 67/* device specifc data/functions */
64struct usbtouch_usb; 68struct usbtouch_usb;
65struct usbtouch_device_info { 69struct usbtouch_device_info {
@@ -260,8 +264,13 @@ static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
260 264
261static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt) 265static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
262{ 266{
263 dev->x = (pkt[8] << 8) | pkt[7]; 267 if (hwcalib_xy) {
264 dev->y = (pkt[10] << 8) | pkt[9]; 268 dev->x = (pkt[4] << 8) | pkt[3];
269 dev->y = 0xffff - ((pkt[6] << 8) | pkt[5]);
270 } else {
271 dev->x = (pkt[8] << 8) | pkt[7];
272 dev->y = (pkt[10] << 8) | pkt[9];
273 }
265 dev->touch = (pkt[2] & 0x40) ? 1 : 0; 274 dev->touch = (pkt[2] & 0x40) ? 1 : 0;
266 275
267 return 1; 276 return 1;
@@ -294,6 +303,12 @@ static int mtouch_init(struct usbtouch_usb *usbtouch)
294 return ret; 303 return ret;
295 } 304 }
296 305
306 /* Default min/max xy are the raw values, override if using hw-calib */
307 if (hwcalib_xy) {
308 input_set_abs_params(usbtouch->input, ABS_X, 0, 0xffff, 0, 0);
309 input_set_abs_params(usbtouch->input, ABS_Y, 0, 0xffff, 0, 0);
310 }
311
297 return 0; 312 return 0;
298} 313}
299#endif 314#endif