From: Chris Bagwell <[email protected]>

Previous version was missing 2nd gen Bamboo support
even though git commit said it was supported.

Signed-off-by: Chris Bagwell <[email protected]>
---
 2.6.38/wacom_sys.c |   19 ++------
 2.6.38/wacom_wac.c |  129 +++++++++++++++++++++++++++++++++++++++++++++------
 2.6.38/wacom_wac.h |    1 +
 3 files changed, 118 insertions(+), 31 deletions(-)

diff --git a/2.6.38/wacom_sys.c b/2.6.38/wacom_sys.c
index ab498e4..7e63183 100644
--- a/2.6.38/wacom_sys.c
+++ b/2.6.38/wacom_sys.c
@@ -315,13 +315,6 @@ static int wacom_parse_hid(struct usb_interface *intf,
                                                        
get_unaligned_le16(&report[i + 3]);
                                                i += 4;
                                        }
-                               } else if (usage == WCM_DIGITIZER) {
-                                       /* max pressure isn't reported
-                                       features->pressure_max = (unsigned 
short)
-                                                       (report[i+4] << 8  | 
report[i + 3]);
-                                       */
-                                       features->pressure_max = 255;
-                                       i += 4;
                                }
                                break;
 
@@ -380,13 +373,6 @@ static int wacom_parse_hid(struct usb_interface *intf,
                                pen = 1;
                                i++;
                                break;
-
-                       case HID_USAGE_UNDEFINED:
-                               if (usage == WCM_DESKTOP && finger) /* capacity 
*/
-                                       features->pressure_max =
-                                               get_unaligned_le16(&report[i + 
3]);
-                               i += 4;
-                               break;
                        }
                        break;
 
@@ -577,7 +563,8 @@ static int wacom_led_control(struct wacom *wacom)
        if (!buf)
                return -ENOMEM;
 
-       if (wacom->wacom_wac.features.type == WACOM_21UX2)
+       if (wacom->wacom_wac.features.type == WACOM_21UX2 ||
+           wacom->wacom_wac.features.type == WACOM_24HD)
                led = (wacom->led.select[1] << 4) | 0x40;
 
        led |=  wacom->led.select[0] | 0x4;
@@ -796,6 +783,7 @@ static int wacom_initialize_leds(struct wacom *wacom)
                                           &intuos4_led_attr_group);
                break;
 
+       case WACOM_24HD:
        case WACOM_21UX2:
                wacom->led.select[0] = 0;
                wacom->led.select[1] = 0;
@@ -830,6 +818,7 @@ static void wacom_destroy_leds(struct wacom *wacom)
                                   &intuos4_led_attr_group);
                break;
 
+       case WACOM_24HD:
        case WACOM_21UX2:
                sysfs_remove_group(&wacom->intf->dev.kobj,
                                   &cintiq_led_attr_group);
diff --git a/2.6.38/wacom_wac.c b/2.6.38/wacom_wac.c
index 6b9adc7..a22e778 100644
--- a/2.6.38/wacom_wac.c
+++ b/2.6.38/wacom_wac.c
@@ -452,7 +452,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom)
        if ((data[1] & 0xb8) == 0xa0) {
                t = (data[6] << 2) | ((data[7] >> 6) & 3);
                if ((features->type >= INTUOS4S && features->type <= INTUOS4L) 
||
-                   features->type == WACOM_21UX2) {
+                   features->type == WACOM_21UX2 || features->type == 
WACOM_24HD) {
                        t = (t << 1) | (data[1] & 1);
                }
                input_report_abs(input, ABS_PRESSURE, t);
@@ -519,6 +519,56 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
                                input_report_key(input, wacom->tool[1], 0);
                                input_report_abs(input, ABS_MISC, 0);
                        }
+               } else if (features->type == WACOM_24HD) {
+                       input_report_key(input, BTN_0, (data[6] & 0x01));
+                       input_report_key(input, BTN_1, (data[6] & 0x02));
+                       input_report_key(input, BTN_2, (data[6] & 0x04));
+                       input_report_key(input, BTN_3, (data[6] & 0x08));
+                       input_report_key(input, BTN_4, (data[6] & 0x10));
+                       input_report_key(input, BTN_5, (data[6] & 0x20));
+                       input_report_key(input, BTN_6, (data[6] & 0x40));
+                       input_report_key(input, BTN_7, (data[6] & 0x80));
+                       input_report_key(input, BTN_8, (data[8] & 0x01));
+                       input_report_key(input, BTN_9, (data[8] & 0x02));
+                       input_report_key(input, BTN_A, (data[8] & 0x04));
+                       input_report_key(input, BTN_B, (data[8] & 0x08));
+                       input_report_key(input, BTN_C, (data[8] & 0x10));
+                       input_report_key(input, BTN_X, (data[8] & 0x20));
+                       input_report_key(input, BTN_Y, (data[8] & 0x40));
+                       input_report_key(input, BTN_Z, (data[8] & 0x80));
+
+                       /*
+                        * Three "buttons" are available on the 24HD which are
+                        * physically implemented as a touchstrip. Each button
+                        * is approximately 3 bits wide with a 2 bit spacing.
+                        * The raw touchstrip bits are stored at:
+                        *    ((data[3] & 0x1f) << 8) | data[4])
+                        */
+                       input_report_key(input, KEY_PROG1, data[4] & 0x07);
+                       input_report_key(input, KEY_PROG2, data[4] & 0xE0);
+                       input_report_key(input, KEY_PROG3, data[3] & 0x1C);
+
+                       if (data[1] & 0x80) {
+                               input_report_abs(input, ABS_WHEEL, (data[1] & 
0x7f));
+                       } else {
+                               /* Out of proximity, clear wheel value. */
+                               input_report_abs(input, ABS_WHEEL, 0);
+                       }
+
+                       if (data[2] & 0x80) {
+                               input_report_abs(input, ABS_THROTTLE, (data[2] 
& 0x7f));
+                       } else {
+                               /* Out of proximity, clear second wheel value. 
*/
+                               input_report_abs(input, ABS_THROTTLE, 0);
+                       }
+
+                       if (data[1] | data[2] | (data[3] & 0x1f) | data[4] | 
data[6] | data[8]) {
+                               input_report_key(input, wacom->tool[1], 1);
+                               input_report_abs(input, ABS_MISC, 
PAD_DEVICE_ID);
+                       } else {
+                               input_report_key(input, wacom->tool[1], 0);
+                               input_report_abs(input, ABS_MISC, 0);
+                       }
                } else {
                        if (features->type == WACOM_21UX2) {
                                input_report_key(input, BTN_0, (data[5] & 
0x01));
@@ -803,25 +853,26 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
            return 0;
 
        for (i = 0; i < 2; i++) {
-               int p = data[9 * i + 2];
-               bool touch = p && !wacom->shared->stylus_in_proximity;
+               int offset = (data[1] & 0x80) ? (8 * i) : (9 * i);
+               bool touch = data[offset + 3] & 0x80;
 
-               input_mt_slot(input, i);
-               input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
                /*
                 * Touch events need to be disabled while stylus is
                 * in proximity because user's hand is resting on touchpad
                 * and sending unwanted events.  User expects tablet buttons
                 * to continue working though.
                 */
+               touch = touch && !wacom->shared->stylus_in_proximity;
+
+               input_mt_slot(input, i);
+               input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
                if (touch) {
-                       int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff;
-                       int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff;
+                       int x = get_unaligned_be16(&data[offset + 3]) & 0x7ff;
+                       int y = get_unaligned_be16(&data[offset + 5]) & 0x7ff;
                        if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) {
                                x <<= 5;
                                y <<= 5;
                        }
-                       input_report_abs(input, ABS_MT_PRESSURE, p);
                        input_report_abs(input, ABS_MT_POSITION_X, x);
                        input_report_abs(input, ABS_MT_POSITION_Y, y);
                }
@@ -1018,6 +1069,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t 
len)
        case CINTIQ:
        case WACOM_BEE:
        case WACOM_21UX2:
+       case WACOM_24HD:
                sync = wacom_intuos_irq(wacom_wac);
                break;
 
@@ -1126,10 +1178,11 @@ void wacom_setup_input_capabilities(struct input_dev 
*input_dev,
                             features->x_fuzz, 0);
        input_set_abs_params(input_dev, ABS_Y, 0, features->y_max,
                             features->y_fuzz, 0);
-       input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max,
-                            features->pressure_fuzz, 0);
 
        if (features->device_type == BTN_TOOL_PEN) {
+               input_set_abs_params(input_dev, ABS_PRESSURE, 0, 
features->pressure_max,
+                            features->pressure_fuzz, 0);
+
                /* penabled devices have fixed resolution for each model */
                input_abs_set_res(input_dev, ABS_X, features->x_resolution);
                input_abs_set_res(input_dev, ABS_Y, features->y_resolution);
@@ -1168,6 +1221,28 @@ void wacom_setup_input_capabilities(struct input_dev 
*input_dev,
                __set_bit(BTN_TOOL_MOUSE, input_dev->keybit);
                __set_bit(BTN_STYLUS, input_dev->keybit);
                __set_bit(BTN_STYLUS2, input_dev->keybit);
+
+               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
+               break;
+
+       case WACOM_24HD:
+               __set_bit(BTN_A, input_dev->keybit);
+               __set_bit(BTN_B, input_dev->keybit);
+               __set_bit(BTN_C, input_dev->keybit);
+               __set_bit(BTN_X, input_dev->keybit);
+               __set_bit(BTN_Y, input_dev->keybit);
+               __set_bit(BTN_Z, input_dev->keybit);
+
+               for (i = 0; i < 10; i++)
+                       __set_bit(BTN_0 + i, input_dev->keybit);
+
+               __set_bit(KEY_PROG1, input_dev->keybit);
+               __set_bit(KEY_PROG2, input_dev->keybit);
+               __set_bit(KEY_PROG3, input_dev->keybit);
+
+               input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
+               input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
+               wacom_setup_cintiq(wacom_wac);
                break;
 
        case WACOM_21UX2:
@@ -1190,12 +1265,12 @@ void wacom_setup_input_capabilities(struct input_dev 
*input_dev,
                for (i = 0; i < 8; i++)
                        __set_bit(BTN_0 + i, input_dev->keybit);
 
-               if (wacom_wac->features.type != WACOM_21UX2) {
-                       input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
-                       input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
-               }
-
+               input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
+               input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
                input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
+
+               __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
+
                wacom_setup_cintiq(wacom_wac);
                break;
 
@@ -1220,6 +1295,8 @@ void wacom_setup_input_capabilities(struct input_dev 
*input_dev,
                /* fall through */
 
        case INTUOS:
+               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
+
                wacom_setup_intuos(wacom_wac);
                break;
 
@@ -1235,6 +1312,8 @@ void wacom_setup_input_capabilities(struct input_dev 
*input_dev,
 
                input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
                wacom_setup_intuos(wacom_wac);
+
+               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
                break;
 
        case TABLETPC2FG:
@@ -1253,26 +1332,40 @@ void wacom_setup_input_capabilities(struct input_dev 
*input_dev,
        case TABLETPC:
                __clear_bit(ABS_MISC, input_dev->absbit);
 
+               __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
+
                if (features->device_type != BTN_TOOL_PEN)
                        break;  /* no need to process stylus stuff */
 
                /* fall through */
 
        case PL:
-       case PTU:
        case DTU:
                __set_bit(BTN_TOOL_PEN, input_dev->keybit);
+               __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
                __set_bit(BTN_STYLUS, input_dev->keybit);
                __set_bit(BTN_STYLUS2, input_dev->keybit);
+
+               __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
+               break;
+
+       case PTU:
+               __set_bit(BTN_STYLUS2, input_dev->keybit);
                /* fall through */
 
        case PENPARTNER:
+               __set_bit(BTN_TOOL_PEN, input_dev->keybit);
                __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
+               __set_bit(BTN_STYLUS, input_dev->keybit);
+
+               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
                break;
 
        case BAMBOO_PT:
                __clear_bit(ABS_MISC, input_dev->absbit);
 
+               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
+
                if (features->device_type == BTN_TOOL_DOUBLETAP) {
                        __set_bit(BTN_LEFT, input_dev->keybit);
                        __set_bit(BTN_FORWARD, input_dev->keybit);
@@ -1481,6 +1574,9 @@ static const struct wacom_features wacom_features_0xBB =
 static const struct wacom_features wacom_features_0xBC =
        { "Wacom Intuos4 WL",     WACOM_PKGLEN_INTUOS,    40840, 25400, 2047,
          63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
+static const struct wacom_features wacom_features_0xF4 =
+       { "Wacom Cintiq 24HD",    WACOM_PKGLEN_INTUOS,   104480, 65600, 2047,
+         63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
 static const struct wacom_features wacom_features_0x3F =
        { "Wacom Cintiq 21UX",    WACOM_PKGLEN_INTUOS,    87200, 65600, 1023,
          63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
@@ -1680,6 +1776,7 @@ const struct usb_device_id wacom_ids[] = {
        { USB_DEVICE_WACOM(0xE3) },
        { USB_DEVICE_WACOM(0xE6) },
        { USB_DEVICE_WACOM(0x47) },
+       { USB_DEVICE_WACOM(0xF4) },
        { USB_DEVICE_LENOVO(0x6004) },
        { }
 };
diff --git a/2.6.38/wacom_wac.h b/2.6.38/wacom_wac.h
index 27f1d1c..050acae 100644
--- a/2.6.38/wacom_wac.h
+++ b/2.6.38/wacom_wac.h
@@ -59,6 +59,7 @@ enum {
        INTUOS4S,
        INTUOS4,
        INTUOS4L,
+       WACOM_24HD,
        WACOM_21UX2,
        CINTIQ,
        WACOM_BEE,
-- 
1.7.7.4


------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to