File linuxwacom-20080901-fix-find_devices.diff of Package x11-input-wacom

From: Danny Kukawka <danny.kukawka@web.de>
Subject: fix device detection again

This patch fixes the dection of devices which are not strictly 
named stylus/cursor/pad/touch/eraser. The problem with the current 
code is that the ifdef's are on the wrong position.

Changed code to use always mapStringToType to reduce code duplication.

Signed-off-by: Danny Kukawka <danny.kukawka@web.de>
---

 wacomcfg.c |   21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

--- linuxwacom-0.8.1-4/src/util/wacomcfg.c	2008-09-01 18:48:16.000000000 +0200
+++ linuxwacom-0.8.1-4/src/util/wacomcfg.c	2008-09-01 18:49:18.000000000 +0200
@@ -200,28 +200,14 @@
 			devName[j] = tolower(pInfo->pszName[j]);
 		devName[j] = '\0';
 
-#if WCM_XF86CONFIG
 		pInfo->type = mapStringToType (devName);
 
+#if WCM_XF86CONFIG
 		if ( pInfo->type == WACOMDEVICETYPE_UNKNOWN ) 
 			pInfo->type = checkIfWacomDevice (conf, pInfo->pszName);
-		else
-#else
-		if (strstr(devName,"cursor") != NULL)
-			pInfo->type = WACOMDEVICETYPE_CURSOR;
-		else if (strstr(devName,"stylus") != NULL)
-			pInfo->type = WACOMDEVICETYPE_STYLUS;
-		else if (strstr(devName,"eraser") != NULL)
-			pInfo->type = WACOMDEVICETYPE_ERASER;
-		else if (strstr(devName,"touch") != NULL)
- 			pInfo->type = WACOMDEVICETYPE_TOUCH;
-		else if (strstr(devName,"pad") != NULL)
-			pInfo->type = WACOMDEVICETYPE_PAD;
-		else
-			pInfo->type = WACOMDEVICETYPE_UNKNOWN;
+#endif
 
 		if ( pInfo->type != WACOMDEVICETYPE_UNKNOWN )
-#endif
 		{
 			++pInfo;
 			++nCount;
@@ -271,6 +257,8 @@
 	return WACOMDEVICETYPE_UNKNOWN;
 }
 
+#endif
+
 WACOMDEVICETYPE mapStringToType (const char* name) 
 {
 	if (!name)
@@ -290,7 +278,6 @@
 		return WACOMDEVICETYPE_UNKNOWN;
 	
 }
-#endif
 
 WACOMDEVICE * WacomConfigOpenDevice(WACOMCONFIG * hConfig,
 	const char* pszDeviceName)
openSUSE Build Service is sponsored by