How do I program a driver for a USB device for windows platform?

18,957

Solution 1

Cheat and use libusb. I did this for a project I've been working on for a while and wrote a C++/wxWidgets app to handle the data.

I've been thinking recently of re-writing the app on the PC in wxPython though as it's much faster for GUI development.

How you want to display / log the data? There are a lot of options available. You can do some pretty cool stuff (easily) with the OpenGL capabilities of wxWidgets whether it's 2D or 3D data representation.

Solution 2

If you can I would suggest using a library like libusb, as kris and Jon Cage have suggested.

If libusb isn't going to suit your needs and you're developing for Windows you should have a look at the software that Jungo provides. Again, this moves the usb software into user space rather than requiring Windows kernel development. (edit 3: Ilya points out in the comment that Jungo is also available for Linux)

If you must do some kernel development (either Windows or Linux) then C is pretty well the only option you have. Investigate this book by Rubini for linux development. For windows driver development I can recommend this book by Oney. But I'd investigate the libusb option in preference to the driver development in both cases.


Btw. If all you are interested in is being able to measure voltages on a usb device (and writing the code isn't important) there are many products out there that will do that for you. Take a look at some of the offerings from National Instruments. These will deal with the hard work of usb and the data acquisition and give you a nice programming interface to use in your application.


(edit 2) There are also some usb-serial chips (eg. these) that can be interfaced directly to an embedded processor usig only a uart. Typically these come with drivers.

Solution 3

Have a look at libusb. It is available for both Linux and Windows.

Solution 4

Since you're still looking for a device that converts voltages into information, I suggest you take a look at devices that implement a USB-HID (Human Interface Device) interface, such as those found here.

They have the benefit of not requiring any device driver development to be made, or drivers to be installed. They are as plug and play as a mouse, keyboard or flash drive. The interface is pretty generic, and most manufacturers also provide the necessary libraries to read the information from the device, be notified when a device is plugged in/out, discover devices, and so on.

In addition, have a look at this article that explains how to use a HID device in C#, for example.

Dave

Solution 5

Unless you're bit-banging your own USB driver on the firmware side, your chip will probably come with a driver for the PC. For example, PIC microcontrollers from Microchip come not only with firmware for the PIC, but with a Windows driver. I expect that other USB-enabled chips would also come with their own drivers.

Remember that while you interact with the USB port directly on the firmware side, on the PC side all you actually interact with is the driver for the host controller.

Share:
18,957
atomicharri
Author by

atomicharri

Just Me.

Updated on June 06, 2022

Comments

  • atomicharri
    atomicharri almost 2 years

    I am looking for a device that reads wiring voltages via a USB interface and returns the data. How would I go about programming something to interpret this data and what language would I use?

    edit: If it helps, this project is to develop a digital tachometre for older engines that don't support a comprehensive ODB2 data port. Therefore, it will read voltages on a DC circuit and have an accurate graphical interface. I have absolutely no idea where to start with all this but am determined to make it work! it's for windows.

  • Ilya
    Ilya over 15 years
    Jungo tool is not only for Windows, Linux supported as well
  • Nick
    Nick about 15 years
    NI has OEM modules which can do this for reasonable cost (<$200). You'll have additional analog channels and digital inputs to play with as well, if you want to expand feature-wise. Check out the USB-6008 OEM.
  • Ponkadoodle
    Ponkadoodle about 13 years
    Just a heads up that your link is broken.