Quantcast

USB Joystick/gamepad driver

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

USB Joystick/gamepad driver

Emmanuel Vadot-3
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 ?

--
Emmanuel Vadot
[hidden email]
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: USB Joystick/gamepad driver

Emmanuel Vadot-3
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
[hidden email]

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
To unsubscribe, send any mail to "[hidden email]"
Loading...