Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
Some cleanup would be nice to avoid the conditions, but wdaemon is on
minimal maintainership at this point so I'm too worried about breaking some
other device.

 wacom.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 85 insertions(+), 4 deletions(-)

diff --git a/wacom.c b/wacom.c
index 89f1da6..d71069a 100644
--- a/wacom.c
+++ b/wacom.c
@@ -90,6 +90,10 @@ enum {
        INTUOS4L,
        WACOM_21UX2,
        DTU,
+       INTUOS5S,
+       INTUOS5M,
+       INTUOS5L,
+       INTUOS5_FG,
        MAX_TYPE
 };
 
@@ -164,6 +168,12 @@ static struct wacom_features {
        { "Wacom Cintiq 21UX2",   87200, 65600, 2047, 63, WACOM_21UX2,0xCC },
        { "Wacom DTU1631",        34623, 19553, 511,   0, DTU,        0xF0 },
        { "Wacom DTU2231",        47864, 27011, 511,   0, DTU,        0xCE },
+       { "Wacom Intuos5 touch S Pen",    31496, 19685, 2047, 63, INTUOS5S,   
0x26},
+       { "Wacom Intuos5 touch S Finger",  4096,  4096,    0,  0, INTUOS5_FG, 
0x26},
+       { "Wacom Intuos5 touch M Pen",    44704, 27940, 2047, 63, INTUOS5M,   
0x27},
+       { "Wacom Intuos5 touch M Finger",  4096,  4096,    0,  0, INTUOS5_FG, 
0x27},
+       { "Wacom Intuos5 touch L Pen",    65024, 40640, 2047, 63, INTUOS5L,   
0x28},
+       { "Wacom Intuos5 touch L Finger",  4096,  4096,    0,  0, INTUOS5_FG, 
0x28},
 };
 #define WACOM_N_TABLETS (sizeof(wacom_features)/sizeof(wacom_features[0]))
 int wacom_check_type(int x)
@@ -185,6 +195,25 @@ static int wacom_set_events(struct uinput_info *info, 
struct uinput_user_dev *de
        set_event(info, UI_SET_EVBIT, EV_KEY);
        set_event(info, UI_SET_EVBIT, EV_ABS);
 
+       /* touch devices don't have the common features of others */
+       switch(features->type) {
+       case INTUOS5_FG:
+               set_event(info, UI_SET_ABSBIT, ABS_X);
+               set_event(info, UI_SET_ABSBIT, ABS_Y);
+               set_event(info, UI_SET_ABSBIT, ABS_MT_SLOT);
+               set_event(info, UI_SET_ABSBIT, ABS_MT_TOUCH_MAJOR);
+               set_event(info, UI_SET_ABSBIT, ABS_MT_POSITION_X);
+               set_event(info, UI_SET_ABSBIT, ABS_MT_POSITION_Y);
+               set_event(info, UI_SET_ABSBIT, ABS_MT_TRACKING_ID);
+               set_event(info, UI_SET_KEYBIT, BTN_TOOL_FINGER);
+               set_event(info, UI_SET_KEYBIT, BTN_TOOL_DOUBLETAP);
+               set_event(info, UI_SET_KEYBIT, BTN_TOOL_TRIPLETAP);
+               set_event(info, UI_SET_KEYBIT, BTN_TOOL_QUADTAP);
+               set_event(info, UI_SET_KEYBIT, BTN_TOUCH);
+               return 0;
+       }
+
+
        set_event(info, UI_SET_KEYBIT, BTN_TOOL_PEN);
        set_event(info, UI_SET_KEYBIT, BTN_TOUCH);
        set_event(info, UI_SET_KEYBIT, BTN_STYLUS);
@@ -295,6 +324,20 @@ static int wacom_set_events(struct uinput_info *info, 
struct uinput_user_dev *de
                set_event(info, UI_SET_KEYBIT, BTN_5);
                set_event(info, UI_SET_KEYBIT, BTN_6);
                break;
+       case INTUOS5M:
+       case INTUOS5L:
+               set_event(info, UI_SET_KEYBIT, BTN_7);
+               set_event(info, UI_SET_KEYBIT, BTN_8);
+       case INTUOS5S:
+               set_event(info, UI_SET_ABSBIT, ABS_Z);
+               set_event(info, UI_SET_KEYBIT, BTN_0);
+               set_event(info, UI_SET_KEYBIT, BTN_1);
+               set_event(info, UI_SET_KEYBIT, BTN_2);
+               set_event(info, UI_SET_KEYBIT, BTN_3);
+               set_event(info, UI_SET_KEYBIT, BTN_4);
+               set_event(info, UI_SET_KEYBIT, BTN_5);
+               set_event(info, UI_SET_KEYBIT, BTN_6);
+               break;
        }
 
        set_event(info, UI_SET_EVBIT, EV_KEY);
@@ -310,7 +353,10 @@ static int wacom_set_events(struct uinput_info *info, 
struct uinput_user_dev *de
        set_event(info, UI_SET_KEYBIT, BTN_TOOL_RUBBER);
        set_event(info, UI_SET_KEYBIT, BTN_TOOL_MOUSE);
        set_event(info, UI_SET_KEYBIT, BTN_TOOL_LENS);
-       set_event(info, UI_SET_KEYBIT, BTN_TOOL_FINGER);
+       if (features->type != INTUOS5S &&
+               features->type != INTUOS5M &&
+               features->type != INTUOS5L)
+               set_event(info, UI_SET_KEYBIT, BTN_TOOL_FINGER);
        set_event(info, UI_SET_KEYBIT, BTN_TOUCH);
        set_event(info, UI_SET_KEYBIT, BTN_STYLUS);
        set_event(info, UI_SET_KEYBIT, BTN_STYLUS2);
@@ -326,13 +372,20 @@ static int wacom_set_events(struct uinput_info *info, 
struct uinput_user_dev *de
        set_event(info, UI_SET_KEYBIT, BTN_4);
        set_event(info, UI_SET_KEYBIT, BTN_5);
        set_event(info, UI_SET_KEYBIT, BTN_6);
-       set_event(info, UI_SET_KEYBIT, BTN_7);
+       if (features->type != INTUOS5S &&
+               features->type != INTUOS5M &&
+               features->type != INTUOS5L)
+               set_event(info, UI_SET_KEYBIT, BTN_7);
        set_event(info, UI_SET_KEYBIT, BTN_MIDDLE);
 
        set_event(info, UI_SET_ABSBIT, ABS_X);
        set_event(info, UI_SET_ABSBIT, ABS_Y);
-       set_event(info, UI_SET_ABSBIT, ABS_RX);
-       set_event(info, UI_SET_ABSBIT, ABS_RY);
+       if (features->type != INTUOS5S &&
+               features->type != INTUOS5M &&
+               features->type != INTUOS5L) {
+               set_event(info, UI_SET_ABSBIT, ABS_RX);
+               set_event(info, UI_SET_ABSBIT, ABS_RY);
+       }
        set_event(info, UI_SET_ABSBIT, ABS_RZ);
        set_event(info, UI_SET_ABSBIT, ABS_TILT_X);
        set_event(info, UI_SET_ABSBIT, ABS_TILT_Y);
@@ -417,6 +470,34 @@ static int wacom_set_initial_values(struct uinput_info 
*info,
        case INTUOS4L:
                dev->absmin[ABS_Z] = -900;
                dev->absmax[ABS_Z] = 899;
+               break;
+       case INTUOS5S:
+       case INTUOS5M:
+       case INTUOS5L:
+               dev->absfuzz[ABS_X] = 4;
+               dev->absfuzz[ABS_Y] = 4;
+               dev->absfuzz[ABS_Y] = 4;
+               dev->absmin[ABS_Z] = -900;
+               dev->absmax[ABS_Z] = 899;
+               dev->absmin[ABS_RZ] = -900;
+               dev->absmax[ABS_RZ] = 899;
+               dev->absmax[ABS_WHEEL] = 1023;
+               dev->absmax[ABS_TILT_X] = 127;
+               dev->absmax[ABS_TILT_Y] = 127;
+               dev->absmin[ABS_THROTTLE] = -1023;
+               dev->absmax[ABS_THROTTLE] = 1023;
+               break;
+       case INTUOS5_FG:
+               dev->absfuzz[ABS_X] = 4;
+               dev->absfuzz[ABS_Y] = 4;
+               dev->absmax[ABS_MT_SLOT] = 15;
+               dev->absmax[ABS_MT_TOUCH_MAJOR] = 255;
+               dev->absmax[ABS_MT_POSITION_X] = 4096;
+               dev->absfuzz[ABS_MT_POSITION_X] = 4;
+               dev->absmax[ABS_MT_POSITION_Y] = 4096;
+               dev->absfuzz[ABS_MT_POSITION_Y] = 4;
+               dev->absmax[ABS_MT_TRACKING_ID] = 65535;
+               break;
        }
 
        return uinput_write_dev(info, dev);
-- 
1.7.11.2


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to