Subject: Re: kern/19445: Griffin Powermate is better off on ugen than uhid
To: None <seebs@vash.cel.plethora.net>
From: Dave Sainty <dave@dtsp.co.nz>
List: netbsd-bugs
Date: 12/26/2002 19:28:49
seebs writes:

> >Number:         19445
> >Category:       kern
> >Synopsis:       Griffin Powermate device is less functional as a mouse.
> >Description:
> 	The Griffin Powermate is a small gizmo which provides a button, knob,
> 	and tweakable LED light.  There is a published interface for talking
> 	to these, and a userland program can talk to it through /dev/ugen?.
> 
> 	However, if our ugen driver doesn't configure it, it will respond
> 	to the probe for uhid, and become a one-button mouse with only X, not
> 	Y, movement.  This is useless.
> 
> >How-To-Repeat:
> 	Hook up a Powermate.
> 
> >Fix:
> 	Add this line to GENERIC:
> 	ugen*   at uhub? vendor 0x077d product 0x0410
> 
> 	And remove the #if 0 in ugen.c that prevents matches like this from
> 	working:

If it's a HID device, it's correct for it to attach as a uhid device.
That allows usbhidctl(1) and usbhidaction(1) to work with it (along
with any other HID-aware programs).

What is treating it as a mouse though?  Is it attaching as a ums(4)
device?  Perhaps something should be done to prevent that?

The ums(4) driver attaches only if the device has a collection
"Generic_Desktop::Mouse".  Like so:

usbhidctl -f /dev/uhid0 -r
Report descriptor:
Collection page=Generic_Desktop usage=Mouse
Collection page=Generic_Desktop usage=Pointer
Input   size=1 count=1 page=Button usage=Button_1, logical range 0..1
Input   size=1 count=1 page=Button usage=Button_2, logical range 0..1
Input   size=1 count=1 page=Button usage=Button_3, logical range 0..1
Input   size=1 count=1 page=Button usage=Button_4, logical range 0..1
Input   size=1 count=1 page=Button usage=Button_5, logical range 0..1
Input   size=8 count=1 page=Generic_Desktop usage=X, logical range -127..127
Input   size=8 count=1 page=Generic_Desktop usage=Y, logical range -127..127
Input   size=8 count=1 page=Generic_Desktop usage=Wheel, logical range -127..127
End collection
Feature size=1 count=1 page=0x00ff usage=0x0002, logical range 0..1
End collection

Could you dump the HID report descriptor for your device?  Possibly
the ums(4) matching code needs to check for one-dimensional "mice" and
filter them out...

Cheers,

Dave