Neither the strstr nor the memset is needed for USB devices.

Signed-off-by: Peter Hutterer <[email protected]>
---
 src/wcmValidateDevice.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index dc8ea4e..3a12efa 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -186,10 +186,9 @@ Bool wcmIsAValidType(const char* type, unsigned long* keys)
  */
 int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* keys)
 {
-       int ret = 1, i;
-       int fd = -1, id = 0;
-       char* device, *stopstring;
-       char* str = strstr(local->name, "WACf");
+       int ret = 1;
+       int fd = -1;
+       char* device;
        struct serial_struct tmp;
 
        device = xf86SetStrOption(local->options, "Device", NULL);
@@ -202,13 +201,12 @@ int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned 
long* keys)
                return 0;
        }
 
-       /* we have tried memset. it doesn't work */
-       for (i=0; i<NBITS(KEY_MAX); i++)
-               keys[i] = 0;
-
        /* serial ISDV4 devices */
        if (ioctl(fd, TIOCGSERIAL, &tmp) == 0)
        {
+               int id, i;
+               char *stopstring, *str = strstr(local->name, "WACf");
+
                if (str) /* id in name */
                {
                        str = str + 4;
@@ -236,6 +234,10 @@ int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* 
keys)
                        }
                }
 
+               /* we have tried memset. it doesn't work */
+               for (i=0; i<NBITS(KEY_MAX); i++)
+                       keys[i] = 0;
+
                /* default to penabled */
                keys[LONG(BTN_TOOL_PEN)] |= BIT(BTN_TOOL_PEN);
                keys[LONG(BTN_TOOL_RUBBER)] |= BIT(BTN_TOOL_RUBBER);
-- 
1.6.6


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to