diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/input/tablet | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r-- | drivers/input/tablet/aiptek.c | 2 | ||||
-rw-r--r-- | drivers/input/tablet/gtco.c | 2 | ||||
-rw-r--r-- | drivers/input/tablet/wacom.h | 16 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_sys.c | 277 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_wac.c | 642 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_wac.h | 39 |
6 files changed, 643 insertions, 335 deletions
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index 7d005a3616d7..4be039d7dcad 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c | |||
@@ -362,7 +362,7 @@ static const int macroKeyEvents[] = { | |||
362 | }; | 362 | }; |
363 | 363 | ||
364 | /*********************************************************************** | 364 | /*********************************************************************** |
365 | * Map values to strings and back. Every map shoudl have the following | 365 | * Map values to strings and back. Every map should have the following |
366 | * as its last element: { NULL, AIPTEK_INVALID_VALUE }. | 366 | * as its last element: { NULL, AIPTEK_INVALID_VALUE }. |
367 | */ | 367 | */ |
368 | #define AIPTEK_INVALID_VALUE -1 | 368 | #define AIPTEK_INVALID_VALUE -1 |
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index 3d32d3f4e486..866a9ee1af1a 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c | |||
@@ -92,7 +92,7 @@ Scott Hill shill@gtcocalcomp.com | |||
92 | /* DATA STRUCTURES */ | 92 | /* DATA STRUCTURES */ |
93 | 93 | ||
94 | /* Device table */ | 94 | /* Device table */ |
95 | static struct usb_device_id gtco_usbid_table [] = { | 95 | static const struct usb_device_id gtco_usbid_table[] = { |
96 | { USB_DEVICE(VENDOR_ID_GTCO, PID_400) }, | 96 | { USB_DEVICE(VENDOR_ID_GTCO, PID_400) }, |
97 | { USB_DEVICE(VENDOR_ID_GTCO, PID_401) }, | 97 | { USB_DEVICE(VENDOR_ID_GTCO, PID_401) }, |
98 | { USB_DEVICE(VENDOR_ID_GTCO, PID_1000) }, | 98 | { USB_DEVICE(VENDOR_ID_GTCO, PID_1000) }, |
diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h index 9114ae1c7488..8fef1b689c69 100644 --- a/drivers/input/tablet/wacom.h +++ b/drivers/input/tablet/wacom.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/input/tablet/wacom.h | 2 | * drivers/input/tablet/wacom.h |
3 | * | 3 | * |
4 | * USB Wacom Graphire and Wacom Intuos tablet support | 4 | * USB Wacom tablet support |
5 | * | 5 | * |
6 | * Copyright (c) 2000-2004 Vojtech Pavlik <vojtech@ucw.cz> | 6 | * Copyright (c) 2000-2004 Vojtech Pavlik <vojtech@ucw.cz> |
7 | * Copyright (c) 2000 Andreas Bach Aaen <abach@stofanet.dk> | 7 | * Copyright (c) 2000 Andreas Bach Aaen <abach@stofanet.dk> |
@@ -69,6 +69,9 @@ | |||
69 | * v1.49 (pc) - Added support for USB Tablet PC (0x90, 0x93, and 0x9A) | 69 | * v1.49 (pc) - Added support for USB Tablet PC (0x90, 0x93, and 0x9A) |
70 | * v1.50 (pc) - Fixed a TabletPC touch bug in 2.6.28 | 70 | * v1.50 (pc) - Fixed a TabletPC touch bug in 2.6.28 |
71 | * v1.51 (pc) - Added support for Intuos4 | 71 | * v1.51 (pc) - Added support for Intuos4 |
72 | * v1.52 (pc) - Query Wacom data upon system resume | ||
73 | * - add defines for features->type | ||
74 | * - add new devices (0x9F, 0xE2, and 0XE3) | ||
72 | */ | 75 | */ |
73 | 76 | ||
74 | /* | 77 | /* |
@@ -82,6 +85,7 @@ | |||
82 | #include <linux/kernel.h> | 85 | #include <linux/kernel.h> |
83 | #include <linux/slab.h> | 86 | #include <linux/slab.h> |
84 | #include <linux/module.h> | 87 | #include <linux/module.h> |
88 | #include <linux/mod_devicetable.h> | ||
85 | #include <linux/init.h> | 89 | #include <linux/init.h> |
86 | #include <linux/usb/input.h> | 90 | #include <linux/usb/input.h> |
87 | #include <asm/unaligned.h> | 91 | #include <asm/unaligned.h> |
@@ -89,9 +93,9 @@ | |||
89 | /* | 93 | /* |
90 | * Version Information | 94 | * Version Information |
91 | */ | 95 | */ |
92 | #define DRIVER_VERSION "v1.51" | 96 | #define DRIVER_VERSION "v1.52" |
93 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" | 97 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" |
94 | #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" | 98 | #define DRIVER_DESC "USB Wacom tablet driver" |
95 | #define DRIVER_LICENSE "GPL" | 99 | #define DRIVER_LICENSE "GPL" |
96 | 100 | ||
97 | MODULE_AUTHOR(DRIVER_AUTHOR); | 101 | MODULE_AUTHOR(DRIVER_AUTHOR); |
@@ -117,6 +121,8 @@ struct wacom_combo { | |||
117 | struct urb *urb; | 121 | struct urb *urb; |
118 | }; | 122 | }; |
119 | 123 | ||
124 | extern const struct usb_device_id wacom_ids[]; | ||
125 | |||
120 | extern int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo); | 126 | extern int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo); |
121 | extern void wacom_report_abs(void *wcombo, unsigned int abs_type, int abs_data); | 127 | extern void wacom_report_abs(void *wcombo, unsigned int abs_type, int abs_data); |
122 | extern void wacom_report_rel(void *wcombo, unsigned int rel_type, int rel_data); | 128 | extern void wacom_report_rel(void *wcombo, unsigned int rel_type, int rel_data); |
@@ -133,11 +139,11 @@ extern void input_dev_i4s(struct input_dev *input_dev, struct wacom_wac *wacom_w | |||
133 | extern void input_dev_i4(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 139 | extern void input_dev_i4(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
134 | extern void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 140 | extern void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
135 | extern void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 141 | extern void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
142 | extern void input_dev_tpc(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | ||
143 | extern void input_dev_tpc2fg(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | ||
136 | extern void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 144 | extern void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
137 | extern void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 145 | extern void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
138 | extern __u16 wacom_le16_to_cpu(unsigned char *data); | 146 | extern __u16 wacom_le16_to_cpu(unsigned char *data); |
139 | extern __u16 wacom_be16_to_cpu(unsigned char *data); | 147 | extern __u16 wacom_be16_to_cpu(unsigned char *data); |
140 | extern struct wacom_features *get_wacom_feature(const struct usb_device_id *id); | ||
141 | extern const struct usb_device_id *get_device_table(void); | ||
142 | 148 | ||
143 | #endif | 149 | #endif |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index ea30c983a33e..f46502589e4e 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/input/tablet/wacom_sys.c | 2 | * drivers/input/tablet/wacom_sys.c |
3 | * | 3 | * |
4 | * USB Wacom Graphire and Wacom Intuos tablet support - system specific code | 4 | * USB Wacom tablet support - system specific code |
5 | */ | 5 | */ |
6 | 6 | ||
7 | /* | 7 | /* |
@@ -209,8 +209,10 @@ void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
209 | input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_LEFT) | | 209 | input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_LEFT) | |
210 | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE); | 210 | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE); |
211 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) | | 211 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) | |
212 | BIT_MASK(BTN_TOOL_PEN) | BIT_MASK(BTN_STYLUS) | | ||
212 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_STYLUS2); | 213 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_STYLUS2); |
213 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0); | 214 | input_set_abs_params(input_dev, ABS_DISTANCE, |
215 | 0, wacom_wac->features.distance_max, 0, 0); | ||
214 | } | 216 | } |
215 | 217 | ||
216 | void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 218 | void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
@@ -256,10 +258,12 @@ void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
256 | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE) | | 258 | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE) | |
257 | BIT_MASK(BTN_SIDE) | BIT_MASK(BTN_EXTRA); | 259 | BIT_MASK(BTN_SIDE) | BIT_MASK(BTN_EXTRA); |
258 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) | | 260 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) | |
261 | BIT_MASK(BTN_TOOL_PEN) | BIT_MASK(BTN_STYLUS) | | ||
259 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_TOOL_BRUSH) | | 262 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_TOOL_BRUSH) | |
260 | BIT_MASK(BTN_TOOL_PENCIL) | BIT_MASK(BTN_TOOL_AIRBRUSH) | | 263 | BIT_MASK(BTN_TOOL_PENCIL) | BIT_MASK(BTN_TOOL_AIRBRUSH) | |
261 | BIT_MASK(BTN_TOOL_LENS) | BIT_MASK(BTN_STYLUS2); | 264 | BIT_MASK(BTN_TOOL_LENS) | BIT_MASK(BTN_STYLUS2); |
262 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0); | 265 | input_set_abs_params(input_dev, ABS_DISTANCE, |
266 | 0, wacom_wac->features.distance_max, 0, 0); | ||
263 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); | 267 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); |
264 | input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0); | 268 | input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0); |
265 | input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0); | 269 | input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0); |
@@ -269,7 +273,8 @@ void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
269 | 273 | ||
270 | void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 274 | void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
271 | { | 275 | { |
272 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_STYLUS2); | 276 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_PEN) | |
277 | BIT_MASK(BTN_STYLUS) | BIT_MASK(BTN_STYLUS2); | ||
273 | } | 278 | } |
274 | 279 | ||
275 | void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 280 | void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
@@ -277,12 +282,34 @@ void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
277 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER); | 282 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER); |
278 | } | 283 | } |
279 | 284 | ||
285 | void input_dev_tpc(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | ||
286 | { | ||
287 | struct wacom_features *features = &wacom_wac->features; | ||
288 | |||
289 | if (features->device_type == BTN_TOOL_DOUBLETAP || | ||
290 | features->device_type == BTN_TOOL_TRIPLETAP) { | ||
291 | input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0); | ||
292 | input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0); | ||
293 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | ||
294 | } | ||
295 | } | ||
296 | |||
297 | void input_dev_tpc2fg(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | ||
298 | { | ||
299 | if (wacom_wac->features.device_type == BTN_TOOL_TRIPLETAP) { | ||
300 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_TRIPLETAP); | ||
301 | input_dev->evbit[0] |= BIT_MASK(EV_MSC); | ||
302 | input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); | ||
303 | } | ||
304 | } | ||
305 | |||
280 | static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, | 306 | static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, |
281 | struct wacom_wac *wacom_wac) | 307 | struct wacom_features *features) |
282 | { | 308 | { |
283 | struct usb_device *dev = interface_to_usbdev(intf); | 309 | struct usb_device *dev = interface_to_usbdev(intf); |
284 | struct wacom_features *features = wacom_wac->features; | 310 | char limit = 0; |
285 | char limit = 0, result = 0; | 311 | /* result has to be defined as int for some devices */ |
312 | int result = 0; | ||
286 | int i = 0, usage = WCM_UNDEFINED, finger = 0, pen = 0; | 313 | int i = 0, usage = WCM_UNDEFINED, finger = 0, pen = 0; |
287 | unsigned char *report; | 314 | unsigned char *report; |
288 | 315 | ||
@@ -328,13 +355,24 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
328 | case HID_USAGE_X: | 355 | case HID_USAGE_X: |
329 | if (usage == WCM_DESKTOP) { | 356 | if (usage == WCM_DESKTOP) { |
330 | if (finger) { | 357 | if (finger) { |
331 | features->touch_x_max = | 358 | features->device_type = BTN_TOOL_DOUBLETAP; |
332 | features->touch_y_max = | 359 | if (features->type == TABLETPC2FG) { |
333 | wacom_le16_to_cpu(&report[i + 3]); | 360 | /* need to reset back */ |
361 | features->pktlen = WACOM_PKGLEN_TPC2FG; | ||
362 | features->device_type = BTN_TOOL_TRIPLETAP; | ||
363 | } | ||
334 | features->x_max = | 364 | features->x_max = |
365 | wacom_le16_to_cpu(&report[i + 3]); | ||
366 | features->x_phy = | ||
335 | wacom_le16_to_cpu(&report[i + 6]); | 367 | wacom_le16_to_cpu(&report[i + 6]); |
336 | i += 7; | 368 | features->unit = report[i + 9]; |
369 | features->unitExpo = report[i + 11]; | ||
370 | i += 12; | ||
337 | } else if (pen) { | 371 | } else if (pen) { |
372 | /* penabled only accepts exact bytes of data */ | ||
373 | if (features->type == TABLETPC2FG) | ||
374 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; | ||
375 | features->device_type = BTN_TOOL_PEN; | ||
338 | features->x_max = | 376 | features->x_max = |
339 | wacom_le16_to_cpu(&report[i + 3]); | 377 | wacom_le16_to_cpu(&report[i + 3]); |
340 | i += 4; | 378 | i += 4; |
@@ -350,10 +388,35 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
350 | break; | 388 | break; |
351 | 389 | ||
352 | case HID_USAGE_Y: | 390 | case HID_USAGE_Y: |
353 | if (usage == WCM_DESKTOP) | 391 | if (usage == WCM_DESKTOP) { |
354 | features->y_max = | 392 | if (finger) { |
355 | wacom_le16_to_cpu(&report[i + 3]); | 393 | features->device_type = BTN_TOOL_DOUBLETAP; |
356 | i += 4; | 394 | if (features->type == TABLETPC2FG) { |
395 | /* need to reset back */ | ||
396 | features->pktlen = WACOM_PKGLEN_TPC2FG; | ||
397 | features->device_type = BTN_TOOL_TRIPLETAP; | ||
398 | features->y_max = | ||
399 | wacom_le16_to_cpu(&report[i + 3]); | ||
400 | features->y_phy = | ||
401 | wacom_le16_to_cpu(&report[i + 6]); | ||
402 | i += 7; | ||
403 | } else { | ||
404 | features->y_max = | ||
405 | features->x_max; | ||
406 | features->y_phy = | ||
407 | wacom_le16_to_cpu(&report[i + 3]); | ||
408 | i += 4; | ||
409 | } | ||
410 | } else if (pen) { | ||
411 | /* penabled only accepts exact bytes of data */ | ||
412 | if (features->type == TABLETPC2FG) | ||
413 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; | ||
414 | features->device_type = BTN_TOOL_PEN; | ||
415 | features->y_max = | ||
416 | wacom_le16_to_cpu(&report[i + 3]); | ||
417 | i += 4; | ||
418 | } | ||
419 | } | ||
357 | break; | 420 | break; |
358 | 421 | ||
359 | case HID_USAGE_FINGER: | 422 | case HID_USAGE_FINGER: |
@@ -376,7 +439,7 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
376 | break; | 439 | break; |
377 | 440 | ||
378 | case HID_COLLECTION: | 441 | case HID_COLLECTION: |
379 | /* reset UsagePage ans Finger */ | 442 | /* reset UsagePage and Finger */ |
380 | finger = usage = 0; | 443 | finger = usage = 0; |
381 | break; | 444 | break; |
382 | } | 445 | } |
@@ -388,57 +451,123 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
388 | return result; | 451 | return result; |
389 | } | 452 | } |
390 | 453 | ||
391 | static int wacom_query_tablet_data(struct usb_interface *intf) | 454 | static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_features *features) |
392 | { | 455 | { |
393 | unsigned char *rep_data; | 456 | unsigned char *rep_data; |
394 | int limit = 0; | 457 | int limit = 0, report_id = 2; |
395 | int error; | 458 | int error = -ENOMEM; |
396 | 459 | ||
397 | rep_data = kmalloc(2, GFP_KERNEL); | 460 | rep_data = kmalloc(2, GFP_KERNEL); |
398 | if (!rep_data) | 461 | if (!rep_data) |
399 | return -ENOMEM; | 462 | return error; |
400 | 463 | ||
401 | do { | 464 | /* ask to report tablet data if it is 2FGT or not a Tablet PC */ |
402 | rep_data[0] = 2; | 465 | if (features->device_type == BTN_TOOL_TRIPLETAP) { |
403 | rep_data[1] = 2; | 466 | do { |
404 | error = usb_set_report(intf, WAC_HID_FEATURE_REPORT, | 467 | rep_data[0] = 3; |
405 | 2, rep_data, 2); | 468 | rep_data[1] = 4; |
406 | if (error >= 0) | 469 | report_id = 3; |
407 | error = usb_get_report(intf, | 470 | error = usb_set_report(intf, WAC_HID_FEATURE_REPORT, |
408 | WAC_HID_FEATURE_REPORT, 2, | 471 | report_id, rep_data, 2); |
409 | rep_data, 2); | 472 | if (error >= 0) |
410 | } while ((error < 0 || rep_data[1] != 2) && limit++ < 5); | 473 | error = usb_get_report(intf, |
474 | WAC_HID_FEATURE_REPORT, report_id, | ||
475 | rep_data, 3); | ||
476 | } while ((error < 0 || rep_data[1] != 4) && limit++ < 5); | ||
477 | } else if (features->type != TABLETPC && features->type != TABLETPC2FG) { | ||
478 | do { | ||
479 | rep_data[0] = 2; | ||
480 | rep_data[1] = 2; | ||
481 | error = usb_set_report(intf, WAC_HID_FEATURE_REPORT, | ||
482 | report_id, rep_data, 2); | ||
483 | if (error >= 0) | ||
484 | error = usb_get_report(intf, | ||
485 | WAC_HID_FEATURE_REPORT, report_id, | ||
486 | rep_data, 2); | ||
487 | } while ((error < 0 || rep_data[1] != 2) && limit++ < 5); | ||
488 | } | ||
411 | 489 | ||
412 | kfree(rep_data); | 490 | kfree(rep_data); |
413 | 491 | ||
414 | return error < 0 ? error : 0; | 492 | return error < 0 ? error : 0; |
415 | } | 493 | } |
416 | 494 | ||
495 | static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, | ||
496 | struct wacom_features *features) | ||
497 | { | ||
498 | int error = 0; | ||
499 | struct usb_host_interface *interface = intf->cur_altsetting; | ||
500 | struct hid_descriptor *hid_desc; | ||
501 | |||
502 | /* default device to penabled */ | ||
503 | features->device_type = BTN_TOOL_PEN; | ||
504 | |||
505 | /* only Tablet PCs need to retrieve the info */ | ||
506 | if ((features->type != TABLETPC) && (features->type != TABLETPC2FG)) | ||
507 | goto out; | ||
508 | |||
509 | if (usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc)) { | ||
510 | if (usb_get_extra_descriptor(&interface->endpoint[0], | ||
511 | HID_DEVICET_REPORT, &hid_desc)) { | ||
512 | printk("wacom: can not retrieve extra class descriptor\n"); | ||
513 | error = 1; | ||
514 | goto out; | ||
515 | } | ||
516 | } | ||
517 | error = wacom_parse_hid(intf, hid_desc, features); | ||
518 | if (error) | ||
519 | goto out; | ||
520 | |||
521 | /* touch device found but size is not defined. use default */ | ||
522 | if (features->device_type == BTN_TOOL_DOUBLETAP && !features->x_max) { | ||
523 | features->x_max = 1023; | ||
524 | features->y_max = 1023; | ||
525 | } | ||
526 | |||
527 | out: | ||
528 | return error; | ||
529 | } | ||
530 | |||
417 | static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) | 531 | static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) |
418 | { | 532 | { |
419 | struct usb_device *dev = interface_to_usbdev(intf); | 533 | struct usb_device *dev = interface_to_usbdev(intf); |
420 | struct usb_host_interface *interface = intf->cur_altsetting; | ||
421 | struct usb_endpoint_descriptor *endpoint; | 534 | struct usb_endpoint_descriptor *endpoint; |
422 | struct wacom *wacom; | 535 | struct wacom *wacom; |
423 | struct wacom_wac *wacom_wac; | 536 | struct wacom_wac *wacom_wac; |
424 | struct wacom_features *features; | 537 | struct wacom_features *features; |
425 | struct input_dev *input_dev; | 538 | struct input_dev *input_dev; |
426 | int error = -ENOMEM; | 539 | int error; |
427 | struct hid_descriptor *hid_desc; | 540 | |
541 | if (!id->driver_info) | ||
542 | return -EINVAL; | ||
428 | 543 | ||
429 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); | 544 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); |
430 | wacom_wac = kzalloc(sizeof(struct wacom_wac), GFP_KERNEL); | 545 | wacom_wac = kzalloc(sizeof(struct wacom_wac), GFP_KERNEL); |
431 | input_dev = input_allocate_device(); | 546 | input_dev = input_allocate_device(); |
432 | if (!wacom || !input_dev || !wacom_wac) | 547 | if (!wacom || !input_dev || !wacom_wac) { |
548 | error = -ENOMEM; | ||
433 | goto fail1; | 549 | goto fail1; |
550 | } | ||
434 | 551 | ||
435 | wacom_wac->data = usb_buffer_alloc(dev, 10, GFP_KERNEL, &wacom->data_dma); | 552 | wacom_wac->features = *((struct wacom_features *)id->driver_info); |
436 | if (!wacom_wac->data) | 553 | features = &wacom_wac->features; |
554 | if (features->pktlen > WACOM_PKGLEN_MAX) { | ||
555 | error = -EINVAL; | ||
437 | goto fail1; | 556 | goto fail1; |
557 | } | ||
558 | |||
559 | wacom_wac->data = usb_buffer_alloc(dev, WACOM_PKGLEN_MAX, | ||
560 | GFP_KERNEL, &wacom->data_dma); | ||
561 | if (!wacom_wac->data) { | ||
562 | error = -ENOMEM; | ||
563 | goto fail1; | ||
564 | } | ||
438 | 565 | ||
439 | wacom->irq = usb_alloc_urb(0, GFP_KERNEL); | 566 | wacom->irq = usb_alloc_urb(0, GFP_KERNEL); |
440 | if (!wacom->irq) | 567 | if (!wacom->irq) { |
568 | error = -ENOMEM; | ||
441 | goto fail2; | 569 | goto fail2; |
570 | } | ||
442 | 571 | ||
443 | wacom->usbdev = dev; | 572 | wacom->usbdev = dev; |
444 | wacom->dev = input_dev; | 573 | wacom->dev = input_dev; |
@@ -447,11 +576,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
447 | usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); | 576 | usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); |
448 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); | 577 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); |
449 | 578 | ||
450 | wacom_wac->features = features = get_wacom_feature(id); | ||
451 | BUG_ON(features->pktlen > 10); | ||
452 | |||
453 | input_dev->name = wacom_wac->features->name; | ||
454 | wacom->wacom_wac = wacom_wac; | ||
455 | usb_to_input_id(dev, &input_dev->id); | 579 | usb_to_input_id(dev, &input_dev->id); |
456 | 580 | ||
457 | input_dev->dev.parent = &intf->dev; | 581 | input_dev->dev.parent = &intf->dev; |
@@ -463,47 +587,37 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
463 | 587 | ||
464 | endpoint = &intf->cur_altsetting->endpoint[0].desc; | 588 | endpoint = &intf->cur_altsetting->endpoint[0].desc; |
465 | 589 | ||
466 | /* Initialize touch_x_max and touch_y_max in case it is not defined */ | 590 | /* Retrieve the physical and logical size for OEM devices */ |
467 | if (wacom_wac->features->type == TABLETPC) { | 591 | error = wacom_retrieve_hid_descriptor(intf, features); |
468 | features->touch_x_max = 1023; | 592 | if (error) |
469 | features->touch_y_max = 1023; | 593 | goto fail2; |
470 | } else { | ||
471 | features->touch_x_max = 0; | ||
472 | features->touch_y_max = 0; | ||
473 | } | ||
474 | 594 | ||
475 | /* TabletPC need to retrieve the physical and logical maximum from report descriptor */ | 595 | strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); |
476 | if (wacom_wac->features->type == TABLETPC) { | 596 | |
477 | if (usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc)) { | 597 | if (features->type == TABLETPC || features->type == TABLETPC2FG) { |
478 | if (usb_get_extra_descriptor(&interface->endpoint[0], | 598 | /* Append the device type to the name */ |
479 | HID_DEVICET_REPORT, &hid_desc)) { | 599 | strlcat(wacom_wac->name, |
480 | printk("wacom: can not retrive extra class descriptor\n"); | 600 | features->device_type == BTN_TOOL_PEN ? |
481 | goto fail2; | 601 | " Pen" : " Finger", |
482 | } | 602 | sizeof(wacom_wac->name)); |
483 | } | ||
484 | error = wacom_parse_hid(intf, hid_desc, wacom_wac); | ||
485 | if (error) | ||
486 | goto fail2; | ||
487 | } | 603 | } |
488 | 604 | ||
605 | input_dev->name = wacom_wac->name; | ||
606 | wacom->wacom_wac = wacom_wac; | ||
607 | |||
489 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 608 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
490 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_PEN) | | 609 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOUCH); |
491 | BIT_MASK(BTN_TOUCH) | BIT_MASK(BTN_STYLUS); | 610 | |
492 | input_set_abs_params(input_dev, ABS_X, 0, features->x_max, 4, 0); | 611 | input_set_abs_params(input_dev, ABS_X, 0, features->x_max, 4, 0); |
493 | input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, 4, 0); | 612 | input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, 4, 0); |
494 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, 0, 0); | 613 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, 0, 0); |
495 | if (features->type == TABLETPC) { | ||
496 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_DOUBLETAP); | ||
497 | input_set_abs_params(input_dev, ABS_RX, 0, features->touch_x_max, 4, 0); | ||
498 | input_set_abs_params(input_dev, ABS_RY, 0, features->touch_y_max, 4, 0); | ||
499 | } | ||
500 | input_dev->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC); | 614 | input_dev->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC); |
501 | 615 | ||
502 | wacom_init_input_dev(input_dev, wacom_wac); | 616 | wacom_init_input_dev(input_dev, wacom_wac); |
503 | 617 | ||
504 | usb_fill_int_urb(wacom->irq, dev, | 618 | usb_fill_int_urb(wacom->irq, dev, |
505 | usb_rcvintpipe(dev, endpoint->bEndpointAddress), | 619 | usb_rcvintpipe(dev, endpoint->bEndpointAddress), |
506 | wacom_wac->data, wacom_wac->features->pktlen, | 620 | wacom_wac->data, features->pktlen, |
507 | wacom_sys_irq, wacom, endpoint->bInterval); | 621 | wacom_sys_irq, wacom, endpoint->bInterval); |
508 | wacom->irq->transfer_dma = wacom->data_dma; | 622 | wacom->irq->transfer_dma = wacom->data_dma; |
509 | wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 623 | wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
@@ -512,18 +626,14 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
512 | if (error) | 626 | if (error) |
513 | goto fail3; | 627 | goto fail3; |
514 | 628 | ||
515 | /* | 629 | /* Note that if query fails it is not a hard failure */ |
516 | * Ask the tablet to report tablet data if it is not a Tablet PC. | 630 | wacom_query_tablet_data(intf, features); |
517 | * Note that if query fails it is not a hard failure. | ||
518 | */ | ||
519 | if (wacom_wac->features->type != TABLETPC) | ||
520 | wacom_query_tablet_data(intf); | ||
521 | 631 | ||
522 | usb_set_intfdata(intf, wacom); | 632 | usb_set_intfdata(intf, wacom); |
523 | return 0; | 633 | return 0; |
524 | 634 | ||
525 | fail3: usb_free_urb(wacom->irq); | 635 | fail3: usb_free_urb(wacom->irq); |
526 | fail2: usb_buffer_free(dev, 10, wacom_wac->data, wacom->data_dma); | 636 | fail2: usb_buffer_free(dev, WACOM_PKGLEN_MAX, wacom_wac->data, wacom->data_dma); |
527 | fail1: input_free_device(input_dev); | 637 | fail1: input_free_device(input_dev); |
528 | kfree(wacom); | 638 | kfree(wacom); |
529 | kfree(wacom_wac); | 639 | kfree(wacom_wac); |
@@ -539,7 +649,7 @@ static void wacom_disconnect(struct usb_interface *intf) | |||
539 | usb_kill_urb(wacom->irq); | 649 | usb_kill_urb(wacom->irq); |
540 | input_unregister_device(wacom->dev); | 650 | input_unregister_device(wacom->dev); |
541 | usb_free_urb(wacom->irq); | 651 | usb_free_urb(wacom->irq); |
542 | usb_buffer_free(interface_to_usbdev(intf), 10, | 652 | usb_buffer_free(interface_to_usbdev(intf), WACOM_PKGLEN_MAX, |
543 | wacom->wacom_wac->data, wacom->data_dma); | 653 | wacom->wacom_wac->data, wacom->data_dma); |
544 | kfree(wacom->wacom_wac); | 654 | kfree(wacom->wacom_wac); |
545 | kfree(wacom); | 655 | kfree(wacom); |
@@ -559,13 +669,19 @@ static int wacom_suspend(struct usb_interface *intf, pm_message_t message) | |||
559 | static int wacom_resume(struct usb_interface *intf) | 669 | static int wacom_resume(struct usb_interface *intf) |
560 | { | 670 | { |
561 | struct wacom *wacom = usb_get_intfdata(intf); | 671 | struct wacom *wacom = usb_get_intfdata(intf); |
672 | struct wacom_features *features = &wacom->wacom_wac->features; | ||
562 | int rv; | 673 | int rv; |
563 | 674 | ||
564 | mutex_lock(&wacom->lock); | 675 | mutex_lock(&wacom->lock); |
676 | |||
677 | /* switch to wacom mode first */ | ||
678 | wacom_query_tablet_data(intf, features); | ||
679 | |||
565 | if (wacom->open) | 680 | if (wacom->open) |
566 | rv = usb_submit_urb(wacom->irq, GFP_NOIO); | 681 | rv = usb_submit_urb(wacom->irq, GFP_NOIO); |
567 | else | 682 | else |
568 | rv = 0; | 683 | rv = 0; |
684 | |||
569 | mutex_unlock(&wacom->lock); | 685 | mutex_unlock(&wacom->lock); |
570 | 686 | ||
571 | return rv; | 687 | return rv; |
@@ -578,6 +694,7 @@ static int wacom_reset_resume(struct usb_interface *intf) | |||
578 | 694 | ||
579 | static struct usb_driver wacom_driver = { | 695 | static struct usb_driver wacom_driver = { |
580 | .name = "wacom", | 696 | .name = "wacom", |
697 | .id_table = wacom_ids, | ||
581 | .probe = wacom_probe, | 698 | .probe = wacom_probe, |
582 | .disconnect = wacom_disconnect, | 699 | .disconnect = wacom_disconnect, |
583 | .suspend = wacom_suspend, | 700 | .suspend = wacom_suspend, |
@@ -589,7 +706,7 @@ static struct usb_driver wacom_driver = { | |||
589 | static int __init wacom_init(void) | 706 | static int __init wacom_init(void) |
590 | { | 707 | { |
591 | int result; | 708 | int result; |
592 | wacom_driver.id_table = get_device_table(); | 709 | |
593 | result = usb_register(&wacom_driver); | 710 | result = usb_register(&wacom_driver); |
594 | if (result == 0) | 711 | if (result == 0) |
595 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" | 712 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index c896d6a21b7e..4a852d815c68 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/input/tablet/wacom_wac.c | 2 | * drivers/input/tablet/wacom_wac.c |
3 | * | 3 | * |
4 | * USB Wacom Graphire and Wacom Intuos tablet support - Wacom specific code | 4 | * USB Wacom tablet support - Wacom specific code |
5 | * | 5 | * |
6 | */ | 6 | */ |
7 | 7 | ||
@@ -55,23 +55,23 @@ static int wacom_penpartner_irq(struct wacom_wac *wacom, void *wcombo) | |||
55 | 55 | ||
56 | static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo) | 56 | static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo) |
57 | { | 57 | { |
58 | struct wacom_features *features = &wacom->features; | ||
58 | unsigned char *data = wacom->data; | 59 | unsigned char *data = wacom->data; |
59 | int prox, pressure; | 60 | int prox, pressure; |
60 | 61 | ||
61 | if (data[0] != 2) { | 62 | if (data[0] != WACOM_REPORT_PENABLED) { |
62 | dbg("wacom_pl_irq: received unknown report #%d", data[0]); | 63 | dbg("wacom_pl_irq: received unknown report #%d", data[0]); |
63 | return 0; | 64 | return 0; |
64 | } | 65 | } |
65 | 66 | ||
66 | prox = data[1] & 0x40; | 67 | prox = data[1] & 0x40; |
67 | 68 | ||
68 | wacom->id[0] = ERASER_DEVICE_ID; | ||
69 | if (prox) { | 69 | if (prox) { |
70 | 70 | wacom->id[0] = ERASER_DEVICE_ID; | |
71 | pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); | 71 | pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); |
72 | if (wacom->features->pressure_max > 255) | 72 | if (features->pressure_max > 255) |
73 | pressure = (pressure << 1) | ((data[4] >> 6) & 1); | 73 | pressure = (pressure << 1) | ((data[4] >> 6) & 1); |
74 | pressure += (wacom->features->pressure_max + 1) / 2; | 74 | pressure += (features->pressure_max + 1) / 2; |
75 | 75 | ||
76 | /* | 76 | /* |
77 | * if going from out of proximity into proximity select between the eraser | 77 | * if going from out of proximity into proximity select between the eraser |
@@ -128,7 +128,7 @@ static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo) | |||
128 | { | 128 | { |
129 | unsigned char *data = wacom->data; | 129 | unsigned char *data = wacom->data; |
130 | 130 | ||
131 | if (data[0] != 2) { | 131 | if (data[0] != WACOM_REPORT_PENABLED) { |
132 | printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]); | 132 | printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]); |
133 | return 0; | 133 | return 0; |
134 | } | 134 | } |
@@ -153,16 +153,19 @@ static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo) | |||
153 | 153 | ||
154 | static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | 154 | static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) |
155 | { | 155 | { |
156 | struct wacom_features *features = &wacom->features; | ||
156 | unsigned char *data = wacom->data; | 157 | unsigned char *data = wacom->data; |
157 | int x, y, rw; | 158 | int x, y, rw; |
159 | static int penData = 0; | ||
158 | 160 | ||
159 | if (data[0] != 2) { | 161 | if (data[0] != WACOM_REPORT_PENABLED) { |
160 | dbg("wacom_graphire_irq: received unknown report #%d", data[0]); | 162 | dbg("wacom_graphire_irq: received unknown report #%d", data[0]); |
161 | return 0; | 163 | return 0; |
162 | } | 164 | } |
163 | 165 | ||
164 | if (data[1] & 0x80) { | 166 | if (data[1] & 0x80) { |
165 | /* in prox and not a pad data */ | 167 | /* in prox and not a pad data */ |
168 | penData = 1; | ||
166 | 169 | ||
167 | switch ((data[1] >> 5) & 3) { | 170 | switch ((data[1] >> 5) & 3) { |
168 | 171 | ||
@@ -178,8 +181,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
178 | 181 | ||
179 | case 2: /* Mouse with wheel */ | 182 | case 2: /* Mouse with wheel */ |
180 | wacom_report_key(wcombo, BTN_MIDDLE, data[1] & 0x04); | 183 | wacom_report_key(wcombo, BTN_MIDDLE, data[1] & 0x04); |
181 | if (wacom->features->type == WACOM_G4 || | 184 | if (features->type == WACOM_G4 || features->type == WACOM_MO) { |
182 | wacom->features->type == WACOM_MO) { | ||
183 | rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : (data[7] & 0x03); | 185 | rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : (data[7] & 0x03); |
184 | wacom_report_rel(wcombo, REL_WHEEL, -rw); | 186 | wacom_report_rel(wcombo, REL_WHEEL, -rw); |
185 | } else | 187 | } else |
@@ -191,8 +193,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
191 | wacom->id[0] = CURSOR_DEVICE_ID; | 193 | wacom->id[0] = CURSOR_DEVICE_ID; |
192 | wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01); | 194 | wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01); |
193 | wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02); | 195 | wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02); |
194 | if (wacom->features->type == WACOM_G4 || | 196 | if (features->type == WACOM_G4 || features->type == WACOM_MO) |
195 | wacom->features->type == WACOM_MO) | ||
196 | wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f); | 197 | wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f); |
197 | else | 198 | else |
198 | wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f); | 199 | wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f); |
@@ -229,10 +230,14 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
229 | } | 230 | } |
230 | 231 | ||
231 | /* send pad data */ | 232 | /* send pad data */ |
232 | switch (wacom->features->type) { | 233 | switch (features->type) { |
233 | case WACOM_G4: | 234 | case WACOM_G4: |
234 | if (data[7] & 0xf8) { | 235 | if (data[7] & 0xf8) { |
235 | wacom_input_sync(wcombo); /* sync last event */ | 236 | if (penData) { |
237 | wacom_input_sync(wcombo); /* sync last event */ | ||
238 | if (!wacom->id[0]) | ||
239 | penData = 0; | ||
240 | } | ||
236 | wacom->id[1] = PAD_DEVICE_ID; | 241 | wacom->id[1] = PAD_DEVICE_ID; |
237 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); | 242 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); |
238 | wacom_report_key(wcombo, BTN_4, (data[7] & 0x80)); | 243 | wacom_report_key(wcombo, BTN_4, (data[7] & 0x80)); |
@@ -242,10 +247,15 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
242 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]); | 247 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]); |
243 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); | 248 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); |
244 | } else if (wacom->id[1]) { | 249 | } else if (wacom->id[1]) { |
245 | wacom_input_sync(wcombo); /* sync last event */ | 250 | if (penData) { |
251 | wacom_input_sync(wcombo); /* sync last event */ | ||
252 | if (!wacom->id[0]) | ||
253 | penData = 0; | ||
254 | } | ||
246 | wacom->id[1] = 0; | 255 | wacom->id[1] = 0; |
247 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); | 256 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); |
248 | wacom_report_key(wcombo, BTN_4, (data[7] & 0x80)); | 257 | wacom_report_key(wcombo, BTN_4, (data[7] & 0x80)); |
258 | wacom_report_rel(wcombo, REL_WHEEL, 0); | ||
249 | wacom_report_key(wcombo, BTN_TOOL_FINGER, 0); | 259 | wacom_report_key(wcombo, BTN_TOOL_FINGER, 0); |
250 | wacom_report_abs(wcombo, ABS_MISC, 0); | 260 | wacom_report_abs(wcombo, ABS_MISC, 0); |
251 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); | 261 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); |
@@ -253,7 +263,11 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
253 | break; | 263 | break; |
254 | case WACOM_MO: | 264 | case WACOM_MO: |
255 | if ((data[7] & 0xf8) || (data[8] & 0xff)) { | 265 | if ((data[7] & 0xf8) || (data[8] & 0xff)) { |
256 | wacom_input_sync(wcombo); /* sync last event */ | 266 | if (penData) { |
267 | wacom_input_sync(wcombo); /* sync last event */ | ||
268 | if (!wacom->id[0]) | ||
269 | penData = 0; | ||
270 | } | ||
257 | wacom->id[1] = PAD_DEVICE_ID; | 271 | wacom->id[1] = PAD_DEVICE_ID; |
258 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x08)); | 272 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x08)); |
259 | wacom_report_key(wcombo, BTN_1, (data[7] & 0x20)); | 273 | wacom_report_key(wcombo, BTN_1, (data[7] & 0x20)); |
@@ -264,7 +278,11 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
264 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]); | 278 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]); |
265 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); | 279 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); |
266 | } else if (wacom->id[1]) { | 280 | } else if (wacom->id[1]) { |
267 | wacom_input_sync(wcombo); /* sync last event */ | 281 | if (penData) { |
282 | wacom_input_sync(wcombo); /* sync last event */ | ||
283 | if (!wacom->id[0]) | ||
284 | penData = 0; | ||
285 | } | ||
268 | wacom->id[1] = 0; | 286 | wacom->id[1] = 0; |
269 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x08)); | 287 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x08)); |
270 | wacom_report_key(wcombo, BTN_1, (data[7] & 0x20)); | 288 | wacom_report_key(wcombo, BTN_1, (data[7] & 0x20)); |
@@ -282,11 +300,12 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
282 | 300 | ||
283 | static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | 301 | static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) |
284 | { | 302 | { |
303 | struct wacom_features *features = &wacom->features; | ||
285 | unsigned char *data = wacom->data; | 304 | unsigned char *data = wacom->data; |
286 | int idx = 0; | 305 | int idx = 0; |
287 | 306 | ||
288 | /* tool number */ | 307 | /* tool number */ |
289 | if (wacom->features->type == INTUOS) | 308 | if (features->type == INTUOS) |
290 | idx = data[1] & 0x01; | 309 | idx = data[1] & 0x01; |
291 | 310 | ||
292 | /* Enter report */ | 311 | /* Enter report */ |
@@ -384,7 +403,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | |||
384 | wacom_report_key(wcombo, BTN_STYLUS2, 0); | 403 | wacom_report_key(wcombo, BTN_STYLUS2, 0); |
385 | wacom_report_key(wcombo, BTN_TOUCH, 0); | 404 | wacom_report_key(wcombo, BTN_TOUCH, 0); |
386 | wacom_report_abs(wcombo, ABS_WHEEL, 0); | 405 | wacom_report_abs(wcombo, ABS_WHEEL, 0); |
387 | if (wacom->features->type >= INTUOS3S) | 406 | if (features->type >= INTUOS3S) |
388 | wacom_report_abs(wcombo, ABS_Z, 0); | 407 | wacom_report_abs(wcombo, ABS_Z, 0); |
389 | } | 408 | } |
390 | wacom_report_key(wcombo, wacom->tool[idx], 0); | 409 | wacom_report_key(wcombo, wacom->tool[idx], 0); |
@@ -398,13 +417,14 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | |||
398 | 417 | ||
399 | static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo) | 418 | static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo) |
400 | { | 419 | { |
420 | struct wacom_features *features = &wacom->features; | ||
401 | unsigned char *data = wacom->data; | 421 | unsigned char *data = wacom->data; |
402 | unsigned int t; | 422 | unsigned int t; |
403 | 423 | ||
404 | /* general pen packet */ | 424 | /* general pen packet */ |
405 | if ((data[1] & 0xb8) == 0xa0) { | 425 | if ((data[1] & 0xb8) == 0xa0) { |
406 | t = (data[6] << 2) | ((data[7] >> 6) & 3); | 426 | t = (data[6] << 2) | ((data[7] >> 6) & 3); |
407 | if (wacom->features->type >= INTUOS4S && wacom->features->type <= INTUOS4L) | 427 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) |
408 | t = (t << 1) | (data[1] & 1); | 428 | t = (t << 1) | (data[1] & 1); |
409 | wacom_report_abs(wcombo, ABS_PRESSURE, t); | 429 | wacom_report_abs(wcombo, ABS_PRESSURE, t); |
410 | wacom_report_abs(wcombo, ABS_TILT_X, | 430 | wacom_report_abs(wcombo, ABS_TILT_X, |
@@ -428,26 +448,28 @@ static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo) | |||
428 | 448 | ||
429 | static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | 449 | static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) |
430 | { | 450 | { |
451 | struct wacom_features *features = &wacom->features; | ||
431 | unsigned char *data = wacom->data; | 452 | unsigned char *data = wacom->data; |
432 | unsigned int t; | 453 | unsigned int t; |
433 | int idx = 0, result; | 454 | int idx = 0, result; |
434 | 455 | ||
435 | if (data[0] != 2 && data[0] != 5 && data[0] != 6 && data[0] != 12) { | 456 | if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_INTUOSREAD |
457 | && data[0] != WACOM_REPORT_INTUOSWRITE && data[0] != WACOM_REPORT_INTUOSPAD) { | ||
436 | dbg("wacom_intuos_irq: received unknown report #%d", data[0]); | 458 | dbg("wacom_intuos_irq: received unknown report #%d", data[0]); |
437 | return 0; | 459 | return 0; |
438 | } | 460 | } |
439 | 461 | ||
440 | /* tool number */ | 462 | /* tool number */ |
441 | if (wacom->features->type == INTUOS) | 463 | if (features->type == INTUOS) |
442 | idx = data[1] & 0x01; | 464 | idx = data[1] & 0x01; |
443 | 465 | ||
444 | /* pad packets. Works as a second tool and is always in prox */ | 466 | /* pad packets. Works as a second tool and is always in prox */ |
445 | if (data[0] == 12) { | 467 | if (data[0] == WACOM_REPORT_INTUOSPAD) { |
446 | /* initiate the pad as a device */ | 468 | /* initiate the pad as a device */ |
447 | if (wacom->tool[1] != BTN_TOOL_FINGER) | 469 | if (wacom->tool[1] != BTN_TOOL_FINGER) |
448 | wacom->tool[1] = BTN_TOOL_FINGER; | 470 | wacom->tool[1] = BTN_TOOL_FINGER; |
449 | 471 | ||
450 | if (wacom->features->type >= INTUOS4S && wacom->features->type <= INTUOS4L) { | 472 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) { |
451 | wacom_report_key(wcombo, BTN_0, (data[2] & 0x01)); | 473 | wacom_report_key(wcombo, BTN_0, (data[2] & 0x01)); |
452 | wacom_report_key(wcombo, BTN_1, (data[3] & 0x01)); | 474 | wacom_report_key(wcombo, BTN_1, (data[3] & 0x01)); |
453 | wacom_report_key(wcombo, BTN_2, (data[3] & 0x02)); | 475 | wacom_report_key(wcombo, BTN_2, (data[3] & 0x02)); |
@@ -461,7 +483,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
461 | /* Out of proximity, clear wheel value. */ | 483 | /* Out of proximity, clear wheel value. */ |
462 | wacom_report_abs(wcombo, ABS_WHEEL, 0); | 484 | wacom_report_abs(wcombo, ABS_WHEEL, 0); |
463 | } | 485 | } |
464 | if (wacom->features->type != INTUOS4S) { | 486 | if (features->type != INTUOS4S) { |
465 | wacom_report_key(wcombo, BTN_7, (data[3] & 0x40)); | 487 | wacom_report_key(wcombo, BTN_7, (data[3] & 0x40)); |
466 | wacom_report_key(wcombo, BTN_8, (data[3] & 0x80)); | 488 | wacom_report_key(wcombo, BTN_8, (data[3] & 0x80)); |
467 | } | 489 | } |
@@ -509,18 +531,20 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
509 | return 0; | 531 | return 0; |
510 | 532 | ||
511 | /* Only large Intuos support Lense Cursor */ | 533 | /* Only large Intuos support Lense Cursor */ |
512 | if ((wacom->tool[idx] == BTN_TOOL_LENS) | 534 | if (wacom->tool[idx] == BTN_TOOL_LENS && |
513 | && ((wacom->features->type == INTUOS3) | 535 | (features->type == INTUOS3 || |
514 | || (wacom->features->type == INTUOS3S) | 536 | features->type == INTUOS3S || |
515 | || (wacom->features->type == INTUOS4) | 537 | features->type == INTUOS4 || |
516 | || (wacom->features->type == INTUOS4S))) | 538 | features->type == INTUOS4S)) { |
539 | |||
517 | return 0; | 540 | return 0; |
541 | } | ||
518 | 542 | ||
519 | /* Cintiq doesn't send data when RDY bit isn't set */ | 543 | /* Cintiq doesn't send data when RDY bit isn't set */ |
520 | if ((wacom->features->type == CINTIQ) && !(data[1] & 0x40)) | 544 | if (features->type == CINTIQ && !(data[1] & 0x40)) |
521 | return 0; | 545 | return 0; |
522 | 546 | ||
523 | if (wacom->features->type >= INTUOS3S) { | 547 | if (features->type >= INTUOS3S) { |
524 | wacom_report_abs(wcombo, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1)); | 548 | wacom_report_abs(wcombo, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1)); |
525 | wacom_report_abs(wcombo, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1)); | 549 | wacom_report_abs(wcombo, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1)); |
526 | wacom_report_abs(wcombo, ABS_DISTANCE, ((data[9] >> 2) & 0x3f)); | 550 | wacom_report_abs(wcombo, ABS_DISTANCE, ((data[9] >> 2) & 0x3f)); |
@@ -538,7 +562,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
538 | 562 | ||
539 | if (data[1] & 0x02) { | 563 | if (data[1] & 0x02) { |
540 | /* Rotation packet */ | 564 | /* Rotation packet */ |
541 | if (wacom->features->type >= INTUOS3S) { | 565 | if (features->type >= INTUOS3S) { |
542 | /* I3 marker pen rotation */ | 566 | /* I3 marker pen rotation */ |
543 | t = (data[6] << 3) | ((data[7] >> 5) & 7); | 567 | t = (data[6] << 3) | ((data[7] >> 5) & 7); |
544 | t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : | 568 | t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : |
@@ -551,7 +575,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
551 | ((t - 1) / 2) : -t / 2); | 575 | ((t - 1) / 2) : -t / 2); |
552 | } | 576 | } |
553 | 577 | ||
554 | } else if (!(data[1] & 0x10) && wacom->features->type < INTUOS3S) { | 578 | } else if (!(data[1] & 0x10) && features->type < INTUOS3S) { |
555 | /* 4D mouse packet */ | 579 | /* 4D mouse packet */ |
556 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); | 580 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); |
557 | wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02); | 581 | wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02); |
@@ -564,7 +588,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
564 | 588 | ||
565 | } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) { | 589 | } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) { |
566 | /* I4 mouse */ | 590 | /* I4 mouse */ |
567 | if (wacom->features->type >= INTUOS4S && wacom->features->type <= INTUOS4L) { | 591 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) { |
568 | wacom_report_key(wcombo, BTN_LEFT, data[6] & 0x01); | 592 | wacom_report_key(wcombo, BTN_LEFT, data[6] & 0x01); |
569 | wacom_report_key(wcombo, BTN_MIDDLE, data[6] & 0x02); | 593 | wacom_report_key(wcombo, BTN_MIDDLE, data[6] & 0x02); |
570 | wacom_report_key(wcombo, BTN_RIGHT, data[6] & 0x04); | 594 | wacom_report_key(wcombo, BTN_RIGHT, data[6] & 0x04); |
@@ -585,13 +609,13 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
585 | - ((data[8] & 0x02) >> 1)); | 609 | - ((data[8] & 0x02) >> 1)); |
586 | 610 | ||
587 | /* I3 2D mouse side buttons */ | 611 | /* I3 2D mouse side buttons */ |
588 | if (wacom->features->type >= INTUOS3S && wacom->features->type <= INTUOS3L) { | 612 | if (features->type >= INTUOS3S && features->type <= INTUOS3L) { |
589 | wacom_report_key(wcombo, BTN_SIDE, data[8] & 0x40); | 613 | wacom_report_key(wcombo, BTN_SIDE, data[8] & 0x40); |
590 | wacom_report_key(wcombo, BTN_EXTRA, data[8] & 0x20); | 614 | wacom_report_key(wcombo, BTN_EXTRA, data[8] & 0x20); |
591 | } | 615 | } |
592 | } | 616 | } |
593 | } else if ((wacom->features->type < INTUOS3S || wacom->features->type == INTUOS3L || | 617 | } else if ((features->type < INTUOS3S || features->type == INTUOS3L || |
594 | wacom->features->type == INTUOS4L) && | 618 | features->type == INTUOS4L) && |
595 | wacom->tool[idx] == BTN_TOOL_LENS) { | 619 | wacom->tool[idx] == BTN_TOOL_LENS) { |
596 | /* Lens cursor packets */ | 620 | /* Lens cursor packets */ |
597 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); | 621 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); |
@@ -608,95 +632,164 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
608 | return 1; | 632 | return 1; |
609 | } | 633 | } |
610 | 634 | ||
635 | |||
636 | static void wacom_tpc_finger_in(struct wacom_wac *wacom, void *wcombo, char *data, int idx) | ||
637 | { | ||
638 | wacom_report_abs(wcombo, ABS_X, | ||
639 | (data[2 + idx * 2] & 0xff) | ((data[3 + idx * 2] & 0x7f) << 8)); | ||
640 | wacom_report_abs(wcombo, ABS_Y, | ||
641 | (data[6 + idx * 2] & 0xff) | ((data[7 + idx * 2] & 0x7f) << 8)); | ||
642 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); | ||
643 | wacom_report_key(wcombo, wacom->tool[idx], 1); | ||
644 | if (idx) | ||
645 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); | ||
646 | else | ||
647 | wacom_report_key(wcombo, BTN_TOUCH, 1); | ||
648 | } | ||
649 | |||
650 | static void wacom_tpc_touch_out(struct wacom_wac *wacom, void *wcombo, int idx) | ||
651 | { | ||
652 | wacom_report_abs(wcombo, ABS_X, 0); | ||
653 | wacom_report_abs(wcombo, ABS_Y, 0); | ||
654 | wacom_report_abs(wcombo, ABS_MISC, 0); | ||
655 | wacom_report_key(wcombo, wacom->tool[idx], 0); | ||
656 | if (idx) | ||
657 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); | ||
658 | else | ||
659 | wacom_report_key(wcombo, BTN_TOUCH, 0); | ||
660 | return; | ||
661 | } | ||
662 | |||
663 | static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo) | ||
664 | { | ||
665 | char *data = wacom->data; | ||
666 | struct urb *urb = ((struct wacom_combo *)wcombo)->urb; | ||
667 | static int firstFinger = 0; | ||
668 | static int secondFinger = 0; | ||
669 | |||
670 | wacom->tool[0] = BTN_TOOL_DOUBLETAP; | ||
671 | wacom->id[0] = TOUCH_DEVICE_ID; | ||
672 | wacom->tool[1] = BTN_TOOL_TRIPLETAP; | ||
673 | |||
674 | if (urb->actual_length != WACOM_PKGLEN_TPC1FG) { | ||
675 | switch (data[0]) { | ||
676 | case WACOM_REPORT_TPC1FG: | ||
677 | wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2])); | ||
678 | wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4])); | ||
679 | wacom_report_abs(wcombo, ABS_PRESSURE, wacom_le16_to_cpu(&data[6])); | ||
680 | wacom_report_key(wcombo, BTN_TOUCH, wacom_le16_to_cpu(&data[6])); | ||
681 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); | ||
682 | wacom_report_key(wcombo, wacom->tool[0], 1); | ||
683 | break; | ||
684 | case WACOM_REPORT_TPC2FG: | ||
685 | /* keep this byte to send proper out-prox event */ | ||
686 | wacom->id[1] = data[1] & 0x03; | ||
687 | |||
688 | if (data[1] & 0x01) { | ||
689 | wacom_tpc_finger_in(wacom, wcombo, data, 0); | ||
690 | firstFinger = 1; | ||
691 | } else if (firstFinger) { | ||
692 | wacom_tpc_touch_out(wacom, wcombo, 0); | ||
693 | } | ||
694 | |||
695 | if (data[1] & 0x02) { | ||
696 | /* sync first finger data */ | ||
697 | if (firstFinger) | ||
698 | wacom_input_sync(wcombo); | ||
699 | |||
700 | wacom_tpc_finger_in(wacom, wcombo, data, 1); | ||
701 | secondFinger = 1; | ||
702 | } else if (secondFinger) { | ||
703 | /* sync first finger data */ | ||
704 | if (firstFinger) | ||
705 | wacom_input_sync(wcombo); | ||
706 | |||
707 | wacom_tpc_touch_out(wacom, wcombo, 1); | ||
708 | secondFinger = 0; | ||
709 | } | ||
710 | if (!(data[1] & 0x01)) | ||
711 | firstFinger = 0; | ||
712 | break; | ||
713 | } | ||
714 | } else { | ||
715 | wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[1])); | ||
716 | wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[3])); | ||
717 | wacom_report_key(wcombo, BTN_TOUCH, 1); | ||
718 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); | ||
719 | wacom_report_key(wcombo, wacom->tool[0], 1); | ||
720 | } | ||
721 | return; | ||
722 | } | ||
723 | |||
611 | static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo) | 724 | static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo) |
612 | { | 725 | { |
726 | struct wacom_features *features = &wacom->features; | ||
613 | char *data = wacom->data; | 727 | char *data = wacom->data; |
614 | int prox = 0, pressure; | 728 | int prox = 0, pressure, idx = -1; |
615 | static int stylusInProx, touchInProx = 1, touchOut; | 729 | static int stylusInProx, touchInProx = 1, touchOut; |
616 | struct urb *urb = ((struct wacom_combo *)wcombo)->urb; | 730 | struct urb *urb = ((struct wacom_combo *)wcombo)->urb; |
617 | 731 | ||
618 | dbg("wacom_tpc_irq: received report #%d", data[0]); | 732 | dbg("wacom_tpc_irq: received report #%d", data[0]); |
619 | 733 | ||
620 | if (urb->actual_length == 5 || data[0] == 6) { /* Touch data */ | 734 | if (urb->actual_length == WACOM_PKGLEN_TPC1FG || /* single touch */ |
621 | if (urb->actual_length == 5) { /* with touch */ | 735 | data[0] == WACOM_REPORT_TPC1FG || /* single touch */ |
622 | prox = data[0] & 0x03; | 736 | data[0] == WACOM_REPORT_TPC2FG) { /* 2FG touch */ |
737 | if (urb->actual_length == WACOM_PKGLEN_TPC1FG) { /* with touch */ | ||
738 | prox = data[0] & 0x01; | ||
623 | } else { /* with capacity */ | 739 | } else { /* with capacity */ |
624 | prox = data[1] & 0x03; | 740 | if (data[0] == WACOM_REPORT_TPC1FG) |
741 | /* single touch */ | ||
742 | prox = data[1] & 0x01; | ||
743 | else | ||
744 | /* 2FG touch data */ | ||
745 | prox = data[1] & 0x03; | ||
625 | } | 746 | } |
626 | 747 | ||
627 | if (!stylusInProx) { /* stylus not in prox */ | 748 | if (!stylusInProx) { /* stylus not in prox */ |
628 | if (prox) { | 749 | if (prox) { |
629 | if (touchInProx) { | 750 | if (touchInProx) { |
630 | wacom->tool[1] = BTN_TOOL_DOUBLETAP; | 751 | wacom_tpc_touch_in(wacom, wcombo); |
631 | wacom->id[0] = TOUCH_DEVICE_ID; | ||
632 | if (urb->actual_length != 5) { | ||
633 | wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2])); | ||
634 | wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4])); | ||
635 | wacom_report_abs(wcombo, ABS_PRESSURE, wacom_le16_to_cpu(&data[6])); | ||
636 | wacom_report_key(wcombo, BTN_TOUCH, wacom_le16_to_cpu(&data[6])); | ||
637 | } else { | ||
638 | wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[1])); | ||
639 | wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[3])); | ||
640 | wacom_report_key(wcombo, BTN_TOUCH, 1); | ||
641 | } | ||
642 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); | ||
643 | wacom_report_key(wcombo, wacom->tool[1], prox & 0x01); | ||
644 | touchOut = 1; | 752 | touchOut = 1; |
645 | return 1; | 753 | return 1; |
646 | } | 754 | } |
647 | } else { | 755 | } else { |
648 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); | 756 | /* 2FGT out-prox */ |
649 | wacom_report_key(wcombo, wacom->tool[1], prox & 0x01); | 757 | if (data[0] == WACOM_REPORT_TPC2FG) { |
650 | wacom_report_key(wcombo, BTN_TOUCH, 0); | 758 | idx = (wacom->id[1] & 0x01) - 1; |
759 | if (idx == 0) { | ||
760 | wacom_tpc_touch_out(wacom, wcombo, idx); | ||
761 | /* sync first finger event */ | ||
762 | if (wacom->id[1] & 0x02) | ||
763 | wacom_input_sync(wcombo); | ||
764 | } | ||
765 | idx = (wacom->id[1] & 0x02) - 1; | ||
766 | if (idx == 1) | ||
767 | wacom_tpc_touch_out(wacom, wcombo, idx); | ||
768 | } else /* one finger touch */ | ||
769 | wacom_tpc_touch_out(wacom, wcombo, 0); | ||
651 | touchOut = 0; | 770 | touchOut = 0; |
652 | touchInProx = 1; | 771 | touchInProx = 1; |
653 | return 1; | 772 | return 1; |
654 | } | 773 | } |
655 | } else if (touchOut || !prox) { /* force touch out-prox */ | 774 | } else if (touchOut || !prox) { /* force touch out-prox */ |
656 | wacom_report_abs(wcombo, ABS_MISC, TOUCH_DEVICE_ID); | 775 | wacom_tpc_touch_out(wacom, wcombo, 0); |
657 | wacom_report_key(wcombo, wacom->tool[1], 0); | ||
658 | wacom_report_key(wcombo, BTN_TOUCH, 0); | ||
659 | touchOut = 0; | 776 | touchOut = 0; |
660 | touchInProx = 1; | 777 | touchInProx = 1; |
661 | return 1; | 778 | return 1; |
662 | } | 779 | } |
663 | } else if (data[0] == 2) { /* Penabled */ | 780 | } else if (data[0] == WACOM_REPORT_PENABLED) { /* Penabled */ |
664 | prox = data[1] & 0x20; | 781 | prox = data[1] & 0x20; |
665 | 782 | ||
666 | touchInProx = 0; | 783 | touchInProx = 0; |
667 | 784 | ||
668 | wacom->id[0] = ERASER_DEVICE_ID; | ||
669 | |||
670 | /* | ||
671 | * if going from out of proximity into proximity select between the eraser | ||
672 | * and the pen based on the state of the stylus2 button, choose eraser if | ||
673 | * pressed else choose pen. if not a proximity change from out to in, send | ||
674 | * an out of proximity for previous tool then a in for new tool. | ||
675 | */ | ||
676 | if (prox) { /* in prox */ | 785 | if (prox) { /* in prox */ |
677 | if (!wacom->tool[0]) { | 786 | if (!wacom->id[0]) { |
678 | /* Going into proximity select tool */ | 787 | /* Going into proximity select tool */ |
679 | wacom->tool[1] = (data[1] & 0x08) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; | 788 | wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; |
680 | if (wacom->tool[1] == BTN_TOOL_PEN) | 789 | if (wacom->tool[0] == BTN_TOOL_PEN) |
681 | wacom->id[0] = STYLUS_DEVICE_ID; | 790 | wacom->id[0] = STYLUS_DEVICE_ID; |
682 | } else if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[1] & 0x08)) { | 791 | else |
683 | /* | 792 | wacom->id[0] = ERASER_DEVICE_ID; |
684 | * was entered with stylus2 pressed | ||
685 | * report out proximity for previous tool | ||
686 | */ | ||
687 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); | ||
688 | wacom_report_key(wcombo, wacom->tool[1], 0); | ||
689 | wacom_input_sync(wcombo); | ||
690 | |||
691 | /* set new tool */ | ||
692 | wacom->tool[1] = BTN_TOOL_PEN; | ||
693 | wacom->id[0] = STYLUS_DEVICE_ID; | ||
694 | return 0; | ||
695 | } | ||
696 | if (wacom->tool[1] != BTN_TOOL_RUBBER) { | ||
697 | /* Unknown tool selected default to pen tool */ | ||
698 | wacom->tool[1] = BTN_TOOL_PEN; | ||
699 | wacom->id[0] = STYLUS_DEVICE_ID; | ||
700 | } | 793 | } |
701 | wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02); | 794 | wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02); |
702 | wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x10); | 795 | wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x10); |
@@ -704,19 +797,23 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo) | |||
704 | wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4])); | 797 | wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4])); |
705 | pressure = ((data[7] & 0x01) << 8) | data[6]; | 798 | pressure = ((data[7] & 0x01) << 8) | data[6]; |
706 | if (pressure < 0) | 799 | if (pressure < 0) |
707 | pressure = wacom->features->pressure_max + pressure + 1; | 800 | pressure = features->pressure_max + pressure + 1; |
708 | wacom_report_abs(wcombo, ABS_PRESSURE, pressure); | 801 | wacom_report_abs(wcombo, ABS_PRESSURE, pressure); |
709 | wacom_report_key(wcombo, BTN_TOUCH, pressure); | 802 | wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x05); |
710 | } else { | 803 | } else { |
804 | wacom_report_abs(wcombo, ABS_X, 0); | ||
805 | wacom_report_abs(wcombo, ABS_Y, 0); | ||
711 | wacom_report_abs(wcombo, ABS_PRESSURE, 0); | 806 | wacom_report_abs(wcombo, ABS_PRESSURE, 0); |
712 | wacom_report_key(wcombo, BTN_STYLUS, 0); | 807 | wacom_report_key(wcombo, BTN_STYLUS, 0); |
713 | wacom_report_key(wcombo, BTN_STYLUS2, 0); | 808 | wacom_report_key(wcombo, BTN_STYLUS2, 0); |
714 | wacom_report_key(wcombo, BTN_TOUCH, 0); | 809 | wacom_report_key(wcombo, BTN_TOUCH, 0); |
810 | wacom->id[0] = 0; | ||
811 | /* pen is out so touch can be enabled now */ | ||
812 | touchInProx = 1; | ||
715 | } | 813 | } |
716 | wacom_report_key(wcombo, wacom->tool[1], prox); | 814 | wacom_report_key(wcombo, wacom->tool[0], prox); |
717 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); | 815 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); |
718 | stylusInProx = prox; | 816 | stylusInProx = prox; |
719 | wacom->tool[0] = prox; | ||
720 | return 1; | 817 | return 1; |
721 | } | 818 | } |
722 | return 0; | 819 | return 0; |
@@ -724,7 +821,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo) | |||
724 | 821 | ||
725 | int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) | 822 | int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) |
726 | { | 823 | { |
727 | switch (wacom_wac->features->type) { | 824 | switch (wacom_wac->features.type) { |
728 | case PENPARTNER: | 825 | case PENPARTNER: |
729 | return wacom_penpartner_irq(wacom_wac, wcombo); | 826 | return wacom_penpartner_irq(wacom_wac, wcombo); |
730 | 827 | ||
@@ -751,6 +848,7 @@ int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) | |||
751 | return wacom_intuos_irq(wacom_wac, wcombo); | 848 | return wacom_intuos_irq(wacom_wac, wcombo); |
752 | 849 | ||
753 | case TABLETPC: | 850 | case TABLETPC: |
851 | case TABLETPC2FG: | ||
754 | return wacom_tpc_irq(wacom_wac, wcombo); | 852 | return wacom_tpc_irq(wacom_wac, wcombo); |
755 | 853 | ||
756 | default: | 854 | default: |
@@ -761,7 +859,7 @@ int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) | |||
761 | 859 | ||
762 | void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 860 | void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
763 | { | 861 | { |
764 | switch (wacom_wac->features->type) { | 862 | switch (wacom_wac->features.type) { |
765 | case WACOM_MO: | 863 | case WACOM_MO: |
766 | input_dev_mo(input_dev, wacom_wac); | 864 | input_dev_mo(input_dev, wacom_wac); |
767 | case WACOM_G4: | 865 | case WACOM_G4: |
@@ -791,9 +889,17 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w | |||
791 | input_dev_i4s(input_dev, wacom_wac); | 889 | input_dev_i4s(input_dev, wacom_wac); |
792 | input_dev_i(input_dev, wacom_wac); | 890 | input_dev_i(input_dev, wacom_wac); |
793 | break; | 891 | break; |
892 | case TABLETPC2FG: | ||
893 | input_dev_tpc2fg(input_dev, wacom_wac); | ||
894 | /* fall through */ | ||
895 | case TABLETPC: | ||
896 | input_dev_tpc(input_dev, wacom_wac); | ||
897 | if (wacom_wac->features.device_type != BTN_TOOL_PEN) | ||
898 | break; /* no need to process stylus stuff */ | ||
899 | |||
900 | /* fall through */ | ||
794 | case PL: | 901 | case PL: |
795 | case PTU: | 902 | case PTU: |
796 | case TABLETPC: | ||
797 | input_dev_pl(input_dev, wacom_wac); | 903 | input_dev_pl(input_dev, wacom_wac); |
798 | /* fall through */ | 904 | /* fall through */ |
799 | case PENPARTNER: | 905 | case PENPARTNER: |
@@ -803,147 +909,201 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w | |||
803 | return; | 909 | return; |
804 | } | 910 | } |
805 | 911 | ||
806 | static struct wacom_features wacom_features[] = { | 912 | static const struct wacom_features wacom_features_0x00 = |
807 | { "Wacom Penpartner", 7, 5040, 3780, 255, 0, PENPARTNER }, | 913 | { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, 0, PENPARTNER }; |
808 | { "Wacom Graphire", 8, 10206, 7422, 511, 63, GRAPHIRE }, | 914 | static const struct wacom_features wacom_features_0x10 = |
809 | { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 63, GRAPHIRE }, | 915 | { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }; |
810 | { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 63, GRAPHIRE }, | 916 | static const struct wacom_features wacom_features_0x11 = |
811 | { "Wacom Graphire3", 8, 10208, 7424, 511, 63, GRAPHIRE }, | 917 | { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }; |
812 | { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 63, GRAPHIRE }, | 918 | static const struct wacom_features wacom_features_0x12 = |
813 | { "Wacom Graphire4 4x5", 8, 10208, 7424, 511, 63, WACOM_G4 }, | 919 | { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, 63, GRAPHIRE }; |
814 | { "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 63, WACOM_G4 }, | 920 | static const struct wacom_features wacom_features_0x13 = |
815 | { "Wacom BambooFun 4x5", 9, 14760, 9225, 511, 63, WACOM_MO }, | 921 | { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, GRAPHIRE }; |
816 | { "Wacom BambooFun 6x8", 9, 21648, 13530, 511, 63, WACOM_MO }, | 922 | static const struct wacom_features wacom_features_0x14 = |
817 | { "Wacom Bamboo1 Medium",8, 16704, 12064, 511, 63, GRAPHIRE }, | 923 | { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }; |
818 | { "Wacom Volito", 8, 5104, 3712, 511, 63, GRAPHIRE }, | 924 | static const struct wacom_features wacom_features_0x15 = |
819 | { "Wacom PenStation2", 8, 3250, 2320, 255, 63, GRAPHIRE }, | 925 | { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, WACOM_G4 }; |
820 | { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 63, GRAPHIRE }, | 926 | static const struct wacom_features wacom_features_0x16 = |
821 | { "Wacom Volito2 2x3", 8, 3248, 2320, 511, 63, GRAPHIRE }, | 927 | { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, WACOM_G4 }; |
822 | { "Wacom PenPartner2", 8, 3250, 2320, 511, 63, GRAPHIRE }, | 928 | static const struct wacom_features wacom_features_0x17 = |
823 | { "Wacom Bamboo", 9, 14760, 9225, 511, 63, WACOM_MO }, | 929 | { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }; |
824 | { "Wacom Bamboo1", 8, 5104, 3712, 511, 63, GRAPHIRE }, | 930 | static const struct wacom_features wacom_features_0x18 = |
825 | { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 31, INTUOS }, | 931 | { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, 63, WACOM_MO }; |
826 | { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, | 932 | static const struct wacom_features wacom_features_0x19 = |
827 | { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 31, INTUOS }, | 933 | { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }; |
828 | { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 31, INTUOS }, | 934 | static const struct wacom_features wacom_features_0x60 = |
829 | { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 31, INTUOS }, | 935 | { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; |
830 | { "Wacom PL400", 8, 5408, 4056, 255, 0, PL }, | 936 | static const struct wacom_features wacom_features_0x61 = |
831 | { "Wacom PL500", 8, 6144, 4608, 255, 0, PL }, | 937 | { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, 63, GRAPHIRE }; |
832 | { "Wacom PL600", 8, 6126, 4604, 255, 0, PL }, | 938 | static const struct wacom_features wacom_features_0x62 = |
833 | { "Wacom PL600SX", 8, 6260, 5016, 255, 0, PL }, | 939 | { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; |
834 | { "Wacom PL550", 8, 6144, 4608, 511, 0, PL }, | 940 | static const struct wacom_features wacom_features_0x63 = |
835 | { "Wacom PL800", 8, 7220, 5780, 511, 0, PL }, | 941 | { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, 63, GRAPHIRE }; |
836 | { "Wacom PL700", 8, 6758, 5406, 511, 0, PL }, | 942 | static const struct wacom_features wacom_features_0x64 = |
837 | { "Wacom PL510", 8, 6282, 4762, 511, 0, PL }, | 943 | { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, 63, GRAPHIRE }; |
838 | { "Wacom DTU710", 8, 34080, 27660, 511, 0, PL }, | 944 | static const struct wacom_features wacom_features_0x65 = |
839 | { "Wacom DTF521", 8, 6282, 4762, 511, 0, PL }, | 945 | { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }; |
840 | { "Wacom DTF720", 8, 6858, 5506, 511, 0, PL }, | 946 | static const struct wacom_features wacom_features_0x69 = |
841 | { "Wacom DTF720a", 8, 6858, 5506, 511, 0, PL }, | 947 | { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; |
842 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 0, PTU }, | 948 | static const struct wacom_features wacom_features_0x20 = |
843 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 31, INTUOS }, | 949 | { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }; |
844 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, | 950 | static const struct wacom_features wacom_features_0x21 = |
845 | { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 31, INTUOS }, | 951 | { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; |
846 | { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 31, INTUOS }, | 952 | static const struct wacom_features wacom_features_0x22 = |
847 | { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 31, INTUOS }, | 953 | { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }; |
848 | { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 63, INTUOS3S }, | 954 | static const struct wacom_features wacom_features_0x23 = |
849 | { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 63, INTUOS3 }, | 955 | { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }; |
850 | { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 63, INTUOS3 }, | 956 | static const struct wacom_features wacom_features_0x24 = |
851 | { "Wacom Intuos3 12x12", 10, 60960, 60960, 1023, 63, INTUOS3L }, | 957 | { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }; |
852 | { "Wacom Intuos3 12x19", 10, 97536, 60960, 1023, 63, INTUOS3L }, | 958 | static const struct wacom_features wacom_features_0x30 = |
853 | { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 63, INTUOS3 }, | 959 | { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, 0, PL }; |
854 | { "Wacom Intuos3 4x6", 10, 31496, 19685, 1023, 63, INTUOS3S }, | 960 | static const struct wacom_features wacom_features_0x31 = |
855 | { "Wacom Intuos4 4x6", 10, 31496, 19685, 2047, 63, INTUOS4S }, | 961 | { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, 0, PL }; |
856 | { "Wacom Intuos4 6x9", 10, 44704, 27940, 2047, 63, INTUOS4 }, | 962 | static const struct wacom_features wacom_features_0x32 = |
857 | { "Wacom Intuos4 8x13", 10, 65024, 40640, 2047, 63, INTUOS4L }, | 963 | { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, 0, PL }; |
858 | { "Wacom Intuos4 12x19", 10, 97536, 60960, 2047, 63, INTUOS4L }, | 964 | static const struct wacom_features wacom_features_0x33 = |
859 | { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, CINTIQ }, | 965 | { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255, 0, PL }; |
860 | { "Wacom Cintiq 20WSX", 10, 86680, 54180, 1023, 63, WACOM_BEE }, | 966 | static const struct wacom_features wacom_features_0x34 = |
861 | { "Wacom Cintiq 12WX", 10, 53020, 33440, 1023, 63, WACOM_BEE }, | 967 | { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511, 0, PL }; |
862 | { "Wacom DTU1931", 8, 37832, 30305, 511, 0, PL }, | 968 | static const struct wacom_features wacom_features_0x35 = |
863 | { "Wacom ISDv4 90", 8, 26202, 16325, 255, 0, TABLETPC }, | 969 | { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511, 0, PL }; |
864 | { "Wacom ISDv4 93", 8, 26202, 16325, 255, 0, TABLETPC }, | 970 | static const struct wacom_features wacom_features_0x37 = |
865 | { "Wacom ISDv4 9A", 8, 26202, 16325, 255, 0, TABLETPC }, | 971 | { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511, 0, PL }; |
866 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, | 972 | static const struct wacom_features wacom_features_0x38 = |
867 | { } | 973 | { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }; |
868 | }; | 974 | static const struct wacom_features wacom_features_0x39 = |
869 | 975 | { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511, 0, PL }; | |
870 | static struct usb_device_id wacom_ids[] = { | 976 | static const struct wacom_features wacom_features_0xC4 = |
871 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x00) }, | 977 | { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }; |
872 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x10) }, | 978 | static const struct wacom_features wacom_features_0xC0 = |
873 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x11) }, | 979 | { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }; |
874 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x12) }, | 980 | static const struct wacom_features wacom_features_0xC2 = |
875 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x13) }, | 981 | { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }; |
876 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x14) }, | 982 | static const struct wacom_features wacom_features_0x03 = |
877 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x15) }, | 983 | { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511, 0, PTU }; |
878 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x16) }, | 984 | static const struct wacom_features wacom_features_0x41 = |
879 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x17) }, | 985 | { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }; |
880 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x18) }, | 986 | static const struct wacom_features wacom_features_0x42 = |
881 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x19) }, | 987 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; |
882 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) }, | 988 | static const struct wacom_features wacom_features_0x43 = |
883 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x61) }, | 989 | { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }; |
884 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) }, | 990 | static const struct wacom_features wacom_features_0x44 = |
885 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x63) }, | 991 | { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }; |
886 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x64) }, | 992 | static const struct wacom_features wacom_features_0x45 = |
887 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x65) }, | 993 | { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }; |
888 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x69) }, | 994 | static const struct wacom_features wacom_features_0xB0 = |
889 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x20) }, | 995 | { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023, 63, INTUOS3S }; |
890 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x21) }, | 996 | static const struct wacom_features wacom_features_0xB1 = |
891 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x22) }, | 997 | { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023, 63, INTUOS3 }; |
892 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x23) }, | 998 | static const struct wacom_features wacom_features_0xB2 = |
893 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x24) }, | 999 | { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023, 63, INTUOS3 }; |
894 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x30) }, | 1000 | static const struct wacom_features wacom_features_0xB3 = |
895 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x31) }, | 1001 | { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023, 63, INTUOS3L }; |
896 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x32) }, | 1002 | static const struct wacom_features wacom_features_0xB4 = |
897 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x33) }, | 1003 | { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023, 63, INTUOS3L }; |
898 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x34) }, | 1004 | static const struct wacom_features wacom_features_0xB5 = |
899 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x35) }, | 1005 | { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023, 63, INTUOS3 }; |
900 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x37) }, | 1006 | static const struct wacom_features wacom_features_0xB7 = |
901 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) }, | 1007 | { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023, 63, INTUOS3S }; |
902 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) }, | 1008 | static const struct wacom_features wacom_features_0xB8 = |
903 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC4) }, | 1009 | { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, 63, INTUOS4S }; |
904 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) }, | 1010 | static const struct wacom_features wacom_features_0xB9 = |
905 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC2) }, | 1011 | { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, 63, INTUOS4 }; |
906 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, | 1012 | static const struct wacom_features wacom_features_0xBA = |
907 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) }, | 1013 | { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 63, INTUOS4L }; |
908 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) }, | 1014 | static const struct wacom_features wacom_features_0xBB = |
909 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x43) }, | 1015 | { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, 63, INTUOS4L }; |
910 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x44) }, | 1016 | static const struct wacom_features wacom_features_0x3F = |
911 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x45) }, | 1017 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 63, CINTIQ }; |
912 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) }, | 1018 | static const struct wacom_features wacom_features_0xC5 = |
913 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) }, | 1019 | { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023, 63, WACOM_BEE }; |
914 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) }, | 1020 | static const struct wacom_features wacom_features_0xC6 = |
915 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB3) }, | 1021 | { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, 63, WACOM_BEE }; |
916 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB4) }, | 1022 | static const struct wacom_features wacom_features_0xC7 = |
917 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) }, | 1023 | { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, 0, PL }; |
918 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB7) }, | 1024 | static const struct wacom_features wacom_features_0x90 = |
919 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB8) }, | 1025 | { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; |
920 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB9) }, | 1026 | static const struct wacom_features wacom_features_0x93 = |
921 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xBA) }, | 1027 | { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; |
922 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xBB) }, | 1028 | static const struct wacom_features wacom_features_0x9A = |
923 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, | 1029 | { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; |
924 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC5) }, | 1030 | static const struct wacom_features wacom_features_0x9F = |
925 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC6) }, | 1031 | { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; |
926 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC7) }, | 1032 | static const struct wacom_features wacom_features_0xE2 = |
927 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x90) }, | 1033 | { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; |
928 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x93) }, | 1034 | static const struct wacom_features wacom_features_0xE3 = |
929 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x9A) }, | 1035 | { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; |
930 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, | 1036 | static const struct wacom_features wacom_features_0x47 = |
1037 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; | ||
1038 | |||
1039 | #define USB_DEVICE_WACOM(prod) \ | ||
1040 | USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ | ||
1041 | .driver_info = (kernel_ulong_t)&wacom_features_##prod | ||
1042 | |||
1043 | const struct usb_device_id wacom_ids[] = { | ||
1044 | { USB_DEVICE_WACOM(0x00) }, | ||
1045 | { USB_DEVICE_WACOM(0x10) }, | ||
1046 | { USB_DEVICE_WACOM(0x11) }, | ||
1047 | { USB_DEVICE_WACOM(0x12) }, | ||
1048 | { USB_DEVICE_WACOM(0x13) }, | ||
1049 | { USB_DEVICE_WACOM(0x14) }, | ||
1050 | { USB_DEVICE_WACOM(0x15) }, | ||
1051 | { USB_DEVICE_WACOM(0x16) }, | ||
1052 | { USB_DEVICE_WACOM(0x17) }, | ||
1053 | { USB_DEVICE_WACOM(0x18) }, | ||
1054 | { USB_DEVICE_WACOM(0x19) }, | ||
1055 | { USB_DEVICE_WACOM(0x60) }, | ||
1056 | { USB_DEVICE_WACOM(0x61) }, | ||
1057 | { USB_DEVICE_WACOM(0x62) }, | ||
1058 | { USB_DEVICE_WACOM(0x63) }, | ||
1059 | { USB_DEVICE_WACOM(0x64) }, | ||
1060 | { USB_DEVICE_WACOM(0x65) }, | ||
1061 | { USB_DEVICE_WACOM(0x69) }, | ||
1062 | { USB_DEVICE_WACOM(0x20) }, | ||
1063 | { USB_DEVICE_WACOM(0x21) }, | ||
1064 | { USB_DEVICE_WACOM(0x22) }, | ||
1065 | { USB_DEVICE_WACOM(0x23) }, | ||
1066 | { USB_DEVICE_WACOM(0x24) }, | ||
1067 | { USB_DEVICE_WACOM(0x30) }, | ||
1068 | { USB_DEVICE_WACOM(0x31) }, | ||
1069 | { USB_DEVICE_WACOM(0x32) }, | ||
1070 | { USB_DEVICE_WACOM(0x33) }, | ||
1071 | { USB_DEVICE_WACOM(0x34) }, | ||
1072 | { USB_DEVICE_WACOM(0x35) }, | ||
1073 | { USB_DEVICE_WACOM(0x37) }, | ||
1074 | { USB_DEVICE_WACOM(0x38) }, | ||
1075 | { USB_DEVICE_WACOM(0x39) }, | ||
1076 | { USB_DEVICE_WACOM(0xC4) }, | ||
1077 | { USB_DEVICE_WACOM(0xC0) }, | ||
1078 | { USB_DEVICE_WACOM(0xC2) }, | ||
1079 | { USB_DEVICE_WACOM(0x03) }, | ||
1080 | { USB_DEVICE_WACOM(0x41) }, | ||
1081 | { USB_DEVICE_WACOM(0x42) }, | ||
1082 | { USB_DEVICE_WACOM(0x43) }, | ||
1083 | { USB_DEVICE_WACOM(0x44) }, | ||
1084 | { USB_DEVICE_WACOM(0x45) }, | ||
1085 | { USB_DEVICE_WACOM(0xB0) }, | ||
1086 | { USB_DEVICE_WACOM(0xB1) }, | ||
1087 | { USB_DEVICE_WACOM(0xB2) }, | ||
1088 | { USB_DEVICE_WACOM(0xB3) }, | ||
1089 | { USB_DEVICE_WACOM(0xB4) }, | ||
1090 | { USB_DEVICE_WACOM(0xB5) }, | ||
1091 | { USB_DEVICE_WACOM(0xB7) }, | ||
1092 | { USB_DEVICE_WACOM(0xB8) }, | ||
1093 | { USB_DEVICE_WACOM(0xB9) }, | ||
1094 | { USB_DEVICE_WACOM(0xBA) }, | ||
1095 | { USB_DEVICE_WACOM(0xBB) }, | ||
1096 | { USB_DEVICE_WACOM(0x3F) }, | ||
1097 | { USB_DEVICE_WACOM(0xC5) }, | ||
1098 | { USB_DEVICE_WACOM(0xC6) }, | ||
1099 | { USB_DEVICE_WACOM(0xC7) }, | ||
1100 | { USB_DEVICE_WACOM(0x90) }, | ||
1101 | { USB_DEVICE_WACOM(0x93) }, | ||
1102 | { USB_DEVICE_WACOM(0x9A) }, | ||
1103 | { USB_DEVICE_WACOM(0x9F) }, | ||
1104 | { USB_DEVICE_WACOM(0xE2) }, | ||
1105 | { USB_DEVICE_WACOM(0xE3) }, | ||
1106 | { USB_DEVICE_WACOM(0x47) }, | ||
931 | { } | 1107 | { } |
932 | }; | 1108 | }; |
933 | |||
934 | const struct usb_device_id *get_device_table(void) | ||
935 | { | ||
936 | const struct usb_device_id *id_table = wacom_ids; | ||
937 | |||
938 | return id_table; | ||
939 | } | ||
940 | |||
941 | struct wacom_features * get_wacom_feature(const struct usb_device_id *id) | ||
942 | { | ||
943 | int index = id - wacom_ids; | ||
944 | struct wacom_features *wf = &wacom_features[index]; | ||
945 | |||
946 | return wf; | ||
947 | } | ||
948 | |||
949 | MODULE_DEVICE_TABLE(usb, wacom_ids); | 1109 | MODULE_DEVICE_TABLE(usb, wacom_ids); |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index c10235aba7e5..b50cf04e61a8 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
@@ -9,12 +9,32 @@ | |||
9 | #ifndef WACOM_WAC_H | 9 | #ifndef WACOM_WAC_H |
10 | #define WACOM_WAC_H | 10 | #define WACOM_WAC_H |
11 | 11 | ||
12 | /* maximum packet length for USB devices */ | ||
13 | #define WACOM_PKGLEN_MAX 32 | ||
14 | |||
15 | /* packet length for individual models */ | ||
16 | #define WACOM_PKGLEN_PENPRTN 7 | ||
17 | #define WACOM_PKGLEN_GRAPHIRE 8 | ||
18 | #define WACOM_PKGLEN_BBFUN 9 | ||
19 | #define WACOM_PKGLEN_INTUOS 10 | ||
20 | #define WACOM_PKGLEN_TPC1FG 5 | ||
21 | #define WACOM_PKGLEN_TPC2FG 14 | ||
22 | |||
23 | /* device IDs */ | ||
12 | #define STYLUS_DEVICE_ID 0x02 | 24 | #define STYLUS_DEVICE_ID 0x02 |
13 | #define TOUCH_DEVICE_ID 0x03 | 25 | #define TOUCH_DEVICE_ID 0x03 |
14 | #define CURSOR_DEVICE_ID 0x06 | 26 | #define CURSOR_DEVICE_ID 0x06 |
15 | #define ERASER_DEVICE_ID 0x0A | 27 | #define ERASER_DEVICE_ID 0x0A |
16 | #define PAD_DEVICE_ID 0x0F | 28 | #define PAD_DEVICE_ID 0x0F |
17 | 29 | ||
30 | /* wacom data packet report IDs */ | ||
31 | #define WACOM_REPORT_PENABLED 2 | ||
32 | #define WACOM_REPORT_INTUOSREAD 5 | ||
33 | #define WACOM_REPORT_INTUOSWRITE 6 | ||
34 | #define WACOM_REPORT_INTUOSPAD 12 | ||
35 | #define WACOM_REPORT_TPC1FG 6 | ||
36 | #define WACOM_REPORT_TPC2FG 13 | ||
37 | |||
18 | enum { | 38 | enum { |
19 | PENPARTNER = 0, | 39 | PENPARTNER = 0, |
20 | GRAPHIRE, | 40 | GRAPHIRE, |
@@ -32,27 +52,32 @@ enum { | |||
32 | WACOM_BEE, | 52 | WACOM_BEE, |
33 | WACOM_MO, | 53 | WACOM_MO, |
34 | TABLETPC, | 54 | TABLETPC, |
55 | TABLETPC2FG, | ||
35 | MAX_TYPE | 56 | MAX_TYPE |
36 | }; | 57 | }; |
37 | 58 | ||
38 | struct wacom_features { | 59 | struct wacom_features { |
39 | char *name; | 60 | const char *name; |
40 | int pktlen; | 61 | int pktlen; |
41 | int x_max; | 62 | int x_max; |
42 | int y_max; | 63 | int y_max; |
43 | int pressure_max; | 64 | int pressure_max; |
44 | int distance_max; | 65 | int distance_max; |
45 | int type; | 66 | int type; |
46 | int touch_x_max; | 67 | int device_type; |
47 | int touch_y_max; | 68 | int x_phy; |
69 | int y_phy; | ||
70 | unsigned char unit; | ||
71 | unsigned char unitExpo; | ||
48 | }; | 72 | }; |
49 | 73 | ||
50 | struct wacom_wac { | 74 | struct wacom_wac { |
75 | char name[64]; | ||
51 | unsigned char *data; | 76 | unsigned char *data; |
52 | int tool[2]; | 77 | int tool[2]; |
53 | int id[2]; | 78 | int id[2]; |
54 | __u32 serial[2]; | 79 | __u32 serial[2]; |
55 | struct wacom_features *features; | 80 | struct wacom_features features; |
56 | }; | 81 | }; |
57 | 82 | ||
58 | #endif | 83 | #endif |