Writing a DirectInput driver?

Started by
6 comments, last by Nostalgia 17 years, 11 months ago
Morning, all. I've got a USB device, and I'd like for it to be installed in the Game Controllers applet when it gets plugged in. I've got 3 different driver books, and the WinXP DDK, and can't find any information on how to do it. I'm assuming I have to write a DirectX driver. The DDK comes with 2 sets of dinput samples, but one makes a new joystick type (no driver as far as I can tell), and the other is a force-feedback specific driver. Edited to add, I cannot change the device's USB descriptor to be a HID device. It's using an FTDI chip with the USB decsriptor hard coded in. I already called the company and asked. Any help is greatly appreciated. Thank you, -Joe
Nostalgia, an Intellivision Emulatorhttp://www.gotmaille.com/nostalgia/
Advertisement
I'm not sure that I know of anyone (myself included) that writes input device drivers on this forum. Most people never really touch that side of the APIs, so we never really get any questions about it. Anyhow, have you checked any Microsoft forums or newsgroups? I am sure that they have dedicated ones just for device drivers. Those would most likely be a lot more helpful than here.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
I have written a DirectInput driver for emulating a joystick with a Spaceball controller. However, I can't give you the project code because my client owns it and I'm under agreement not to distribute it for another 2 years.

However, I recommend examining the Microsoft Driver Development Kit (DDK) more. It has a sample that implements a virtual joystick driver but doesn't actually talk to hardware. This is a very nice starting point, you only have to implement the actual hardware I/O yourself as specified by your device's protocol.

To associate a driver to a custom USB class, all you need is an .inf file which refers to the device class guid, and of course your driver that just transfers the I/O around like the generic HID driver.

Handling USB traffic is a lot like handling that of a serial port. The finding of the devices is more involved than simple serial port enumeration, but the Windows kernel provides good means to find all devices by a specific GUID.

Niko Suni

Thanks for the replies.

Nik, are we both talking about the XP DDK? Here's the directory listing in WINDDK/2600.1106/src/input:

dinput
kbdclass
kbfiltr
layout
mouclass
moufiltr
mouser
pnpi8042

I did find hidjoy.c under wdm/hid/hidgame. Is that what you were referring to?

Thanks,

-Joe
Nostalgia, an Intellivision Emulatorhttp://www.gotmaille.com/nostalgia/
Quote:Original post by Nostalgia
Thanks for the replies.

Nik, are we both talking about the XP DDK? Here's the directory listing in WINDDK/2600.1106/src/input:

dinput
kbdclass
kbfiltr
layout
mouclass
moufiltr
mouser
pnpi8042

I did find hidjoy.c under wdm/hid/hidgame. Is that what you were referring to?

Thanks,

-Joe


I implemented my driver three years ago, using the latest DDK that was available then - probably the XP ddk. Search the documentation for "virtual joystick" phrase, I don't remember the exact name of the sample nor the individual filenames (although I can look them up later when I install the DDK again).

Niko Suni

I think HIDgame is what I want. I'm poking around in the source now.

Quote:HidGame is the WDM/HID minidriver for analog joysticks. This driver registers with the HID class driver and responds to IRPs put out by HIDclass. It informs HID class about the capabilities of the joystick and polls the joystick in response to a read IOCTL.


Thanks again!

-Joe
Nostalgia, an Intellivision Emulatorhttp://www.gotmaille.com/nostalgia/
Quote:Original post by Nostalgia
I think HIDgame is what I want. I'm poking around in the source now.

Quote:HidGame is the WDM/HID minidriver for analog joysticks. This driver registers with the HID class driver and responds to IRPs put out by HIDclass. It informs HID class about the capabilities of the joystick and polls the joystick in response to a read IOCTL.


Thanks again!

-Joe


Yea, I think that's the correct one.

I regret that I cannot offer more detailed help for you on the joystick driver due to the NDA I mentioned. However, if you have general questions on device drivers, especially about serial communication i/o handling, I might be able to help you.

I'm not a driver developer by profession, but I know a thing or two about them as I've been interfacing with custom hardware quite a lot in the past.

Niko Suni

Thanks for the offer! I'm working on getting that code to do something. The documentation is contradictory, and references a lot of things that don't exist. Yay, Microsoft!

I've joined the OSR Online mailing list, so hopefully that'll help me in the right direction.

-Joe
Nostalgia, an Intellivision Emulatorhttp://www.gotmaille.com/nostalgia/

This topic is closed to new replies.

Advertisement