From: Egbert Eich <e...@suse.com>

Let it check the event queue for a serial number (ie. event type EV_MSC,
event code MSC_SERIAL) and check of the serial number == -1 to determine
if the tool is of type PAD.

Signed-off-by: Egbert Eich <e...@suse.com>
---
 src/wcmUSB.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 0fb17b4..7bd99e1 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1484,7 +1484,7 @@ static void usbParseBTNEvent(WacomCommonPtr common,
  * @param[in] code      Linux input tool code (e.g. BTN_STYLUS_PEN)
  * @return              Wacom device ID (e.g. STYLUS_ID) or 0 if no match.
  */
-static int toolTypeToDeviceType(WacomCommonPtr common, int type, int code)
+static int toolTypeToDeviceType(WacomCommonPtr common, int type, int code, int 
value)
 {
        wcmUSBData* private = common->private;
 
@@ -1518,6 +1518,8 @@ static int toolTypeToDeviceType(WacomCommonPtr common, 
int type, int code)
                                return TOUCH_ID;
                }
        }
+       else if (type == EV_MSC && code == MSC_SERIAL && value == -1)
+               return PAD_ID;
 
        return 0;
 }
@@ -1545,7 +1547,7 @@ static int refreshDeviceType(WacomCommonPtr common)
        for (i = 0; i < KEY_MAX; i++)
        {
                if (ISBITSET(keys, i))
-                       device_type = toolTypeToDeviceType(common, EV_KEY, i);
+                       device_type = toolTypeToDeviceType(common, EV_KEY, i, 
0);
                if (device_type)
                        return device_type;
        }
@@ -1575,7 +1577,8 @@ static int usbInitToolType(WacomCommonPtr common, const 
struct input_event *even
 
        for (i = 0; (i < nevents) && !device_type; ++i, event_ptr++)
        {
-               device_type = toolTypeToDeviceType(common, event_ptr->type, 
event_ptr->code);
+               device_type = toolTypeToDeviceType(common, event_ptr->type, 
event_ptr->code,
+                                                  event_ptr->value);
        }
 
        if (!device_type)
-- 
1.8.1.4


------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to