views:

43

answers:

3

If I was told I needed to create a driver for some product (say, a game controller), how would I go about creating one? Is this something you could do normally in C/C++?

And what about firmware for external deviced connect to USB? How is this created usually? Is this also done in C/C++, or some lower level language?

Thanks!

+1  A: 

You do it in any language that can talk to the interface. If it requires poking ports or addresses directly then you use assembly or C. If there's a higher-level interface such as libusb then you can use almost any language you like.

Ignacio Vazquez-Abrams
+1  A: 

Device drivers for desktop computer operating systems are generally written in either C or C++. The operating system you would target will have some form of framework or device driver development environment. Often these development kits can be obtained free of charge.

There are books available for Windows, Linux, and MacOS X (and others) that detail the process of creating a device driver.

If your driver is related to a device on a specific hardware bus (PCI, PCI-X, USB, SCSI, SATA, etc.) you can also get books on that specific technology. An understanding of that hardware system can greatly facilitate the design of your driver.

Another good resource is the open source code for similar devices to yours. You can obtain that from the Linux kernel source or FreeBSD source and study how certain aspects of your type of device are implemented.

EDIT: I nearly forgot to mention that you will also need data sheets, schematics, and/or theory of operation information about the device itself.

Amardeep