Those events are set for all devices in current code.

Signed-off-by: Ping Cheng <pi...@wacom.com>
---
 wacom.c | 141 ++++++++++++++++++++++++++--------------------------------------
 1 file changed, 57 insertions(+), 84 deletions(-)

diff --git a/wacom.c b/wacom.c
index 4ec3290..cd89aab 100644
--- a/wacom.c
+++ b/wacom.c
@@ -193,6 +193,58 @@ int wacom_get_n_devices(void)
        return WACOM_N_TABLETS;
 }
 
+static int wacom_intuos_events(struct uinput_info *info)
+{
+       struct wacom_priv *priv = wacom_priv(info);
+       struct wacom_features *features = &wacom_features[priv->type];
+
+       set_event(info, UI_SET_EVBIT, EV_REL);
+       set_event(info, UI_SET_EVBIT, EV_SYN);
+       set_event(info, UI_SET_EVBIT, EV_MSC);
+
+       set_event(info, UI_SET_RELBIT, REL_WHEEL);
+       set_event(info, UI_SET_MSCBIT, MSC_SERIAL);
+
+       set_event(info, UI_SET_KEYBIT, BTN_TOOL_PENCIL);
+       set_event(info, UI_SET_KEYBIT, BTN_TOOL_BRUSH);
+       set_event(info, UI_SET_KEYBIT, BTN_TOOL_AIRBRUSH);
+       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);
+       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_STYLUS2);
+       set_event(info, UI_SET_KEYBIT, BTN_RIGHT);
+       set_event(info, UI_SET_KEYBIT, BTN_LEFT);
+       set_event(info, UI_SET_KEYBIT, BTN_MIDDLE);
+       set_event(info, UI_SET_KEYBIT, BTN_SIDE);
+       set_event(info, UI_SET_KEYBIT, BTN_EXTRA);
+       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);
+
+       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);
+       set_event(info, UI_SET_ABSBIT, ABS_PRESSURE);
+       set_event(info, UI_SET_ABSBIT, ABS_DISTANCE);
+       set_event(info, UI_SET_ABSBIT, ABS_WHEEL);
+       set_event(info, UI_SET_ABSBIT, ABS_THROTTLE);
+
+       return 0;
+}
+
 static int wacom_set_events(struct uinput_info *info, struct uinput_user_dev 
*dev)
 {
        struct wacom_priv *priv = wacom_priv(info);
@@ -201,12 +253,12 @@ static int wacom_set_events(struct uinput_info *info, 
struct uinput_user_dev *de
        /* common */
        set_event(info, UI_SET_EVBIT, EV_KEY);
        set_event(info, UI_SET_EVBIT, EV_ABS);
+       set_event(info, UI_SET_ABSBIT, ABS_X);
+       set_event(info, UI_SET_ABSBIT, ABS_Y);
 
        /* 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);
 #ifdef ABS_MT_SLOT
                set_event(info, UI_SET_ABSBIT, ABS_MT_SLOT);
                set_event(info, UI_SET_ABSBIT, ABS_MT_TOUCH_MAJOR);
@@ -277,7 +329,6 @@ static int wacom_set_events(struct uinput_info *info, 
struct uinput_user_dev *de
                set_event(info, UI_SET_KEYBIT, BTN_7);
                /* fall thru */
        case INTUOS3S:
-               set_event(info, UI_SET_KEYBIT, BTN_TOOL_FINGER);
                set_event(info, UI_SET_KEYBIT, BTN_0);
                set_event(info, UI_SET_KEYBIT, BTN_1);
                set_event(info, UI_SET_KEYBIT, BTN_2);
@@ -285,25 +336,7 @@ static int wacom_set_events(struct uinput_info *info, 
struct uinput_user_dev *de
                set_event(info, UI_SET_ABSBIT, ABS_Z);
                /* fall thru */
        case INTUOS:
-               set_event(info, UI_SET_EVBIT, EV_MSC);
-               set_event(info, UI_SET_EVBIT, EV_REL);
-
-               set_event(info, UI_SET_MSCBIT, MSC_SERIAL);
-
-               set_event(info, UI_SET_RELBIT, REL_WHEEL);
-
-               set_event(info, UI_SET_KEYBIT, BTN_LEFT);
-               set_event(info, UI_SET_KEYBIT, BTN_RIGHT);
-               set_event(info, UI_SET_KEYBIT, BTN_MIDDLE);
-               set_event(info, UI_SET_KEYBIT, BTN_SIDE);
-               set_event(info, UI_SET_KEYBIT, BTN_EXTRA);
-               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_BRUSH);
-               set_event(info, UI_SET_KEYBIT, BTN_TOOL_PENCIL);
-               set_event(info, UI_SET_KEYBIT, BTN_TOOL_AIRBRUSH);
-               set_event(info, UI_SET_KEYBIT, BTN_TOOL_LENS);
-               set_event(info, UI_SET_KEYBIT, BTN_STYLUS2);
+               wacom_intuos_events(info);
 
                break;
        case TABLETPC:
@@ -324,7 +357,6 @@ static int wacom_set_events(struct uinput_info *info, 
struct uinput_user_dev *de
                set_event(info, UI_SET_KEYBIT, BTN_8);
                /* fall trhu */
        case INTUOS4S:
-               set_event(info, UI_SET_KEYBIT, BTN_TOOL_FINGER);
                set_event(info, UI_SET_KEYBIT, BTN_0);
                set_event(info, UI_SET_KEYBIT, BTN_1);
                set_event(info, UI_SET_KEYBIT, BTN_2);
@@ -332,6 +364,7 @@ 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);
+               wacom_intuos_events(info);
                break;
        case INTUOS5M:
        case INTUOS5L:
@@ -346,69 +379,9 @@ 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);
+               wacom_intuos_events(info);
                break;
        }
-
-       set_event(info, UI_SET_EVBIT, EV_KEY);
-       set_event(info, UI_SET_EVBIT, EV_ABS);
-       set_event(info, UI_SET_EVBIT, EV_REL);
-       set_event(info, UI_SET_EVBIT, EV_SYN);
-       set_event(info, UI_SET_EVBIT, EV_MSC);
-
-       set_event(info, UI_SET_KEYBIT, BTN_TOOL_PEN);
-       set_event(info, UI_SET_KEYBIT, BTN_TOOL_PENCIL);
-       set_event(info, UI_SET_KEYBIT, BTN_TOOL_BRUSH);
-       set_event(info, UI_SET_KEYBIT, BTN_TOOL_AIRBRUSH);
-       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);
-       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);
-       set_event(info, UI_SET_KEYBIT, BTN_RIGHT);
-       set_event(info, UI_SET_KEYBIT, BTN_LEFT);
-       set_event(info, UI_SET_KEYBIT, BTN_MIDDLE);
-       set_event(info, UI_SET_KEYBIT, BTN_SIDE);
-       set_event(info, UI_SET_KEYBIT, BTN_EXTRA);
-       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);
-       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);
-       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);
-       set_event(info, UI_SET_ABSBIT, ABS_PRESSURE);
-       set_event(info, UI_SET_ABSBIT, ABS_DISTANCE);
-       set_event(info, UI_SET_ABSBIT, ABS_WHEEL);
-       set_event(info, UI_SET_ABSBIT, ABS_THROTTLE);
-       set_event(info, UI_SET_ABSBIT, ABS_MISC);
-
-       set_event(info, UI_SET_RELBIT, REL_WHEEL);
-
-       set_event(info, UI_SET_MSCBIT, MSC_SERIAL);
-
-       return 0;
 }
 
 #define USB_VENDOR_ID_WACOM 0x056a
-- 
1.9.1


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to