[haiku-commits] Re: r41851 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid

  • From: "Michael Lotz" <mmlr@xxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 03 Jun 2011 15:50:08 +0200

> > I will test it ASAP with a Saitek X52 Pro, which has more than 32
> > buttons, a MFD, a builtin (but wacky) mouse, an about 16 axis. The 
> > HID
> > descriptors list is huge.
> 
> Just did. It works surprisingly well, all 6 axis are handled 
> correctly
> (stick + rudder, throttle and 2 dial axis) and the first 32 buttons 
> of
> 38 available are working fine too.

Surprisingly? ;-)

Good to hear though.

> Any idea how to enhance the API without breaking binary compatiblity
> to support as much buttons as available and not up to 32 only?

Right now they are returned with "uint32 BJoystick::ButtonValues()" 
which just returns the uint32. A "bool BJoystick::ButtonValue(int32 
ofButton)" could be introduced that returns the state for a specific 
button, however that's not really nice overhead wise. Alternatively a 
"uint32 BJoystick::ButtonValues(int32 block)" could be introduced where 
the block argument would designate which 32 button "block" one wants to 
address. From an application developer side of things this isn't really 
nice either though as you have to explicitly take the 32 bit blocking 
into account. So the first version might be the easiest (the one that 
takes a button index and returns a bool), as you can easily use that in 
a loop without any additional logic.

After this has been implemented the BJoystick <-> driver interface has 
to be adjusted accordingly as well of course. Since this is completely 
private and only usb_hid exists to implement it right now, that 
shouldn't be too much of a problem though.

Regards
Michael

Other related posts: