diff options
Diffstat (limited to 'drivers/input/touchscreen/usbtouchscreen.c')
-rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 5080b26ba160..fb7cb9bdfbd5 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -60,6 +60,10 @@ static int swap_xy; | |||
60 | module_param(swap_xy, bool, 0644); | 60 | module_param(swap_xy, bool, 0644); |
61 | MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped."); | 61 | MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped."); |
62 | 62 | ||
63 | static int hwcalib_xy; | ||
64 | module_param(hwcalib_xy, bool, 0644); | ||
65 | MODULE_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 */ |
64 | struct usbtouch_usb; | 68 | struct usbtouch_usb; |
65 | struct usbtouch_device_info { | 69 | struct usbtouch_device_info { |
@@ -118,6 +122,7 @@ enum { | |||
118 | 122 | ||
119 | #define USB_DEVICE_HID_CLASS(vend, prod) \ | 123 | #define USB_DEVICE_HID_CLASS(vend, prod) \ |
120 | .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \ | 124 | .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \ |
125 | | USB_DEVICE_ID_MATCH_INT_PROTOCOL \ | ||
121 | | USB_DEVICE_ID_MATCH_DEVICE, \ | 126 | | USB_DEVICE_ID_MATCH_DEVICE, \ |
122 | .idVendor = (vend), \ | 127 | .idVendor = (vend), \ |
123 | .idProduct = (prod), \ | 128 | .idProduct = (prod), \ |
@@ -260,8 +265,13 @@ static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |||
260 | 265 | ||
261 | static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | 266 | static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt) |
262 | { | 267 | { |
263 | dev->x = (pkt[8] << 8) | pkt[7]; | 268 | if (hwcalib_xy) { |
264 | dev->y = (pkt[10] << 8) | pkt[9]; | 269 | dev->x = (pkt[4] << 8) | pkt[3]; |
270 | dev->y = 0xffff - ((pkt[6] << 8) | pkt[5]); | ||
271 | } else { | ||
272 | dev->x = (pkt[8] << 8) | pkt[7]; | ||
273 | dev->y = (pkt[10] << 8) | pkt[9]; | ||
274 | } | ||
265 | dev->touch = (pkt[2] & 0x40) ? 1 : 0; | 275 | dev->touch = (pkt[2] & 0x40) ? 1 : 0; |
266 | 276 | ||
267 | return 1; | 277 | return 1; |
@@ -294,6 +304,12 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) | |||
294 | return ret; | 304 | return ret; |
295 | } | 305 | } |
296 | 306 | ||
307 | /* Default min/max xy are the raw values, override if using hw-calib */ | ||
308 | if (hwcalib_xy) { | ||
309 | input_set_abs_params(usbtouch->input, ABS_X, 0, 0xffff, 0, 0); | ||
310 | input_set_abs_params(usbtouch->input, ABS_Y, 0, 0xffff, 0, 0); | ||
311 | } | ||
312 | |||
297 | return 0; | 313 | return 0; |
298 | } | 314 | } |
299 | #endif | 315 | #endif |