USB: Wacom driver updates
authorPing Cheng <pingc@wacom.com>
Tue, 26 Sep 2006 20:34:47 +0000 (13:34 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Oct 2006 21:46:30 +0000 (14:46 -0700)
This fixes some issues with the current wacom driver due to the split of
the driver into different pieces and adds support for the Intuos3 4x6

Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/input/Makefile
drivers/usb/input/wacom.h
drivers/usb/input/wacom_sys.c
drivers/usb/input/wacom_wac.c
drivers/usb/input/wacom_wac.h

index 295f459..71437db 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 # Multipart objects.
-wacom-objs     := wacom_sys.o wacom_wac.o
+wacom-objs     := wacom_wac.o wacom_sys.o
 usbhid-objs    := hid-core.o
 
 # Optional parts of multipart objects.
index 7b3840e..1cf08f0 100644 (file)
@@ -63,6 +63,7 @@
  *      v1.46 (pc) - Split wacom.c into wacom_sys.c and wacom_wac.c,
  *                - where wacom_sys.c deals with system specific code,
  *                - and wacom_wac.c deals with Wacom specific code
+ *                - Support Intuos3 4x6
  */
 
 /*
@@ -118,6 +119,7 @@ extern void wacom_input_sync(void *wcombo);
 extern void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
 extern void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
 extern void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
+extern void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
 extern void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
 extern void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
 extern void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
index d233c37..3c27f9b 100644 (file)
@@ -110,7 +110,7 @@ __u16 wacom_be16_to_cpu(unsigned char *data)
 __u16 wacom_le16_to_cpu(unsigned char *data)
 {
        __u16 value;
-       value = be16_to_cpu(*(__be16 *) data);
+       value = le16_to_cpu(*(__le16 *) data);
        return value;
 }
 
@@ -143,7 +143,7 @@ void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
        input_dev->evbit[0] |= BIT(EV_MSC);
        input_dev->mscbit[0] |= BIT(MSC_SERIAL);
        input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER);
-       input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7);
+       input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_4);
 }
 
 void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
@@ -155,11 +155,16 @@ void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
        input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0);
 }
 
-void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
+void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
 {
        input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER);
-       input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7);
+       input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3);
        input_set_abs_params(input_dev, ABS_RX, 0, 4097, 0, 0);
+}
+
+void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
+{
+       input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7);
        input_set_abs_params(input_dev, ABS_RY, 0, 4097, 0, 0);
 }
 
@@ -244,7 +249,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
        usb_fill_int_urb(wacom->irq, dev,
                         usb_rcvintpipe(dev, endpoint->bEndpointAddress),
                         wacom_wac->data, wacom_wac->features->pktlen,
-                        wacom_wac->features->irq, wacom, endpoint->bInterval);
+                        wacom_sys_irq, wacom, endpoint->bInterval);
        wacom->irq->transfer_dma = wacom->data_dma;
        wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
index aa31d22..92726fe 100644 (file)
@@ -191,9 +191,9 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
                                wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01);
                                wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02);
                                if (wacom->features->type == WACOM_G4)
-                                       wacom_report_abs(wcombo, ABS_DISTANCE, data[6]);
+                                       wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f);
                                else
-                                       wacom_report_abs(wcombo, ABS_DISTANCE, data[7]);
+                                       wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f);
                                break;
                }
        }
@@ -303,8 +303,9 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
                                wacom->tool[idx] = BTN_TOOL_PEN;
                }
                /* only large I3 support Lens Cursor */
-               if(!((wacom->tool[idx] == BTN_TOOL_LENS) &&
-                               (wacom->features->type == INTUOS3))) {
+               if(!((wacom->tool[idx] == BTN_TOOL_LENS)
+                                && ((wacom->features->type == INTUOS3)
+                                || (wacom->features->type == INTUOS3S)))) {
                        wacom_report_abs(wcombo, ABS_MISC, wacom->id[idx]); /* report tool id */
                        wacom_report_key(wcombo, wacom->tool[idx], 1);
                        wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
@@ -315,10 +316,14 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
 
        /* Exit report */
        if ((data[1] & 0xfe) == 0x80) {
-               wacom_report_key(wcombo, wacom->tool[idx], 0);
-               wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */
-               wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
-               return 2;
+               if(!((wacom->tool[idx] == BTN_TOOL_LENS)
+                                && ((wacom->features->type == INTUOS3)
+                                || (wacom->features->type == INTUOS3S)))) {
+                       wacom_report_key(wcombo, wacom->tool[idx], 0);
+                       wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */
+                       wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
+                       return 2;
+               }
        }
        return 0;
 }
@@ -382,7 +387,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
                wacom_report_abs(wcombo, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]);
                wacom_report_abs(wcombo, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]);
 
-               if((data[5] & 0x0f) | (data[6] & 0x0f) | (data[1] & 0x1f) | data[2])
+               if((data[5] & 0x0f) | (data[6] & 0x0f) | (data[1] & 0x1f) |
+                       data[2] | (data[3] & 0x1f) | data[4])
                        wacom_report_key(wcombo, wacom->tool[1], 1);
                else
                        wacom_report_key(wcombo, wacom->tool[1], 0);
@@ -432,7 +438,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
                                        ((t - 1) / 2) : -t / 2);
                        }
 
-               } else if (!(data[1] & 0x10) && wacom->features->type < INTUOS3) {
+               } else if (!(data[1] & 0x10) && wacom->features->type < INTUOS3S) {
                        /* 4D mouse packet */
                        wacom_report_key(wcombo, BTN_LEFT,   data[8] & 0x01);
                        wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02);
@@ -452,12 +458,12 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
                                                 - ((data[8] & 0x02) >> 1));
 
                        /* I3 2D mouse side buttons */
-                       if (wacom->features->type == INTUOS3) {
+                       if (wacom->features->type >= INTUOS3S && wacom->features->type <= INTUOS3L) {
                                wacom_report_key(wcombo, BTN_SIDE,   data[8] & 0x40);
                                wacom_report_key(wcombo, BTN_EXTRA,  data[8] & 0x20);
                        }
 
-               } else if (wacom->features->type < INTUOS3) {
+               } else if (wacom->features->type < INTUOS3S || wacom->features->type == INTUOS3L) {
                        /* Lens cursor packets */
                        wacom_report_key(wcombo, BTN_LEFT,   data[8] & 0x01);
                        wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02);
@@ -490,6 +496,7 @@ int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo)
                        return (wacom_ptu_irq(wacom_wac, wcombo));
                        break;
                case INTUOS:
+               case INTUOS3S:
                case INTUOS3:
                case INTUOS3L:
                case CINTIQ:
@@ -515,6 +522,8 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w
                case CINTIQ:
                        input_dev_i3(input_dev, wacom_wac);
                        /* fall through */
+               case INTUOS3S:
+                       input_dev_i3s(input_dev, wacom_wac);
                case INTUOS:
                        input_dev_i(input_dev, wacom_wac);
                        break;
@@ -530,49 +539,50 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w
 }
 
 static struct wacom_features wacom_features[] = {
-       { "Wacom Penpartner",    7,   5040,  3780,  255, 32, PENPARTNER,        wacom_sys_irq },
-        { "Wacom Graphire",      8,  10206,  7422,  511, 32, GRAPHIRE, wacom_sys_irq },
-       { "Wacom Graphire2 4x5", 8,  10206,  7422,  511, 32, GRAPHIRE,  wacom_sys_irq },
-       { "Wacom Graphire2 5x7", 8,  13918, 10206,  511, 32, GRAPHIRE,  wacom_sys_irq },
-       { "Wacom Graphire3",     8,  10208,  7424,  511, 32, GRAPHIRE,  wacom_sys_irq },
-       { "Wacom Graphire3 6x8", 8,  16704, 12064,  511, 32, GRAPHIRE,  wacom_sys_irq },
-       { "Wacom Graphire4 4x5", 8,  10208,  7424,  511, 32, WACOM_G4,  wacom_sys_irq },
-       { "Wacom Graphire4 6x8", 8,  16704, 12064,  511, 32, WACOM_G4,  wacom_sys_irq },
-       { "Wacom Volito",        8,   5104,  3712,  511, 32, GRAPHIRE,  wacom_sys_irq },
-       { "Wacom PenStation2",   8,   3250,  2320,  255, 32, GRAPHIRE,  wacom_sys_irq },
-       { "Wacom Volito2 4x5",   8,   5104,  3712,  511, 32, GRAPHIRE,  wacom_sys_irq },
-       { "Wacom Volito2 2x3",   8,   3248,  2320,  511, 32, GRAPHIRE,  wacom_sys_irq },
-       { "Wacom PenPartner2",   8,   3250,  2320,  255, 32, GRAPHIRE,  wacom_sys_irq },
-       { "Wacom Intuos 4x5",   10,  12700, 10600, 1023, 15, INTUOS,    wacom_sys_irq},
-       { "Wacom Intuos 6x8",   10,  20320, 16240, 1023, 15, INTUOS,    wacom_sys_irq },
-       { "Wacom Intuos 9x12",  10,  30480, 24060, 1023, 15, INTUOS,    wacom_sys_irq },
-       { "Wacom Intuos 12x12", 10,  30480, 31680, 1023, 15, INTUOS,    wacom_sys_irq },
-       { "Wacom Intuos 12x18", 10,  45720, 31680, 1023, 15, INTUOS,    wacom_sys_irq},
-       { "Wacom PL400",         8,   5408,  4056,  255, 32, PL,        wacom_sys_irq },
-       { "Wacom PL500",         8,   6144,  4608,  255, 32, PL,        wacom_sys_irq },
-       { "Wacom PL600",         8,   6126,  4604,  255, 32, PL,        wacom_sys_irq },
-       { "Wacom PL600SX",       8,   6260,  5016,  255, 32, PL,        wacom_sys_irq },
-       { "Wacom PL550",         8,   6144,  4608,  511, 32, PL,        wacom_sys_irq },
-       { "Wacom PL800",         8,   7220,  5780,  511, 32, PL,        wacom_sys_irq },
-       { "Wacom PL700",         8,   6758,  5406,  511, 32, PL,        wacom_sys_irq },
-       { "Wacom PL510",         8,   6282,  4762,  511, 32, PL,        wacom_sys_irq },
-       { "Wacom DTU710",        8,  34080, 27660,  511, 32, PL,        wacom_sys_irq },
-       { "Wacom DTF521",        8,   6282,  4762,  511, 32, PL,        wacom_sys_irq },
-       { "Wacom DTF720",        8,   6858,  5506,  511, 32, PL,        wacom_sys_irq },
-       { "Wacom Cintiq Partner",8,  20480, 15360,  511, 32, PTU,       wacom_sys_irq },
-       { "Wacom Intuos2 4x5",   10, 12700, 10600, 1023, 15, INTUOS,    wacom_sys_irq },
-       { "Wacom Intuos2 6x8",   10, 20320, 16240, 1023, 15, INTUOS,    wacom_sys_irq },
-       { "Wacom Intuos2 9x12",  10, 30480, 24060, 1023, 15, INTUOS,    wacom_sys_irq },
-       { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 15, INTUOS,    wacom_sys_irq },
-       { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 15, INTUOS,    wacom_sys_irq },
-       { "Wacom Intuos3 4x5",   10, 25400, 20320, 1023, 15, INTUOS3,   wacom_sys_irq },
-       { "Wacom Intuos3 6x8",   10, 40640, 30480, 1023, 15, INTUOS3,   wacom_sys_irq },
-       { "Wacom Intuos3 9x12",  10, 60960, 45720, 1023, 15, INTUOS3,   wacom_sys_irq },
-       { "Wacom Intuos3 12x12", 10, 60960, 60960, 1023, 15, INTUOS3L,  wacom_sys_irq },
-       { "Wacom Intuos3 12x19", 10, 97536, 60960, 1023, 15, INTUOS3L,  wacom_sys_irq },
-       { "Wacom Intuos3 6x11",  10, 54204, 31750, 1023, 15, INTUOS3,   wacom_sys_irq },
-       { "Wacom Cintiq 21UX",   10, 87200, 65600, 1023, 15, CINTIQ,    wacom_sys_irq },
-       { "Wacom Intuos2 6x8",   10, 20320, 16240, 1023, 15, INTUOS,    wacom_sys_irq },
+       { "Wacom Penpartner",    7,   5040,  3780,  255,  0, PENPARTNER },
+        { "Wacom Graphire",      8,  10206,  7422,  511, 63, GRAPHIRE },
+       { "Wacom Graphire2 4x5", 8,  10206,  7422,  511, 63, GRAPHIRE },
+       { "Wacom Graphire2 5x7", 8,  13918, 10206,  511, 63, GRAPHIRE },
+       { "Wacom Graphire3",     8,  10208,  7424,  511, 63, GRAPHIRE },
+       { "Wacom Graphire3 6x8", 8,  16704, 12064,  511, 63, GRAPHIRE },
+       { "Wacom Graphire4 4x5", 8,  10208,  7424,  511, 63, WACOM_G4 },
+       { "Wacom Graphire4 6x8", 8,  16704, 12064,  511, 63, WACOM_G4 },
+       { "Wacom Volito",        8,   5104,  3712,  511,  0, GRAPHIRE },
+       { "Wacom PenStation2",   8,   3250,  2320,  255,  0, GRAPHIRE },
+       { "Wacom Volito2 4x5",   8,   5104,  3712,  511,  0, GRAPHIRE },
+       { "Wacom Volito2 2x3",   8,   3248,  2320,  511,  0, GRAPHIRE },
+       { "Wacom PenPartner2",   8,   3250,  2320,  255,  0, GRAPHIRE },
+       { "Wacom Intuos 4x5",   10,  12700, 10600, 1023, 63, INTUOS },
+       { "Wacom Intuos 6x8",   10,  20320, 16240, 1023, 63, INTUOS },
+       { "Wacom Intuos 9x12",  10,  30480, 24060, 1023, 63, INTUOS },
+       { "Wacom Intuos 12x12", 10,  30480, 31680, 1023, 63, INTUOS },
+       { "Wacom Intuos 12x18", 10,  45720, 31680, 1023, 63, INTUOS },
+       { "Wacom PL400",         8,   5408,  4056,  255,  0, PL },
+       { "Wacom PL500",         8,   6144,  4608,  255,  0, PL },
+       { "Wacom PL600",         8,   6126,  4604,  255,  0, PL },
+       { "Wacom PL600SX",       8,   6260,  5016,  255,  0, PL },
+       { "Wacom PL550",         8,   6144,  4608,  511,  0, PL },
+       { "Wacom PL800",         8,   7220,  5780,  511,  0, PL },
+       { "Wacom PL700",         8,   6758,  5406,  511,  0, PL },
+       { "Wacom PL510",         8,   6282,  4762,  511,  0, PL },
+       { "Wacom DTU710",        8,  34080, 27660,  511,  0, PL },
+       { "Wacom DTF521",        8,   6282,  4762,  511,  0, PL },
+       { "Wacom DTF720",        8,   6858,  5506,  511,  0, PL },
+       { "Wacom Cintiq Partner",8,  20480, 15360,  511,  0, PTU },
+       { "Wacom Intuos2 4x5",   10, 12700, 10600, 1023, 63, INTUOS },
+       { "Wacom Intuos2 6x8",   10, 20320, 16240, 1023, 63, INTUOS },
+       { "Wacom Intuos2 9x12",  10, 30480, 24060, 1023, 63, INTUOS },
+       { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 63, INTUOS },
+       { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 63, INTUOS },
+       { "Wacom Intuos3 4x5",   10, 25400, 20320, 1023, 63, INTUOS3S },
+       { "Wacom Intuos3 6x8",   10, 40640, 30480, 1023, 63, INTUOS3 },
+       { "Wacom Intuos3 9x12",  10, 60960, 45720, 1023, 63, INTUOS3 },
+       { "Wacom Intuos3 12x12", 10, 60960, 60960, 1023, 63, INTUOS3L },
+       { "Wacom Intuos3 12x19", 10, 97536, 60960, 1023, 63, INTUOS3L },
+       { "Wacom Intuos3 6x11",  10, 54204, 31750, 1023, 63, INTUOS3 },
+       { "Wacom Intuos3 4x6",   10, 31496, 19685, 1023, 15, INTUOS3S },
+       { "Wacom Cintiq 21UX",   10, 87200, 65600, 1023, 63, CINTIQ },
+       { "Wacom Intuos2 6x8",   10, 20320, 16240, 1023, 63, INTUOS },
        { }
 };
 
@@ -618,6 +628,7 @@ static struct usb_device_id wacom_ids[] = {
        { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB3) },
        { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB4) },
        { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) },
+       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB7) },
        { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) },
        { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) },
        { }
index ceae7bf..a1d9ce0 100644 (file)
@@ -20,6 +20,7 @@ enum {
        PTU,
        PL,
        INTUOS,
+       INTUOS3S,
        INTUOS3,
        INTUOS3L,
        CINTIQ,
@@ -34,7 +35,6 @@ struct wacom_features {
        int pressure_max;
        int distance_max;
        int type;
-       usb_complete_t irq;
 };
 
 struct wacom_wac {