aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-06-06 03:28:29 -0400
committerDmitry Torokhov <dtor_core@ameritech.net>2005-06-06 03:28:29 -0400
commite5119885f00874453e837e3407014b73de2f4741 (patch)
treedf0a756b78ffcb2ec298bea68e213781f5897be9 /drivers
parentb2f86369e3e999a70f98e2a812aa5ec1b3c7bd0b (diff)
Input: wacom - fix formatting in accordance to CodingStyle
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/input/wacom.c123
1 files changed, 52 insertions, 71 deletions
diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c
index 60df242ba67f..f6b34af66b3d 100644
--- a/drivers/usb/input/wacom.c
+++ b/drivers/usb/input/wacom.c
@@ -178,8 +178,7 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs)
178 if (!wacom->tool[0]) { 178 if (!wacom->tool[0]) {
179 /* Going into proximity select tool */ 179 /* Going into proximity select tool */
180 wacom->tool[1] = (data[4] & 0x20)? BTN_TOOL_RUBBER : BTN_TOOL_PEN; 180 wacom->tool[1] = (data[4] & 0x20)? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
181 } 181 } else {
182 else {
183 /* was entered with stylus2 pressed */ 182 /* was entered with stylus2 pressed */
184 if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20) ) { 183 if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20) ) {
185 /* report out proximity for previous tool */ 184 /* report out proximity for previous tool */
@@ -202,8 +201,7 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs)
202 input_report_key(dev, BTN_STYLUS, data[4] & 0x10); 201 input_report_key(dev, BTN_STYLUS, data[4] & 0x10);
203 /* Only allow the stylus2 button to be reported for the pen tool. */ 202 /* Only allow the stylus2 button to be reported for the pen tool. */
204 input_report_key(dev, BTN_STYLUS2, (wacom->tool[1] == BTN_TOOL_PEN) && (data[4] & 0x20)); 203 input_report_key(dev, BTN_STYLUS2, (wacom->tool[1] == BTN_TOOL_PEN) && (data[4] & 0x20));
205 } 204 } else {
206 else {
207 /* report proximity-out of a (valid) tool */ 205 /* report proximity-out of a (valid) tool */
208 if (wacom->tool[1] != BTN_TOOL_RUBBER) { 206 if (wacom->tool[1] != BTN_TOOL_RUBBER) {
209 /* Unknown tool selected default to pen tool */ 207 /* Unknown tool selected default to pen tool */
@@ -215,7 +213,7 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs)
215 wacom->tool[0] = prox; /* Save proximity state */ 213 wacom->tool[0] = prox; /* Save proximity state */
216 input_sync(dev); 214 input_sync(dev);
217 215
218exit: 216 exit:
219 retval = usb_submit_urb (urb, GFP_ATOMIC); 217 retval = usb_submit_urb (urb, GFP_ATOMIC);
220 if (retval) 218 if (retval)
221 err ("%s - usb_submit_urb failed with result %d", 219 err ("%s - usb_submit_urb failed with result %d",
@@ -244,20 +242,16 @@ static void wacom_ptu_irq(struct urb *urb, struct pt_regs *regs)
244 goto exit; 242 goto exit;
245 } 243 }
246 244
247 if (data[0] != 2) 245 if (data[0] != 2) {
248 {
249 printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]); 246 printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]);
250 goto exit; 247 goto exit;
251 } 248 }
252 249
253 input_regs(dev, regs); 250 input_regs(dev, regs);
254 if (data[1] & 0x04) 251 if (data[1] & 0x04) {
255 {
256 input_report_key(dev, BTN_TOOL_RUBBER, data[1] & 0x20); 252 input_report_key(dev, BTN_TOOL_RUBBER, data[1] & 0x20);
257 input_report_key(dev, BTN_TOUCH, data[1] & 0x08); 253 input_report_key(dev, BTN_TOUCH, data[1] & 0x08);
258 } 254 } else {
259 else
260 {
261 input_report_key(dev, BTN_TOOL_PEN, data[1] & 0x20); 255 input_report_key(dev, BTN_TOOL_PEN, data[1] & 0x20);
262 input_report_key(dev, BTN_TOUCH, data[1] & 0x01); 256 input_report_key(dev, BTN_TOUCH, data[1] & 0x01);
263 } 257 }
@@ -269,7 +263,7 @@ static void wacom_ptu_irq(struct urb *urb, struct pt_regs *regs)
269 263
270 input_sync(dev); 264 input_sync(dev);
271 265
272exit: 266 exit:
273 retval = usb_submit_urb (urb, GFP_ATOMIC); 267 retval = usb_submit_urb (urb, GFP_ATOMIC);
274 if (retval) 268 if (retval)
275 err ("%s - usb_submit_urb failed with result %d", 269 err ("%s - usb_submit_urb failed with result %d",
@@ -312,7 +306,7 @@ static void wacom_penpartner_irq(struct urb *urb, struct pt_regs *regs)
312 input_report_key(dev, BTN_STYLUS, (data[5] & 0x40)); 306 input_report_key(dev, BTN_STYLUS, (data[5] & 0x40));
313 input_sync(dev); 307 input_sync(dev);
314 308
315exit: 309 exit:
316 retval = usb_submit_urb (urb, GFP_ATOMIC); 310 retval = usb_submit_urb (urb, GFP_ATOMIC);
317 if (retval) 311 if (retval)
318 err ("%s - usb_submit_urb failed with result %d", 312 err ("%s - usb_submit_urb failed with result %d",
@@ -352,8 +346,8 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs)
352 346
353 input_regs(dev, regs); 347 input_regs(dev, regs);
354 348
355 if ( data[1] & 0x10 ) /* in prox */ 349 if (data[1] & 0x10) { /* in prox */
356 { 350
357 switch ((data[1] >> 5) & 3) { 351 switch ((data[1] >> 5) & 3) {
358 352
359 case 0: /* Pen */ 353 case 0: /* Pen */
@@ -369,7 +363,7 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs)
369 input_report_rel(dev, REL_WHEEL, (signed char) data[6]); 363 input_report_rel(dev, REL_WHEEL, (signed char) data[6]);
370 /* fall through */ 364 /* fall through */
371 365
372 case 3: /* Mouse without wheel */ 366 case 3: /* Mouse without wheel */
373 wacom->tool[0] = BTN_TOOL_MOUSE; 367 wacom->tool[0] = BTN_TOOL_MOUSE;
374 input_report_key(dev, BTN_LEFT, data[1] & 0x01); 368 input_report_key(dev, BTN_LEFT, data[1] & 0x01);
375 input_report_key(dev, BTN_RIGHT, data[1] & 0x02); 369 input_report_key(dev, BTN_RIGHT, data[1] & 0x02);
@@ -392,7 +386,7 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs)
392 input_report_key(dev, wacom->tool[0], data[1] & 0x10); 386 input_report_key(dev, wacom->tool[0], data[1] & 0x10);
393 input_sync(dev); 387 input_sync(dev);
394 388
395exit: 389 exit:
396 retval = usb_submit_urb (urb, GFP_ATOMIC); 390 retval = usb_submit_urb (urb, GFP_ATOMIC);
397 if (retval) 391 if (retval)
398 err ("%s - usb_submit_urb failed with result %d", 392 err ("%s - usb_submit_urb failed with result %d",
@@ -410,8 +404,7 @@ static int wacom_intuos_inout(struct urb *urb)
410 idx = data[1] & 0x01; 404 idx = data[1] & 0x01;
411 405
412 /* Enter report */ 406 /* Enter report */
413 if ((data[1] & 0xfc) == 0xc0) 407 if ((data[1] & 0xfc) == 0xc0) {
414 {
415 /* serial number of the tool */ 408 /* serial number of the tool */
416 wacom->serial[idx] = ((data[3] & 0x0f) << 28) + 409 wacom->serial[idx] = ((data[3] & 0x0f) << 28) +
417 (data[4] << 20) + (data[5] << 12) + 410 (data[4] << 20) + (data[5] << 12) +
@@ -490,8 +483,7 @@ static void wacom_intuos_general(struct urb *urb)
490 unsigned int t; 483 unsigned int t;
491 484
492 /* general pen packet */ 485 /* general pen packet */
493 if ((data[1] & 0xb8) == 0xa0) 486 if ((data[1] & 0xb8) == 0xa0) {
494 {
495 t = (data[6] << 2) | ((data[7] >> 6) & 3); 487 t = (data[6] << 2) | ((data[7] >> 6) & 3);
496 input_report_abs(dev, ABS_PRESSURE, t); 488 input_report_abs(dev, ABS_PRESSURE, t);
497 input_report_abs(dev, ABS_TILT_X, 489 input_report_abs(dev, ABS_TILT_X,
@@ -503,8 +495,7 @@ static void wacom_intuos_general(struct urb *urb)
503 } 495 }
504 496
505 /* airbrush second packet */ 497 /* airbrush second packet */
506 if ((data[1] & 0xbc) == 0xb4) 498 if ((data[1] & 0xbc) == 0xb4) {
507 {
508 input_report_abs(dev, ABS_WHEEL, 499 input_report_abs(dev, ABS_WHEEL,
509 (data[6] << 2) | ((data[7] >> 6) & 3)); 500 (data[6] << 2) | ((data[7] >> 6) & 3));
510 input_report_abs(dev, ABS_TILT_X, 501 input_report_abs(dev, ABS_TILT_X,
@@ -549,11 +540,9 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
549 idx = data[1] & 0x01; 540 idx = data[1] & 0x01;
550 541
551 /* pad packets. Works as a second tool and is always in prox */ 542 /* pad packets. Works as a second tool and is always in prox */
552 if (data[0] == 12) 543 if (data[0] == 12) {
553 {
554 /* initiate the pad as a device */ 544 /* initiate the pad as a device */
555 if (wacom->tool[1] != BTN_TOOL_FINGER) 545 if (wacom->tool[1] != BTN_TOOL_FINGER) {
556 {
557 wacom->tool[1] = BTN_TOOL_FINGER; 546 wacom->tool[1] = BTN_TOOL_FINGER;
558 input_report_key(dev, wacom->tool[1], 1); 547 input_report_key(dev, wacom->tool[1], 1);
559 } 548 }
@@ -573,19 +562,18 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
573 } 562 }
574 563
575 /* process in/out prox events */ 564 /* process in/out prox events */
576 if (wacom_intuos_inout(urb)) goto exit; 565 if (wacom_intuos_inout(urb))
566 goto exit;
577 567
578 /* Cintiq doesn't send data when RDY bit isn't set */ 568 /* Cintiq doesn't send data when RDY bit isn't set */
579 if ((wacom->features->type == CINTIQ) && !(data[1] & 0x40)) return; 569 if ((wacom->features->type == CINTIQ) && !(data[1] & 0x40))
570 return;
580 571
581 if(wacom->features->type >= INTUOS3) 572 if (wacom->features->type >= INTUOS3) {
582 {
583 input_report_abs(dev, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1)); 573 input_report_abs(dev, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1));
584 input_report_abs(dev, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1)); 574 input_report_abs(dev, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1));
585 input_report_abs(dev, ABS_DISTANCE, ((data[9] >> 2) & 0x3f)); 575 input_report_abs(dev, ABS_DISTANCE, ((data[9] >> 2) & 0x3f));
586 } 576 } else {
587 else
588 {
589 input_report_abs(dev, ABS_X, be16_to_cpu(*(__be16 *) &data[2])); 577 input_report_abs(dev, ABS_X, be16_to_cpu(*(__be16 *) &data[2]));
590 input_report_abs(dev, ABS_Y, be16_to_cpu(*(__be16 *) &data[4])); 578 input_report_abs(dev, ABS_Y, be16_to_cpu(*(__be16 *) &data[4]));
591 input_report_abs(dev, ABS_DISTANCE, ((data[9] >> 3) & 0x1f)); 579 input_report_abs(dev, ABS_DISTANCE, ((data[9] >> 3) & 0x1f));
@@ -596,11 +584,10 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
596 584
597 /* 4D mouse, 2D mouse, marker pen rotation, or Lens cursor packets */ 585 /* 4D mouse, 2D mouse, marker pen rotation, or Lens cursor packets */
598 if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0) { 586 if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0) {
599 /* Rotation packet */ 587
600 if (data[1] & 0x02) 588 if (data[1] & 0x02) {
601 { 589 /* Rotation packet */
602 if(wacom->features->type >= INTUOS3) 590 if (wacom->features->type >= INTUOS3) {
603 {
604 /* I3 marker pen rotation reported as wheel 591 /* I3 marker pen rotation reported as wheel
605 * due to valuator limitation 592 * due to valuator limitation
606 */ 593 */
@@ -608,18 +595,15 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
608 t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : 595 t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) :
609 ((t-1) / 2 + 450)) : (450 - t / 2) ; 596 ((t-1) / 2 + 450)) : (450 - t / 2) ;
610 input_report_abs(dev, ABS_WHEEL, t); 597 input_report_abs(dev, ABS_WHEEL, t);
611 } 598 } else {
612 else
613 {
614 /* 4D mouse rotation packet */ 599 /* 4D mouse rotation packet */
615 t = (data[6] << 3) | ((data[7] >> 5) & 7); 600 t = (data[6] << 3) | ((data[7] >> 5) & 7);
616 input_report_abs(dev, ABS_RZ, (data[7] & 0x20) ? 601 input_report_abs(dev, ABS_RZ, (data[7] & 0x20) ?
617 ((t - 1) / 2) : -t / 2); 602 ((t - 1) / 2) : -t / 2);
618 } 603 }
619 } 604
620 /* 4D mouse packets */ 605 } else if (!(data[1] & 0x10) && wacom->features->type < INTUOS3) {
621 else if ( !(data[1] & 0x10) && wacom->features->type < INTUOS3) 606 /* 4D mouse packet */
622 {
623 input_report_key(dev, BTN_LEFT, data[8] & 0x01); 607 input_report_key(dev, BTN_LEFT, data[8] & 0x01);
624 input_report_key(dev, BTN_MIDDLE, data[8] & 0x02); 608 input_report_key(dev, BTN_MIDDLE, data[8] & 0x02);
625 input_report_key(dev, BTN_RIGHT, data[8] & 0x04); 609 input_report_key(dev, BTN_RIGHT, data[8] & 0x04);
@@ -628,26 +612,23 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
628 input_report_key(dev, BTN_EXTRA, data[8] & 0x10); 612 input_report_key(dev, BTN_EXTRA, data[8] & 0x10);
629 t = (data[6] << 2) | ((data[7] >> 6) & 3); 613 t = (data[6] << 2) | ((data[7] >> 6) & 3);
630 input_report_abs(dev, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); 614 input_report_abs(dev, ABS_THROTTLE, (data[8] & 0x08) ? -t : t);
631 } 615
632 /* 2D mouse packets */ 616 } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) {
633 else if (wacom->tool[idx] == BTN_TOOL_MOUSE) 617 /* 2D mouse packet */
634 {
635 input_report_key(dev, BTN_LEFT, data[8] & 0x04); 618 input_report_key(dev, BTN_LEFT, data[8] & 0x04);
636 input_report_key(dev, BTN_MIDDLE, data[8] & 0x08); 619 input_report_key(dev, BTN_MIDDLE, data[8] & 0x08);
637 input_report_key(dev, BTN_RIGHT, data[8] & 0x10); 620 input_report_key(dev, BTN_RIGHT, data[8] & 0x10);
638 input_report_rel(dev, REL_WHEEL, ((data[8] & 0x02) >> 1) 621 input_report_rel(dev, REL_WHEEL, ((data[8] & 0x02) >> 1)
639 - (data[8] & 0x01)); 622 - (data[8] & 0x01));
640 623
641 /* I3 2D mouse side buttons */ 624 /* I3 2D mouse side buttons */
642 if (wacom->features->type == INTUOS3) 625 if (wacom->features->type == INTUOS3) {
643 {
644 input_report_key(dev, BTN_SIDE, data[8] & 0x40); 626 input_report_key(dev, BTN_SIDE, data[8] & 0x40);
645 input_report_key(dev, BTN_EXTRA, data[8] & 0x20); 627 input_report_key(dev, BTN_EXTRA, data[8] & 0x20);
646 } 628 }
647 } 629
648 /* Lens cursor packets */ 630 } else if (wacom->features->type < INTUOS3) {
649 else if (wacom->features->type < INTUOS3) 631 /* Lens cursor packets */
650 {
651 input_report_key(dev, BTN_LEFT, data[8] & 0x01); 632 input_report_key(dev, BTN_LEFT, data[8] & 0x01);
652 input_report_key(dev, BTN_MIDDLE, data[8] & 0x02); 633 input_report_key(dev, BTN_MIDDLE, data[8] & 0x02);
653 input_report_key(dev, BTN_RIGHT, data[8] & 0x04); 634 input_report_key(dev, BTN_RIGHT, data[8] & 0x04);
@@ -668,23 +649,23 @@ exit:
668} 649}
669 650
670static struct wacom_features wacom_features[] = { 651static struct wacom_features wacom_features[] = {
671 { "Wacom Penpartner", 7, 5040, 3780, 255, 32, PENPARTNER, wacom_penpartner_irq }, 652 { "Wacom Penpartner", 7, 5040, 3780, 255, 32, PENPARTNER, wacom_penpartner_irq },
672 { "Wacom Graphire", 8, 10206, 7422, 511, 32, GRAPHIRE, wacom_graphire_irq }, 653 { "Wacom Graphire", 8, 10206, 7422, 511, 32, GRAPHIRE, wacom_graphire_irq },
673 { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, GRAPHIRE, wacom_graphire_irq }, 654 { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, GRAPHIRE, wacom_graphire_irq },
674 { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, GRAPHIRE, wacom_graphire_irq }, 655 { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, GRAPHIRE, wacom_graphire_irq },
675 { "Wacom Graphire3", 8, 10208, 7424, 511, 32, GRAPHIRE, wacom_graphire_irq }, 656 { "Wacom Graphire3", 8, 10208, 7424, 511, 32, GRAPHIRE, wacom_graphire_irq },
676 { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, GRAPHIRE, wacom_graphire_irq }, 657 { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, GRAPHIRE, wacom_graphire_irq },
677 { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, 658 { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq },
678 { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, 659 { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq },
679 { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq }, 660 { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq },
680 { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, 661 { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, INTUOS, wacom_intuos_irq },
681 { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, 662 { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, INTUOS, wacom_intuos_irq },
682 { "Wacom PL400", 8, 5408, 4056, 255, 32, PL, wacom_pl_irq }, 663 { "Wacom PL400", 8, 5408, 4056, 255, 32, PL, wacom_pl_irq },
683 { "Wacom PL500", 8, 6144, 4608, 255, 32, PL, wacom_pl_irq }, 664 { "Wacom PL500", 8, 6144, 4608, 255, 32, PL, wacom_pl_irq },
684 { "Wacom PL600", 8, 6126, 4604, 255, 32, PL, wacom_pl_irq }, 665 { "Wacom PL600", 8, 6126, 4604, 255, 32, PL, wacom_pl_irq },
685 { "Wacom PL600SX", 8, 6260, 5016, 255, 32, PL, wacom_pl_irq }, 666 { "Wacom PL600SX", 8, 6260, 5016, 255, 32, PL, wacom_pl_irq },
686 { "Wacom PL550", 8, 6144, 4608, 511, 32, PL, wacom_pl_irq }, 667 { "Wacom PL550", 8, 6144, 4608, 511, 32, PL, wacom_pl_irq },
687 { "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_pl_irq }, 668 { "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_pl_irq },
688 { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, 669 { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq },
689 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, 670 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq },
690 { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq }, 671 { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq },