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

usbFindDeviceType() is only called once. From where it
is called, it is only called if event->value != 0 and
with ds->device_id = event->value.
Thus the test !ds->device_id will always fail.

Signed-off-by: Egbert Eich <e...@suse.com>
Reviewed-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmUSB.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 7375711..3e5c31d 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1100,33 +1100,20 @@ static int usbIdToType(int id)
 }
 
 /**
- * Find the tool type (STYLUS_ID, etc.) based on the device_id or the
- *  current tool serial number if the device_id is unknown (0).
+ * Find the tool type (STYLUS_ID, etc.) based on the device_id.
  *
  * Protocol 5 devices report different IDs for different styli and pucks,
  * Protocol 4 devices simply report STYLUS_DEVICE_ID, etc.
  *
  * @param ds The current device state received from the kernel.
- * @return The tool type associated with the tool id or the current
- * tool serial number.
+ * @return The tool type associated with the tool id.
  */
 static int usbFindDeviceType(const WacomCommonPtr common,
                          const WacomDeviceState *ds)
 {
-       WacomToolPtr tool = NULL;
        int device_type = 0;
 
-       if (!ds->device_id && ds->serial_num)
-       {
-               for (tool = common->wcmTool; tool; tool = tool->next)
-                       if (ds->serial_num == tool->serial)
-                       {
-                               device_type = tool->typeid;
-                               break;
-                       }
-       }
-
-       if (device_type || !ds->device_id) return device_type;
+       if (!ds->device_id) return 0;
 
        switch (ds->device_id)
        {
-- 
1.8.4.5


------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to