BeOS Joystick Framework

This article are more of a compliment to ITO Takayuki’s “BeOS Joystick Driver ” so reading ITO’s article before this one are advisable.

I’m not a article writing person (not even in Swedish) but as I’m the 3:d that tries to implement the Joysticks framework in Haiku I think that it would be good to have something for the 4:th person to read if I drop this :)

When I started to look over the Joystick framework I thought that this would not be that hard, boy was I fooled :) , lol I don’t even know how to talk to hardware. Anyway after some testing (trial and error style) I think I have found some additional information about the Joystick framework, but first I would like to describe how I think the frame work works.

The BJoystick class in libdevice.so talks to a joystick published at dev/joystick/”portname”/”joystick name” this way both the generic gameport and ITO’s usb_joy works as they publish as separate devices.
usb_joy = dev/joysticks/usb/0 (for the first)
usb_joy = dev/joysticks/usb/1 (Second and so on)
gameport = dev/joysticks/gameport/201
etc
emuxkigameport = dev/joysticks/ emuxkigameport /et18

emuxkigameport are a driver that was donated to Haiku that make’s gamport on a SB Live and Audigy soundcard work. I tried to add it to emuxki but then the sound was interfered when I moved the joystick. This driver uses the generic gameport.

So how does this work? You could say we have two ways of talking to Joystick’s, through usb_joy and emuxkigameport. First you must have a copy of a joystick description file in config/settings/joystick/”portname”/”joystick name”. I think that this need to be a copy of a description file as the Joystick Preference app does changes to the file so a link are not to recommend.

First usb_joy, when BJoystick sends a ioct (I haven’t tested but I think I have figured that one out right?) to the driver the usb_joy does everything by itself, collecting usb information and reading joystick description file from /settings/joystick/”portname”/”joystick name”.

How does the emuxkigameport work then? BJoystick sends the same information as with usb_joy but in this case the emuxkigameport forwared the ioct to a driver called generic gameport located under drivers/generic this one loads the file in config/settings/joystick/”portname”/”joystick name” with this file it knows what module to load and loads this module but it must be a joystick description file in this location or you will only be allowed to used the joystick in standard mode (same if the module don’t exist to your joystick).

Using BeOS Joystick Framework in Haiku. Yes this works but not usb_joy as it crashes the system.
You need to copy libdevice.so, Joystick preference app, etc/joysticks, media/joy, generic/gamport and Haiku’s emuxkigameport. I have only tested stickit and BeOS R5 joystick preference and not any games.

So what now? I will continue but perhaps focus on the usb_joy driver and figure out what’s wrong with this driver. I would like to have some help to determent if it would be a good idée to use modules in a USB drive to handle the difference in different joystick’s or does those difference not exist in a USB world?