Devices like the Graphire4 and Bamboo-series have Pad buttons
which emit "mouse button" events (e.g. BTN_FORWARD) instead of
the usual "generic button" events (e.g. BTN_0). Currently, the
code considers the former to be valid for the Pad device only
if the tablet doesn't also support a Cursor device. Devices
with mouse buttons on the Pad *and* have a Cursor device
(like the Graphire4 and very early Bamboos) end up declaring
zero Pad buttons because of this, causing us to allocate
an insufficient number of actions and thereby prevent the
re-mapping of their forward and back buttons.

This patch changes the condition from "no Cursor device exists"
to "no generic buttons exist". In theory this can result in the
Pad claiming it has buttons when none physically exist, but it
shouldn't result in any problems.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
Changes from v1:
 * s/usual/generic/
 * Reword patch description
 * Remove IsPad condition -- superflous, and possibly wrong

 src/wcmUSB.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 4ec91b7..47c8964 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -375,10 +375,11 @@ static Bool usbWcmInit(InputInfoPtr pInfo, char* id, 
float *version)
                if (ISBITSET (common->wcmKeys, padkey_codes [i]))
                        usbdata->padkey_code [usbdata->npadkeys++] = 
padkey_codes [i];
 
-       if (!(ISBITSET (common->wcmKeys, BTN_TOOL_MOUSE)))
-       {
-               /* If mouse buttons detected but no mouse tool
-                * then they must be associated with pad buttons.
+       if (usbdata->npadkeys == 0) {
+               /* If no pad keys were detected, entertain the possibility that 
any
+                * mouse buttons which exist may belong to the pad (e.g. 
Graphire4).
+                * If we're wrong, this will over-state the capabilities of the 
pad
+                * but that shouldn't actually cause problems.
                 */
                for (i = ARRAY_SIZE(mouse_codes) - 1; i > 0; i--)
                        if (ISBITSET(common->wcmKeys, mouse_codes[i]))
@@ -387,7 +388,7 @@ static Bool usbWcmInit(InputInfoPtr pInfo, char* id, float 
*version)
                /* Make sure room for fixed map mouse buttons.  This
                 * means mappings may overlap with padkey_codes[].
                 */
-               if (i != 0 && usbdata->npadkeys < WCM_USB_MAX_MOUSE_BUTTONS)
+               if (i != 0)
                        usbdata->npadkeys = WCM_USB_MAX_MOUSE_BUTTONS;
        }
 
-- 
1.7.11


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to