This project is read-only.

The WinUsbNet class library and associated tools greatly simplify creating a .NET managed application that can communicate directly with a USB device. The recommended download is an MSI installer package that installs the class library, tools, and device driver binaries as well as HTML Help and sample code. (In this context, "install" of the class library and device drivers simply means copying them to your machine, not mucking with the GAC or OS.) While full source code is available, the intention is that the documentation and examples will be all you need to understand how to use the library and tools.

Installation of WinUsbNet creates a WinUsbNet program group on the Start Menu. Once you have installed the basic package, here are the steps to get your USB device talking:

  1. Use the USB INF Builder to create the necessary device driver installation file (INF). This tools provides a GUI to collect basic information about your USB device, such as Vendor ID (VID) and Product ID (PID). You will also use it to create a new GUID that is used to identify your device by WinUSB; you should copy the GUID to the clipboard for later use. The tool inserts the information into a template when you use Create INF on the File menu. (Note that File Save does not create the INF, it just saves the raw data for future use.) The INF should be placed in the Drivers folder of the WinUsbNet installation (e.g., C:\Program Files (x86)\WinUsbNet\Drivers).
  2. Open a command prompt on the Drivers folder. This folder contains the DeviceInstall.exe tool as well as the INF you just created. From the command prompt, run DeviceInstall with your INF as an argument. For example:

    DeviceInstall MyUsbDev.inf

    You should ignore any warning that the device driver is not signed.

    If you will be making an installer for end users, the installer should install the Drivers folder and run DeviceInstall.exe in this manner.

  3. Connect your USB device. You can skip a check for an updated driver from Windows Update. If all goes well, you should find your USB device in Device Manager under Universal Serial Bus controllers, with the product name assigned by the USB INF Builder.
  4. To test, start the WinUsbNet Test App (from the WinUsbNet  program group on the Start menu). Paste the GUID from Step 1 into the USB Device GUID box and click the Find button. The test app should report “Device attached” in its output window. The Endpoint dropdown will list all the available endpoints on the device and their direction. You can now perform control transfers or simple I/O on the endpoints.
  5. To create your own application, add a reference to WinUsbNet.dll (e.g., C:\Program Files (x86)\WinUsbNet\WinUsbNet\WinUsbNet.dll). The first task for your application will be to create a WinUsbManager object using the GUID from Step 1. After that, refer to the WinUsbNet Help which can also be started from the program group. You will also find a shortcut to the main source file for the WinUsbNet Test App, which demonstrates using the class library, particularly in its btnXfer_Click event handler.

See Also:
USB INF Builder
WinUsbNet Test App

Last edited Feb 22, 2012 at 7:53 PM by DosMan, version 6


No comments yet.