Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing a game controller driver for some hardware connected via USB

I'm looking to create a driver for a game controller I have (a cobalt flux www.cobaltflux.com ). The physical controller itself has nine face buttons and two control-box buttons (start/select). The control box has a usb port, but as far as I can tell no one has ever written drivers for it before. The end result I want is to be able to plug in the cobalt flux via the usb port and have windows recognize it as a game controller.

I have some programming experience. I'm a senior undergraduate student in computer science at UC Davis and an intern at a large embedded systems company, however this project involves several aspects I have no experience in: interfacing hardware and software via a USB port, investigating feedback from hardware I didn't build (which bits light up when I press a button?), and creating drivers and indeed programs in general for windows.

Since I don't personally know anyone who would be able to set me on the right track for a workflow to solve this problem, I'm asking here. I imagine the approach going something like:

I connect the device via a usb

I open up a program to poll what the effects of pushing buttons are on the USB channel

I write a program that interfaces those signals from the USB port to the game controller drivers that windows has

It may be worthwhile to note that I need to have joyPAD support and not joySTICK support for the buttons since play will involve pressing down any number of buttons at once and joysticks generally only register one direction of input at any given time.

Any advice or help would be greatly appreciated. I am having trouble figuring out where to start.

like image 696
user2601064 Avatar asked Jul 19 '13 21:07

user2601064


People also ask

How do I configure a USB game controller?

To open the Set up USB game controllers utility, follow the steps below. Press the Windows key , type game controller, and then select the Set up USB game controllers option in the search results. Click the name of the joystick or gamepad you want to test and click the Properties button or link.

What is USB controller driver?

A USB host controller driver controls the way that peripheral devices communicate with a computer's main system. The driver establishes contact between a USB device, such as a keyboard or printer, and ensures that the computer's operating system recognizes it.


1 Answers

I have exactly the same problem for more than a year now and I did not found the right solution yet.

When you plug in the pad via USB it announces with a device ID and a vendor ID which device it is. Windows Plug-and-Play starts searching for a driver. This mechanism spots it is a pointing device (in my case one or 2 mice) and makes sure that it is treated as a raw data input device. Input from these devices is converted to messages handled by the OS. The solution seems to be to pass the messages of such a raw input device to the right handler. In my case the two mice are both recognised as mice and the messages are used by the same handler as the ones coming from the 3rd mouse that is really my pointing device. I am not experienced enough in C++ coding in order to dig into the rawinput API. I just received an interesting link as answer on my question: http://www.icculus.org/manymouse/ at least this gives an answer on my problem. May be it will give you ideas for writing your driver! Good luck !!! Stefan

like image 153
noste99 Avatar answered Oct 06 '22 15:10

noste99