aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorPing Cheng <pingc@wacom.com>2009-12-15 03:35:25 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-12-15 03:36:15 -0500
commitcad7470084686d876ebfecf55a9ce039075f9134 (patch)
tree02e326809ecf8306491805c12e75cf53e4b07e6e /drivers/input
parentec67bbedcf290ef182a897017f65a2707106c7f8 (diff)
Input: wacom - add defines for data packet report IDs
Signed-off-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/tablet/wacom_wac.c27
-rw-r--r--drivers/input/tablet/wacom_wac.h8
2 files changed, 22 insertions, 13 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 46725894ea62..e4e8c3636940 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -58,7 +58,7 @@ static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo)
58 unsigned char *data = wacom->data; 58 unsigned char *data = wacom->data;
59 int prox, pressure; 59 int prox, pressure;
60 60
61 if (data[0] != 2) { 61 if (data[0] != WACOM_REPORT_PENABLED) {
62 dbg("wacom_pl_irq: received unknown report #%d", data[0]); 62 dbg("wacom_pl_irq: received unknown report #%d", data[0]);
63 return 0; 63 return 0;
64 } 64 }
@@ -127,7 +127,7 @@ static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo)
127{ 127{
128 unsigned char *data = wacom->data; 128 unsigned char *data = wacom->data;
129 129
130 if (data[0] != 2) { 130 if (data[0] != WACOM_REPORT_PENABLED) {
131 printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]); 131 printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]);
132 return 0; 132 return 0;
133 } 133 }
@@ -155,7 +155,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
155 unsigned char *data = wacom->data; 155 unsigned char *data = wacom->data;
156 int x, y, rw; 156 int x, y, rw;
157 157
158 if (data[0] != 2) { 158 if (data[0] != WACOM_REPORT_PENABLED) {
159 dbg("wacom_graphire_irq: received unknown report #%d", data[0]); 159 dbg("wacom_graphire_irq: received unknown report #%d", data[0]);
160 return 0; 160 return 0;
161 } 161 }
@@ -431,7 +431,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
431 unsigned int t; 431 unsigned int t;
432 int idx = 0, result; 432 int idx = 0, result;
433 433
434 if (data[0] != 2 && data[0] != 5 && data[0] != 6 && data[0] != 12) { 434 if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_INTUOSREAD
435 && data[0] != WACOM_REPORT_INTUOSWRITE && data[0] != WACOM_REPORT_INTUOSPAD) {
435 dbg("wacom_intuos_irq: received unknown report #%d", data[0]); 436 dbg("wacom_intuos_irq: received unknown report #%d", data[0]);
436 return 0; 437 return 0;
437 } 438 }
@@ -441,7 +442,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
441 idx = data[1] & 0x01; 442 idx = data[1] & 0x01;
442 443
443 /* pad packets. Works as a second tool and is always in prox */ 444 /* pad packets. Works as a second tool and is always in prox */
444 if (data[0] == 12) { 445 if (data[0] == WACOM_REPORT_INTUOSPAD) {
445 /* initiate the pad as a device */ 446 /* initiate the pad as a device */
446 if (wacom->tool[1] != BTN_TOOL_FINGER) 447 if (wacom->tool[1] != BTN_TOOL_FINGER)
447 wacom->tool[1] = BTN_TOOL_FINGER; 448 wacom->tool[1] = BTN_TOOL_FINGER;
@@ -648,7 +649,7 @@ static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo)
648 649
649 if (urb->actual_length != WACOM_PKGLEN_TPC1FG) { 650 if (urb->actual_length != WACOM_PKGLEN_TPC1FG) {
650 switch (data[0]) { 651 switch (data[0]) {
651 case 6: 652 case WACOM_REPORT_TPC1FG:
652 wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2])); 653 wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2]));
653 wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4])); 654 wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4]));
654 wacom_report_abs(wcombo, ABS_PRESSURE, wacom_le16_to_cpu(&data[6])); 655 wacom_report_abs(wcombo, ABS_PRESSURE, wacom_le16_to_cpu(&data[6]));
@@ -656,7 +657,7 @@ static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo)
656 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); 657 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
657 wacom_report_key(wcombo, wacom->tool[0], 1); 658 wacom_report_key(wcombo, wacom->tool[0], 1);
658 break; 659 break;
659 case 13: 660 case WACOM_REPORT_TPC2FG:
660 /* keep this byte to send proper out-prox event */ 661 /* keep this byte to send proper out-prox event */
661 wacom->id[1] = data[1] & 0x03; 662 wacom->id[1] = data[1] & 0x03;
662 663
@@ -705,13 +706,13 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
705 706
706 dbg("wacom_tpc_irq: received report #%d", data[0]); 707 dbg("wacom_tpc_irq: received report #%d", data[0]);
707 708
708 if (urb->actual_length == WACOM_PKGLEN_TPC1FG || 709 if (urb->actual_length == WACOM_PKGLEN_TPC1FG || /* single touch */
709 data[0] == 6 || /* single touch */ 710 data[0] == WACOM_REPORT_TPC1FG || /* single touch */
710 data[0] == 13) { /* 2FG touch */ 711 data[0] == WACOM_REPORT_TPC2FG) { /* 2FG touch */
711 if (urb->actual_length == WACOM_PKGLEN_TPC1FG) { /* with touch */ 712 if (urb->actual_length == WACOM_PKGLEN_TPC1FG) { /* with touch */
712 prox = data[0] & 0x01; 713 prox = data[0] & 0x01;
713 } else { /* with capacity */ 714 } else { /* with capacity */
714 if (data[0] == 6) 715 if (data[0] == WACOM_REPORT_TPC1FG)
715 /* single touch */ 716 /* single touch */
716 prox = data[1] & 0x01; 717 prox = data[1] & 0x01;
717 else 718 else
@@ -728,7 +729,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
728 } 729 }
729 } else { 730 } else {
730 /* 2FGT out-prox */ 731 /* 2FGT out-prox */
731 if ((data[0] & 0xff) == 13) { 732 if (data[0] == WACOM_REPORT_TPC2FG) {
732 idx = (wacom->id[1] & 0x01) - 1; 733 idx = (wacom->id[1] & 0x01) - 1;
733 if (idx == 0) { 734 if (idx == 0) {
734 wacom_tpc_touch_out(wacom, wcombo, idx); 735 wacom_tpc_touch_out(wacom, wcombo, idx);
@@ -751,7 +752,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
751 touchInProx = 1; 752 touchInProx = 1;
752 return 1; 753 return 1;
753 } 754 }
754 } else if (data[0] == 2) { /* Penabled */ 755 } else if (data[0] == WACOM_REPORT_PENABLED) { /* Penabled */
755 prox = data[1] & 0x20; 756 prox = data[1] & 0x20;
756 757
757 touchInProx = 0; 758 touchInProx = 0;
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 39c2516e3d31..ee01e1902785 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -28,6 +28,14 @@
28#define ERASER_DEVICE_ID 0x0A 28#define ERASER_DEVICE_ID 0x0A
29#define PAD_DEVICE_ID 0x0F 29#define PAD_DEVICE_ID 0x0F
30 30
31/* wacom data packet report IDs */
32#define WACOM_REPORT_PENABLED 2
33#define WACOM_REPORT_INTUOSREAD 5
34#define WACOM_REPORT_INTUOSWRITE 6
35#define WACOM_REPORT_INTUOSPAD 12
36#define WACOM_REPORT_TPC1FG 6
37#define WACOM_REPORT_TPC2FG 13
38
31enum { 39enum {
32 PENPARTNER = 0, 40 PENPARTNER = 0,
33 GRAPHIRE, 41 GRAPHIRE,