11
votes

How should I approach implementing a USB device driver for Windows? How should I take into account different versions of windows e.g: - Windows XP - Windows Vista - Windows 7

Is there open source solutions which could be used as a starting point? I'm a total newbie to windows driver development.

We have an embedded device with USB device port and we would like to have as low latency communication from the application level to the device as possible without sacrificing the data throughput. The actual data transferred is ADC/DAC data. Basically there is a lot of data which we need to transfer to a Windows machine as fast as possible.

4

4 Answers

12
votes

We need more information about the device to point you in the right direction, but here are a few steps to get you started:

  • register with Microsoft Connect so you can download the Windows Driver Kit
  • register with osr-online as you'll find great articles, plenty of information, and a newsgroup dediciated just to Windows drivers -- this place is a goldmine
  • buy Developing Drivers with WDF, which will help you make sense of driver development on Windows and give you a good foundation to read articles from OSR and Microsoft
  • Hope that you can use UMDF (user-mode drivers) as you can use C++ and just write COM code. If you're doing anything with USB that requires kernel-space....you've got a lot of reading and learning to do for the next year!

To answer your question on versions, the Driver Kit has tools that will help you manage creating different drivers. If you write a good driver, it should run on all three OS with no problems, and the differences will just be in the config area (not the binary)

Basically, it depends on how complex your device is. What type of driver are you trying to write? File system? MP3 player? Camera? Modem?

If you end up having to write a kernel mode driver, let me know and I can point you to some good articles and what not.

I should also add that for around US $5,000, you can buy a license for WinDriver, a tool that takes all of the hard stuff out of driver development. You can use C++ or C# user-mode code to communicate with their driver that is custom generated for your device. This is the way to go if you have a tight deadline.

2
votes

You can take a look at windows variant of libusb *here*. There are wrappers for many programming languages on official libusb site and on the web.

1
votes

If you have some form of control over the device side, have it implement an interface for which Windows already provides drivers. E.g. the USB HID class (literally Human Input Device, but neither the Human nor the Input is mandatory) already has Windows drivers, and there is a reasonable Win32 API on top. You're not going to get data rates anywhere near 480 Mbps, though.