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 e22cd5e..967635e 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1485,7 +1485,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;
 
@@ -1519,6 +1519,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;
 }
@@ -1546,7 +1548,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;
        }
@@ -1576,7 +1578,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


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&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