From f7c0a64bf6550ac8ada19345bd03916bd4aa8890 Mon Sep 17 00:00:00 2001 From: Jason Gerecke Date: Mon, 14 Nov 2011 13:04:24 -0800 Subject: 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 Reviewed-by: Chris Bagwell --- src/wcmUSB.c | 9 +++++++-- 1 file 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; } -- cgit v1.2.3