summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2011-11-14 13:04:24 -0800
committerJason Gerecke <killertofu@gmail.com>2011-11-15 11:21:46 -0800
commitf7c0a64bf6550ac8ada19345bd03916bd4aa8890 (patch)
tree8a02b8a3542c8530141a1eec8235c84ce08f2e34
parent20958f84eef0b40f91e4559099f342f28650c183 (diff)
Fix usbInitToolType to not always return TOUCH_ID
Commit ca922994 changed usbInitToolType to use the tool TOUCH_ID by default. Because of the way the 'for' loop just below is handled though, the function would never return anything but TOUCH_ID. This patch changes things to only return TOUCH_ID if no data for an alternate tool type could be found in the event packets. Signed-off-by: Jason Gerecke <killertofu@gmail.com> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
-rw-r--r--src/wcmUSB.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 14de990..4d05f67 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1346,11 +1346,11 @@ static int usbParseBTNEvent(WacomCommonPtr common,
* events to be processed.
* @param nevents Number of events in the packet.
*
- * @return The tool type. 0 if no pen/touch/eraser event code in the event.
+ * @return The tool type. TOUCH_ID if no pen/touch/eraser event code in the event.
*/
static int usbInitToolType(const struct input_event *event_ptr, int nevents)
{
- int i, device_type = TOUCH_ID;
+ int i, device_type = 0;
struct input_event* event = (struct input_event *)event_ptr;
for (i = 0; (i < nevents) && !device_type; ++i)
@@ -1378,6 +1378,11 @@ static int usbInitToolType(const struct input_event *event_ptr, int nevents)
event++;
}
+ if (!device_type)
+ {
+ device_type = TOUCH_ID;
+ }
+
return device_type;
}