USB HID Driver help
Tony Shadwick
tshadwick+freebsd-arch.freebsd.org at oss-solutions.com
Mon Feb 26 21:05:47 UTC 2007
I'm definitely not a high-end programmer, but I have gone to the trouble
of working out the protocol for a USB light gun that is normally used on
a Playstation 2 video game console. It has 10 buttons, and can track
on-screen location if it has access to the composite sync video signal.
http://forum.arcadecontrols.com/index.php?topic=60813.0
I've written just a basic parser for the gun. FreeBSD picks up the gun
and gives it a ugen character device that I then take continuous input
from. The protocol is 6 bytes long repeated pretty much as fast as the
gun can send it.
What I would like to do is create a USB HID driver for the gun so that
things like MAME can use it, and for the fun of it perhaps even X11 pick
it up as a mouse. There are two linux drivers out there already, one
for the stock GunCon 2:
http://mywebpages.comcast.net/bgoines78/
and one for a variant on the GunCon2 called "LCD Topgun":
http://kaillera.com/topgun/
The oddity about this is that all version of the gun, 3rd party, first
party, whatever, all present themselves as the same Vendor ID and
Product ID, so there's no way (that I'm aware of) to distinguish a GunCo
2 from an LCD Topgun, from a Mad Catz lightgun, etc. Perhaps there are
other values that can be queried to figure it out, but I'm not that far
in yet.
I've looked at the ugen driver, and it doesn't seem right that I copy
that driver and just change values. I also don't know what headers need
to be included to create basically a 10 button mouse. The Linux code
isn't very portable in that regard. The basic logic is sound I suppose,
but I've looked at the developer's handbook, and although it hits the
very basics, there's nothing that say "this is how you would go about
creating a valid HID driver for FreeBSD".
It could be that I'm looking at it backwards, and the hardware is
supposed to conform to a standard that the software expects, and really
what I'm trying to do is a create a "middleware" that translates the
gun's native protocol to HID standards, but if that's the case, how is
the Linux driver doing it?
Anyway, I'd appreciate any help!
Tony
More information about the freebsd-arch
mailing list