You should come on #openbeos, and ask for damieng, he is working on a devicekit for NewOS. Besides, the BeFAQs website now has a working mirror of the BE devel newsletter, those on joystick and drivers could be of interest... This one http://be.befaqs.com/aboutbe/benewsletter/volume_III/Issue32.html#Insight2 deals with IOCTLs, but only block devices ones it seems. En réponse à Thijs Withaar <t.t.withaar@xxxxxxxxxxxxxxxxxx>: > hi there, > > it seems like no-one is working on the device kit yet. (understandable, > as > it's not > the most important thing). So i've tried to figure out some things > myself. > I'm not an experienced > programmer, so could someone comment on the following, to prevent me > from > making > stupid mistakes ? > > BTW: i have a plain simple gameport driver working under newos. no > joystick > modules are > supported however. > > this is what how i think BeOs works: > > 1) during boot: > loading gameport drivers from : > /boot/beos/system/add-ons/kernel/driver/dev/joystick/* > is scanned. all drivers are loaded if hardware is found for it. > the directory actually contains symlinks to > /boot/beos/system/add-ons/kernel/driver/bin/* > > 2) in the gameport driver > if it's hardware is detected, it is loaded. does basic hardware IO. > on open() it close the device if open, and then opens it. > no joystick module is loaded. > on IOCTL(B_JOYSTICK_SET_DEVICE_MODULE) a joystick module is loaded. > module are placed in > /boot/beos/system/add-ons/kernel/media/joy > and loaded by the kernel upon request from gameport driver. > the joystick module converts raw IO data from the gameport driver to > the correct axes/buttons/hats values. for a generic analog joystick, > the > joystick > module does next to nothing. > > 3) in the Bjoystick class (in /boot/beos/system/lib/libdevice.so ) > BJoystick::~BJoystick(); > (according to behaviour of ::GetDeviceName) : > scanning dev/joystick/* for gameports. > setting up BList _fDevices. > > uses _BJoystickTweaker::ScanDevices to do this ?? > > BJoystick::~BJoystick(); > clean up memory. close device if open. > > BJoystick::CountDevices() > return _fDevices->CountItems(). > > BJoystick::open() > open correct /dev/joystick/*. use IOCTL to load correct joystick > module. > correct module name is determined using > /boot/home/config/settings/joysticks/* > where * is the name of the gameport driver, relative to > /dev/joystick/). > > BJoystick::update() > perform a read on dev/joystick/* > and update all variables of BJoystick class. (like horizontal, > timestamp > etc.) > > BJoystick::SetMaxLatency() > no idea. > > BJoystick::GetDeviceName() > returns devicename like relative to /dev/joystick/ > works before Open() is done. so the _fDevices points to a structure > with at least the devname in it. > > > Questions : > > what does "BList _fDevices" point to ? to _joystick_info ? > > where is struct _joystick_info defined ? > according to BJoystick class it does contain the following vars : > int32 CountSticks(); > int32 CountAxes; > int32 CountHats; > int32 CountButtons; > int16 AxisValues[] > uint8 HatValues[] > uint32 ButtonValues[nr_sticks] /* NOTE: Buttons() are 1 == on */ > BString* AxisName[] > BString* HatName[] > BString* ButtonName[] > BString ControllerModule /* what is this ?? */ > BString ControllerName > bool Calibrated > > > when is "char * m_dev_name" given a value ? > > > > >