Date: Sat, 20 Dec 2008 10:06:48 +0100 From: ElBarto <elbarto@arcadebsd.org> To: freebsd-drivers@freebsd.org Cc: frebsd-usb@freebsd.org Subject: Re: USB Joystick/gamepad driver Message-ID: <494CB5A8.50509@arcadebsd.org> In-Reply-To: <493EE331.8070708@arcadebsd.org> References: <493EE331.8070708@arcadebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
ElBarto wrote: > Hello all, > > I've started a driver for usb joystick and gamepad. > The goal of this driver is to have a complete support for HID and > non-HID device. > For now it support HID device and (partially) the Xbox360 gamepad. > > The driver create a ujoy%d device in /dev . > For now the data are like this : > > AXIS_X AXIS_Y AXIS_Z AXIS_RX AXIS_RY AXIS_RZ SLIDER HAT_SWITCH BUTTONS > All coded in one int each. > > I'll next add some ioctl to, for example, find which axis is present > for the joystick etc .... > > There is of course no userland application which support this driver, > I'm planning to re-do the sdl support > for this driver, but before I want to standardize the driver. > > You can download the driver and a small crappy userland application > here : > http://www.arcadebsd.org/~elbarto/ujoy.tgz > > > This has been tested on FreeBSD 7.0 with two different Thrustmaster > gamepad and a Xbox360 one. > > Comments ? Suggestions ? > Hello again, I've updated the driver, it's now more clean. Now it has a struct ujoy to read the data, the struct is like this : struct ujoy_axis { char present; int value; int min; int max; }; struct ujoy { struct ujoy_axis axis[UJOY_MAXAXIS]; unsigned int hat; unsigned int buttons; }; The value of the axis are as they are read at the joystick. Some joystick/gamepad send value from -127->+127 others from 0->255 etc ... But I think it's to the userland application to decide what to do, that's why I give the min and max of each axis. For what I know the max number of axis of an USB joystick/gamepad is 7 (X, Y, Z, RX, RY, RX, SLIDER) but I may but wrong, if you have an usb joystick please try this driver and tell me if all your axis are not recognize. I've tried to get the name of the device to have a ioctl to get it, but all my attempts were unsuccessful. The drivers has been tried on FreeBSD-7.0-RELEASE-p6 with two thrustmaster gamepad, one Xbox360 usb and a gamecube usb adapter. I've CC'ed freebsd-usb too. -- Emmanuel Vadot elbarto@arcadebsd.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?494CB5A8.50509>