Author Topic: Custom game controllers and drivers  (Read 23335 times)

jserran

  • Member
  • ***
  • Posts: 2
Custom game controllers and drivers
« on: December 04, 2013, 08:12:01 pm »
Not sure if this is too much of a software problem but hopefully I can find some help  :)
I am attempting to use input from a non-standard Xbox 360 controller on PC.
It is a skateboard controller with inputs that don't fully map on to a gamepad by default, giving only partial information on PC. It was released for the Tony Hawk : Ride game.

After figuring out the format of the reports sent by the controller, I thought the next step would be to write a driver to re-map the inputs to a custom mapping somehow.
Wireless controllers connecting through the dongle do not seem to have drivers though, which I don't understand.

I am also not sure about how information is passed through from the dongle, so I'm hoping it just manages connected devices without touching the data. I haven't been able to have a go capturing reports from the actual controller yet unfortunately.

I have been trying to learn how HID devices and drivers work but it seems a big topic I am quite unfamiliar with and I'm finding it hard to locate useful information.

So what I am looking for is a good resource/explanation of what goes on between devices and the OS, and how I might start developing in that environment.
Or any help anyone can offer really  ???

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Custom game controllers and drivers
« Reply #1 on: December 05, 2013, 10:40:05 am »
You can view the report data with a protocol analyzer:

http://www.lvr.com/development_tools.htm#analyzers

A protocol analyzer that shows enumeration will also show the report descriptor, or you can get this information using an application that retrieves the Capabilities structure:

http://www.lvr.com/hidpage.htm#MyExampleCode

An upper filter driver can intercept the data received from the controller. Here is an example:

http://code.msdn.microsoft.com/windowshardware/FIREFLY-WDF-filter-driver-e8b132c3

You could also look into DirectInput:

http://msdn.microsoft.com/en-us/library/windows/desktop/ee416842%28v=vs.85%29.aspx

or raw input:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms645536%28v=vs.85%29.aspx

to see if they offer any solutions.

jserran

  • Member
  • ***
  • Posts: 2
Re: Custom game controllers and drivers
« Reply #2 on: December 09, 2013, 06:08:43 am »
Thanks for you reply.
I believe the controller doesn't have a report descriptor like the standard 360 controller (as I understand it), though I will check when I can. The packets seem to be badly formatted as well.

If I could just use a custom descriptor to map the data to a HID Gamepad structure everything would just work. Is there any way to do this, or is it happening at too low a level to override?
I couldn't find info on the net for doing that on Windows.

Will check out WDK and Raw Input for now and hopefully I'll be able to come up with something.
Cheers

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Custom game controllers and drivers
« Reply #3 on: December 09, 2013, 12:36:49 pm »
Every USB HID-class device has a report descriptor.

If you want to remap the received data, use a filter driver.