[haiku-bugs] Re: [Haiku] #7429: BJoystick and usb_joy patch

#7429: BJoystick and usb_joy patch
-------------------------------+----------------------------
   Reporter:  caz_haiku        |      Owner:  nobody
       Type:  enhancement      |     Status:  new
   Priority:  normal           |  Milestone:  R1
  Component:  Kits/Device Kit  |    Version:  R1/Development
 Resolution:                   |   Keywords:
 Blocked By:                   |   Blocking:
Has a Patch:  1                |   Platform:  All
-------------------------------+----------------------------

Comment (by caz_haiku):

 Sorry for going missing for a while, i had to work in the evenings last
 month and over the next few months and won't be able to contribute
 properly, i do still want to contribute though.  I saw some action on
 haiku development mailing list about joysticks and i think i know why
 BeSnes9x doesn't work properly with usb_joy.  The reason is because the
 usb_hid driver detects gamepads as a mouse it intereferes with usb_joy,
 both drivers are accessing the hardware at the same time.  I've reproduced
 what you have noticed disraeli that the joystick configuration window just
 populates all or some of the boxes with the same buttons etc.[[BR]]

 I had fixed this problem with a temporary kludge on my haiku and it wasn't
 happening,  for usb_joy to work properly you will have to stop usb_hid
 detecting your gamepad, joystick etc as a mouse.  Here is the kludge i
 used in the file src/add-ons/kernel/drivers/input/usb_hid.  Because my
 mouse has a wheel and a gamepad doesn't then this stops usb_hid from
 detecting a gamepad and then usb_joy works.
 {{{
 ProtocolHandler *
 MouseDevice::AddHandler(HIDDevice *device, HIDReport *report)
 {
         // try to find at least an x and y axis
         HIDReportItem *xAxis =
 report->FindItem(B_HID_USAGE_PAGE_GENERIC_DESKTOP,
                 B_HID_UID_GD_X);
         if (xAxis == NULL)
                 return NULL;

         HIDReportItem *yAxis =
 report->FindItem(B_HID_USAGE_PAGE_GENERIC_DESKTOP,
                 B_HID_UID_GD_Y);
         if (yAxis == NULL)
                 return NULL;

         HIDReportItem *wheel =
 report->FindItem(B_HID_USAGE_PAGE_GENERIC_DESKTOP,
                 B_HID_UID_GD_WHEEL);
         if(wheel == NULL)
                 return NULL;

         return new(std::nothrow) MouseDevice(report, xAxis, yAxis);
 }
 }}}

 Now i'm not saying that usb_joy should be enabled in Haiku src tree, but
 the driver works 100% here with a few gamepads i have and could at least
 be used temporarily if users were willing to build their own.

 Carwyn

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/7429#comment:10>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: