On Mon, Jun 18, 2012 at 4:12 PM, Chris Bagwell <ch...@cnpbagwell.com> wrote:
> On Mon, Jun 18, 2012 at 5:51 PM, Jason Gerecke <killert...@gmail.com> wrote:
>> Devices like early Bamboos and the Graphire4 have "mouse" buttons
>> (e.g. BTN_FORWARD) instead of the usual buttons found on Intuos
>> and Cintiq tablets (e.g. BTN_0). Mouse buttons are currently
>> ignored when counting the number of pad keys present (unless there
>> is no puck for them to be assigned to), which causes 'nbuttons'
>> to be wrong on these two devices. This results in the forward and
>> back buttons being un-remappable, being outside the number of
>> actions allocated.
>>
>> This patch has the driver check for mouse buttons on pad devices
>> if no usual buttons were found. I'm not aware of any tablets with
>> both "mouse" and "usual" buttons on the pad device, so this should
>> be sufficient to fix the problem.
>
> Yeah, I kinda knew this problem must exist but didn't know how to
> solve it.  Your approach seems reasonable.  I like the check npadkeys
> == 0 especially.   I'm wondering if its safer to remove the IsPad()
> though?  I can't recall if isPad() is always correct at this location
> (I'm thinking of Bamboo issues were isTouch() or isPad() was returned
> based on hotpug order).
>
> A tablet with zero padkey_codes and no MOUSE PUCK seems safe enough to
> always assume Mice buttons are really pad buttons; without worry about
> the isPad() part.
>
Looking more closely, my use of IsPad may be extraneous since only pad
devices ultimately make use of npadkeys.

However, I can't make the condition "zero padkey_codes *and* no mouse
puck" since the Bamboo and Graphire4 do have puck devices. With my
patch, if a tablet has a puck and no pad buttons (say it only had a
scroll wheel), the driver would act as through the pad had mouse
buttons anyway. I figure this isn't a big problem since I don't think
there's any hardware meeting that description, and even if there were
it would only result in "extra" buttons that do nothing in software.
If that's not a problem, I should be able to simplify the condition
even further -- just "npadkeys == 0" would be sufficient.

Jason

---
Day xee-nee-svsh duu-'ushtlh-ts'it;
nuu-wee-ya' duu-xan' 'vm-nvshtlh-ts'it.
Huu-chan xuu naa~-gha.

>>
>> Signed-off-by: Jason Gerecke <killert...@gmail.com>
>
> Acked-by: Chris Bagwell <ch...@cnpbagwell.com>
>
> Chris
>
>> ---
>>  src/wcmUSB.c |    3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/wcmUSB.c b/src/wcmUSB.c
>> index 4ec91b7..643c8f2 100644
>> --- a/src/wcmUSB.c
>> +++ b/src/wcmUSB.c
>> @@ -375,7 +375,8 @@ 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 (!(ISBITSET (common->wcmKeys, BTN_TOOL_MOUSE)) ||
>> +               (usbdata->npadkeys == 0 && IsPad(priv)))
>>        {
>>                /* If mouse buttons detected but no mouse tool
>>                 * then they must be associated with pad buttons.
>> --
>> 1.7.10.4
>>
>>

------------------------------------------------------------------------------
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