Input: wacom - add support for the new Bamboo tablets
authorPing Cheng <pingc@wacom.com>
Fri, 15 Jun 2007 03:32:48 +0000 (23:32 -0400)
committerDmitry Torokhov <dtor@insightbb.com>
Tue, 10 Jul 2007 04:35:17 +0000 (00:35 -0400)
Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/tablet/wacom.h
drivers/input/tablet/wacom_sys.c
drivers/input/tablet/wacom_wac.c
drivers/input/tablet/wacom_wac.h

index ef01a807ec0f9b6e0cd95eaafacc5030e0f2a308..6542edb6f76efe505629b8690dfa4e50b8267329 100644 (file)
@@ -11,7 +11,7 @@
  *  Copyright (c) 2000 Daniel Egger            <egger@suse.de>
  *  Copyright (c) 2001 Frederic Lepied         <flepied@mandrakesoft.com>
  *  Copyright (c) 2004 Panagiotis Issaris      <panagiotis.issaris@mech.kuleuven.ac.be>
- *  Copyright (c) 2002-2006 Ping Cheng         <pingc@wacom.com>
+ *  Copyright (c) 2002-2007 Ping Cheng         <pingc@wacom.com>
  *
  *  ChangeLog:
  *      v0.1 (vp)  - Initial release
@@ -62,8 +62,9 @@
  *                 - Minor data report fix
  *      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
+ *                - and wacom_wac.c deals with Wacom specific code
  *                - Support Intuos3 4x6
+ *      v1.47 (pc) - Added support for Bamboo
  */
 
 /*
@@ -84,7 +85,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.46"
+#define DRIVER_VERSION "v1.47"
 #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>"
 #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver"
 #define DRIVER_LICENSE "GPL"
@@ -123,6 +124,7 @@ extern void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wa
 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);
 extern void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
+extern void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
 extern __u16 wacom_le16_to_cpu(unsigned char *data);
 extern __u16 wacom_be16_to_cpu(unsigned char *data);
 extern struct wacom_features * get_wacom_feature(const struct usb_device_id *id);
index 83bddef6606770a536048c6a9250dbd084627c88..064e123c9b766170be132d2bb894b535d168b961 100644 (file)
@@ -138,6 +138,12 @@ static void wacom_close(struct input_dev *dev)
        usb_kill_urb(wacom->irq);
 }
 
+void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
+{
+       input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_1) | BIT(BTN_5);
+       input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
+}
+
 void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
 {
        input_dev->evbit[0] |= BIT(EV_MSC);
index 7661f03a2db2ab3cbb51e6d40e28db54db9ac32b..fc03ba256f4c54c540e200c23e7d0b25bccda9fb 100644 (file)
@@ -178,7 +178,8 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
 
                        case 2: /* Mouse with wheel */
                                wacom_report_key(wcombo, BTN_MIDDLE, data[1] & 0x04);
-                               if (wacom->features->type == WACOM_G4) {
+                               if (wacom->features->type == WACOM_G4 ||
+                                               wacom->features->type == WACOM_MO) {
                                        rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : (data[7] & 0x03);
                                        wacom_report_rel(wcombo, REL_WHEEL, -rw);
                                } else
@@ -190,7 +191,8 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
                                id = CURSOR_DEVICE_ID;
                                wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01);
                                wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02);
-                               if (wacom->features->type == WACOM_G4)
+                               if (wacom->features->type == WACOM_G4 ||
+                                               wacom->features->type == WACOM_MO)
                                        wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f);
                                else
                                        wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f);
@@ -226,7 +228,8 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
        }
 
        /* send pad data */
-       if (wacom->features->type == WACOM_G4) {
+       switch (wacom->features->type) {
+           case WACOM_G4:
                if (data[7] & 0xf8) {
                        wacom_input_sync(wcombo); /* sync last event */
                        wacom->id[1] = 1;
@@ -247,6 +250,33 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
                        wacom_report_abs(wcombo, ABS_MISC, 0);
                        wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
                }
+               break;
+           case WACOM_MO:
+               if ((data[7] & 0xf8) || (data[8] & 0x80)) {
+                       wacom_input_sync(wcombo); /* sync last event */
+                       wacom->id[1] = 1;
+                       wacom->serial[1] = (data[7] & 0xf8);
+                       wacom_report_key(wcombo, BTN_0, (data[7] & 0x08));
+                       wacom_report_key(wcombo, BTN_1, (data[7] & 0x20));
+                       wacom_report_key(wcombo, BTN_4, (data[7] & 0x10));
+                       wacom_report_key(wcombo, BTN_5, (data[7] & 0x40));
+                       wacom_report_abs(wcombo, ABS_WHEEL, (data[8] & 0x7f));
+                       wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0);
+                       wacom_report_abs(wcombo, ABS_MISC, PAD_DEVICE_ID);
+                       wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
+               } else if (wacom->id[1]) {
+                       wacom_input_sync(wcombo); /* sync last event */
+                       wacom->id[1] = 0;
+                       wacom_report_key(wcombo, BTN_0, (data[7] & 0x08));
+                       wacom_report_key(wcombo, BTN_1, (data[7] & 0x20));
+                       wacom_report_key(wcombo, BTN_4, (data[7] & 0x10));
+                       wacom_report_key(wcombo, BTN_5, (data[7] & 0x40));
+                       wacom_report_abs(wcombo, ABS_WHEEL, (data[8] & 0x7f));
+                       wacom_report_key(wcombo, BTN_TOOL_FINGER, 0);
+                       wacom_report_abs(wcombo, ABS_MISC, 0);
+                       wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
+               }
+               break;
        }
        return 1;
 }
@@ -331,7 +361,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
                        wacom_report_key(wcombo, BTN_EXTRA, 0);
                        wacom_report_abs(wcombo, ABS_THROTTLE, 0);
                        wacom_report_abs(wcombo, ABS_RZ, 0);
-               } else {
+               } else {
                        wacom_report_abs(wcombo, ABS_PRESSURE, 0);
                        wacom_report_abs(wcombo, ABS_TILT_X, 0);
                        wacom_report_abs(wcombo, ABS_TILT_Y, 0);
@@ -423,9 +453,9 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
                 return result-1;
 
        /* Only large I3 and I1 & I2 support Lense Cursor */
-       if((wacom->tool[idx] == BTN_TOOL_LENS)
+       if ((wacom->tool[idx] == BTN_TOOL_LENS)
                        && ((wacom->features->type == INTUOS3)
-                       || (wacom->features->type == INTUOS3S)))
+                       || (wacom->features->type == INTUOS3S)))
                return 0;
 
        /* Cintiq doesn't send data when RDY bit isn't set */
@@ -517,6 +547,7 @@ int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo)
                        break;
                case WACOM_G4:
                case GRAPHIRE:
+               case WACOM_MO:
                        return (wacom_graphire_irq(wacom_wac, wcombo));
                        break;
                case PTU:
@@ -538,6 +569,8 @@ int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo)
 void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
 {
        switch (wacom_wac->features->type) {
+               case WACOM_MO:
+                       input_dev_mo(input_dev, wacom_wac);
                case WACOM_G4:
                        input_dev_g4(input_dev, wacom_wac);
                        /* fall through */
@@ -579,6 +612,7 @@ static struct wacom_features wacom_features[] = {
        { "Wacom Volito2 4x5",   8,   5104,  3712,  511, 63, GRAPHIRE },
        { "Wacom Volito2 2x3",   8,   3248,  2320,  511, 63, GRAPHIRE },
        { "Wacom PenPartner2",   8,   3250,  2320,  255, 63, GRAPHIRE },
+       { "Wacom Bamboo",        9,  14760,  9225,  511, 63, WACOM_MO },
        { "Wacom Intuos 4x5",   10,  12700, 10600, 1023, 31, INTUOS },
        { "Wacom Intuos 6x8",   10,  20320, 16240, 1023, 31, INTUOS },
        { "Wacom Intuos 9x12",  10,  30480, 24060, 1023, 31, INTUOS },
@@ -627,6 +661,7 @@ static struct usb_device_id wacom_ids[] = {
        { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) },
        { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x63) },
        { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x64) },
+       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x65) },
        { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x20) },
        { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x21) },
        { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x22) },
index a5e12e8756de046e9bcf62ddeaaba165183246ad..a302e229bb8a7d005d65f62f6831245b2bbcd96a 100644 (file)
@@ -25,6 +25,7 @@ enum {
        INTUOS3,
        INTUOS3L,
        CINTIQ,
+       WACOM_MO,
        MAX_TYPE
 };