diff options
-rw-r--r-- | drivers/usb/input/wacom_wac.c | 103 | ||||
-rw-r--r-- | drivers/usb/input/wacom_wac.h | 1 |
2 files changed, 65 insertions, 39 deletions
diff --git a/drivers/usb/input/wacom_wac.c b/drivers/usb/input/wacom_wac.c index 4142e36730fc..4f3e9bc7177d 100644 --- a/drivers/usb/input/wacom_wac.c +++ b/drivers/usb/input/wacom_wac.c | |||
@@ -163,7 +163,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
163 | } | 163 | } |
164 | 164 | ||
165 | id = STYLUS_DEVICE_ID; | 165 | id = STYLUS_DEVICE_ID; |
166 | if (data[1] & 0x10) { /* in prox */ | 166 | if (data[1] & 0x80) { /* in prox */ |
167 | 167 | ||
168 | switch ((data[1] >> 5) & 3) { | 168 | switch ((data[1] >> 5) & 3) { |
169 | 169 | ||
@@ -196,9 +196,6 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
196 | wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f); | 196 | wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f); |
197 | break; | 197 | break; |
198 | } | 198 | } |
199 | } | ||
200 | |||
201 | if (data[1] & 0x90) { | ||
202 | x = wacom_le16_to_cpu(&data[2]); | 199 | x = wacom_le16_to_cpu(&data[2]); |
203 | y = wacom_le16_to_cpu(&data[4]); | 200 | y = wacom_le16_to_cpu(&data[4]); |
204 | wacom_report_abs(wcombo, ABS_X, x); | 201 | wacom_report_abs(wcombo, ABS_X, x); |
@@ -210,19 +207,28 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
210 | wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x04); | 207 | wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x04); |
211 | } | 208 | } |
212 | wacom_report_abs(wcombo, ABS_MISC, id); /* report tool id */ | 209 | wacom_report_abs(wcombo, ABS_MISC, id); /* report tool id */ |
213 | } | ||
214 | else | ||
215 | wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ | ||
216 | |||
217 | if (data[1] & 0x10) /* only report prox-in when in area */ | ||
218 | wacom_report_key(wcombo, wacom->tool[0], 1); | 210 | wacom_report_key(wcombo, wacom->tool[0], 1); |
219 | if (!(data[1] & 0x90)) /* report prox-out when physically out */ | 211 | } else if (!(data[1] & 0x90)) { |
212 | wacom_report_abs(wcombo, ABS_X, 0); | ||
213 | wacom_report_abs(wcombo, ABS_Y, 0); | ||
214 | if (wacom->tool[0] == BTN_TOOL_MOUSE) { | ||
215 | wacom_report_key(wcombo, BTN_LEFT, 0); | ||
216 | wacom_report_key(wcombo, BTN_RIGHT, 0); | ||
217 | wacom_report_abs(wcombo, ABS_DISTANCE, 0); | ||
218 | } else { | ||
219 | wacom_report_abs(wcombo, ABS_PRESSURE, 0); | ||
220 | wacom_report_key(wcombo, BTN_TOUCH, 0); | ||
221 | wacom_report_key(wcombo, BTN_STYLUS, 0); | ||
222 | wacom_report_key(wcombo, BTN_STYLUS2, 0); | ||
223 | } | ||
224 | wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ | ||
220 | wacom_report_key(wcombo, wacom->tool[0], 0); | 225 | wacom_report_key(wcombo, wacom->tool[0], 0); |
221 | wacom_input_sync(wcombo); | 226 | } |
222 | 227 | ||
223 | /* send pad data */ | 228 | /* send pad data */ |
224 | if (wacom->features->type == WACOM_G4) { | 229 | if (wacom->features->type == WACOM_G4) { |
225 | if ( (wacom->serial[1] & 0xc0) != (data[7] & 0xf8) ) { | 230 | if (data[7] & 0xf8) { |
231 | wacom_input_sync(wcombo); /* sync last event */ | ||
226 | wacom->id[1] = 1; | 232 | wacom->id[1] = 1; |
227 | wacom->serial[1] = (data[7] & 0xf8); | 233 | wacom->serial[1] = (data[7] & 0xf8); |
228 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); | 234 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); |
@@ -230,10 +236,15 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
230 | rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); | 236 | rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); |
231 | wacom_report_rel(wcombo, REL_WHEEL, rw); | 237 | wacom_report_rel(wcombo, REL_WHEEL, rw); |
232 | wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0); | 238 | wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0); |
239 | wacom_report_abs(wcombo, ABS_MISC, PAD_DEVICE_ID); | ||
233 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); | 240 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); |
234 | } else if (wacom->id[1]) { | 241 | } else if (wacom->id[1]) { |
242 | wacom_input_sync(wcombo); /* sync last event */ | ||
235 | wacom->id[1] = 0; | 243 | wacom->id[1] = 0; |
244 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); | ||
245 | wacom_report_key(wcombo, BTN_4, (data[7] & 0x80)); | ||
236 | wacom_report_key(wcombo, BTN_TOOL_FINGER, 0); | 246 | wacom_report_key(wcombo, BTN_TOOL_FINGER, 0); |
247 | wacom_report_abs(wcombo, ABS_MISC, 0); | ||
237 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); | 248 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); |
238 | } | 249 | } |
239 | } | 250 | } |
@@ -304,28 +315,35 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | |||
304 | default: /* Unknown tool */ | 315 | default: /* Unknown tool */ |
305 | wacom->tool[idx] = BTN_TOOL_PEN; | 316 | wacom->tool[idx] = BTN_TOOL_PEN; |
306 | } | 317 | } |
307 | /* only large I3 support Lens Cursor */ | ||
308 | if(!((wacom->tool[idx] == BTN_TOOL_LENS) | ||
309 | && ((wacom->features->type == INTUOS3) | ||
310 | || (wacom->features->type == INTUOS3S)))) { | ||
311 | wacom_report_abs(wcombo, ABS_MISC, wacom->id[idx]); /* report tool id */ | ||
312 | wacom_report_key(wcombo, wacom->tool[idx], 1); | ||
313 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | ||
314 | return 2; | ||
315 | } | ||
316 | return 1; | 318 | return 1; |
317 | } | 319 | } |
318 | 320 | ||
319 | /* Exit report */ | 321 | /* Exit report */ |
320 | if ((data[1] & 0xfe) == 0x80) { | 322 | if ((data[1] & 0xfe) == 0x80) { |
321 | if(!((wacom->tool[idx] == BTN_TOOL_LENS) | 323 | wacom_report_abs(wcombo, ABS_X, 0); |
322 | && ((wacom->features->type == INTUOS3) | 324 | wacom_report_abs(wcombo, ABS_Y, 0); |
323 | || (wacom->features->type == INTUOS3S)))) { | 325 | wacom_report_abs(wcombo, ABS_DISTANCE, 0); |
324 | wacom_report_key(wcombo, wacom->tool[idx], 0); | 326 | if (wacom->tool[idx] >= BTN_TOOL_MOUSE) { |
325 | wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ | 327 | wacom_report_key(wcombo, BTN_LEFT, 0); |
326 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | 328 | wacom_report_key(wcombo, BTN_MIDDLE, 0); |
327 | return 2; | 329 | wacom_report_key(wcombo, BTN_RIGHT, 0); |
330 | wacom_report_key(wcombo, BTN_SIDE, 0); | ||
331 | wacom_report_key(wcombo, BTN_EXTRA, 0); | ||
332 | wacom_report_abs(wcombo, ABS_THROTTLE, 0); | ||
333 | wacom_report_abs(wcombo, ABS_RZ, 0); | ||
334 | } else { | ||
335 | wacom_report_abs(wcombo, ABS_PRESSURE, 0); | ||
336 | wacom_report_abs(wcombo, ABS_TILT_X, 0); | ||
337 | wacom_report_abs(wcombo, ABS_TILT_Y, 0); | ||
338 | wacom_report_key(wcombo, BTN_STYLUS, 0); | ||
339 | wacom_report_key(wcombo, BTN_STYLUS2, 0); | ||
340 | wacom_report_key(wcombo, BTN_TOUCH, 0); | ||
341 | wacom_report_abs(wcombo, ABS_WHEEL, 0); | ||
328 | } | 342 | } |
343 | wacom_report_key(wcombo, wacom->tool[idx], 0); | ||
344 | wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ | ||
345 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | ||
346 | return 2; | ||
329 | } | 347 | } |
330 | return 0; | 348 | return 0; |
331 | } | 349 | } |
@@ -394,6 +412,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
394 | wacom_report_key(wcombo, wacom->tool[1], 1); | 412 | wacom_report_key(wcombo, wacom->tool[1], 1); |
395 | else | 413 | else |
396 | wacom_report_key(wcombo, wacom->tool[1], 0); | 414 | wacom_report_key(wcombo, wacom->tool[1], 0); |
415 | wacom_report_abs(wcombo, ABS_MISC, PAD_DEVICE_ID); | ||
397 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xffffffff); | 416 | wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xffffffff); |
398 | return 1; | 417 | return 1; |
399 | } | 418 | } |
@@ -403,6 +422,12 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
403 | if (result) | 422 | if (result) |
404 | return result-1; | 423 | return result-1; |
405 | 424 | ||
425 | /* Only large I3 and I1 & I2 support Lense Cursor */ | ||
426 | if((wacom->tool[idx] == BTN_TOOL_LENS) | ||
427 | && ((wacom->features->type == INTUOS3) | ||
428 | || (wacom->features->type == INTUOS3S))) | ||
429 | return 0; | ||
430 | |||
406 | /* Cintiq doesn't send data when RDY bit isn't set */ | 431 | /* Cintiq doesn't send data when RDY bit isn't set */ |
407 | if ((wacom->features->type == CINTIQ) && !(data[1] & 0x40)) | 432 | if ((wacom->features->type == CINTIQ) && !(data[1] & 0x40)) |
408 | return 0; | 433 | return 0; |
@@ -554,11 +579,11 @@ static struct wacom_features wacom_features[] = { | |||
554 | { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 63, GRAPHIRE }, | 579 | { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 63, GRAPHIRE }, |
555 | { "Wacom Volito2 2x3", 8, 3248, 2320, 511, 63, GRAPHIRE }, | 580 | { "Wacom Volito2 2x3", 8, 3248, 2320, 511, 63, GRAPHIRE }, |
556 | { "Wacom PenPartner2", 8, 3250, 2320, 255, 63, GRAPHIRE }, | 581 | { "Wacom PenPartner2", 8, 3250, 2320, 255, 63, GRAPHIRE }, |
557 | { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 63, INTUOS }, | 582 | { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 31, INTUOS }, |
558 | { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 63, INTUOS }, | 583 | { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, |
559 | { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 63, INTUOS }, | 584 | { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 31, INTUOS }, |
560 | { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 63, INTUOS }, | 585 | { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 31, INTUOS }, |
561 | { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 63, INTUOS }, | 586 | { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 31, INTUOS }, |
562 | { "Wacom PL400", 8, 5408, 4056, 255, 0, PL }, | 587 | { "Wacom PL400", 8, 5408, 4056, 255, 0, PL }, |
563 | { "Wacom PL500", 8, 6144, 4608, 255, 0, PL }, | 588 | { "Wacom PL500", 8, 6144, 4608, 255, 0, PL }, |
564 | { "Wacom PL600", 8, 6126, 4604, 255, 0, PL }, | 589 | { "Wacom PL600", 8, 6126, 4604, 255, 0, PL }, |
@@ -571,11 +596,11 @@ static struct wacom_features wacom_features[] = { | |||
571 | { "Wacom DTF521", 8, 6282, 4762, 511, 0, PL }, | 596 | { "Wacom DTF521", 8, 6282, 4762, 511, 0, PL }, |
572 | { "Wacom DTF720", 8, 6858, 5506, 511, 0, PL }, | 597 | { "Wacom DTF720", 8, 6858, 5506, 511, 0, PL }, |
573 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 0, PTU }, | 598 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 0, PTU }, |
574 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 63, INTUOS }, | 599 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 31, INTUOS }, |
575 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 63, INTUOS }, | 600 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, |
576 | { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 63, INTUOS }, | 601 | { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 31, INTUOS }, |
577 | { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 63, INTUOS }, | 602 | { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 31, INTUOS }, |
578 | { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 63, INTUOS }, | 603 | { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 31, INTUOS }, |
579 | { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 63, INTUOS3S }, | 604 | { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 63, INTUOS3S }, |
580 | { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 63, INTUOS3 }, | 605 | { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 63, INTUOS3 }, |
581 | { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 63, INTUOS3 }, | 606 | { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 63, INTUOS3 }, |
@@ -584,7 +609,7 @@ static struct wacom_features wacom_features[] = { | |||
584 | { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 63, INTUOS3 }, | 609 | { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 63, INTUOS3 }, |
585 | { "Wacom Intuos3 4x6", 10, 31496, 19685, 1023, 63, INTUOS3S }, | 610 | { "Wacom Intuos3 4x6", 10, 31496, 19685, 1023, 63, INTUOS3S }, |
586 | { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, CINTIQ }, | 611 | { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, CINTIQ }, |
587 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 63, INTUOS }, | 612 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, |
588 | { } | 613 | { } |
589 | }; | 614 | }; |
590 | 615 | ||
diff --git a/drivers/usb/input/wacom_wac.h b/drivers/usb/input/wacom_wac.h index a1d9ce007970..a23022287248 100644 --- a/drivers/usb/input/wacom_wac.h +++ b/drivers/usb/input/wacom_wac.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #define STYLUS_DEVICE_ID 0x02 | 12 | #define STYLUS_DEVICE_ID 0x02 |
13 | #define CURSOR_DEVICE_ID 0x06 | 13 | #define CURSOR_DEVICE_ID 0x06 |
14 | #define ERASER_DEVICE_ID 0x0A | 14 | #define ERASER_DEVICE_ID 0x0A |
15 | #define PAD_DEVICE_ID 0x0F | ||
15 | 16 | ||
16 | enum { | 17 | enum { |
17 | PENPARTNER = 0, | 18 | PENPARTNER = 0, |