Created Release: WinUsbNet Executables and Help Installer (Feb 19, 2012)
Updated Release: WinUsbNet Executables and Help Installer (Feb 19, 2012)
Updated Release: WinUsbNet (Feb 19, 2012)
WinUsbNet.chm is the HTML help by itself. This is quick download to get you more detailed information before deciding to use the class library.
Updated Release: WinUsbNet (Feb 19, 2012)
WinUsbNet.chm is the HTML help by itself. This is quick download to get you more detailed information before deciding to use the class library.
WinUsbNet.zip is the whole enchilada. All the source code and VS2008 project files, including help example and the installer.
Updated Release: WinUsbNet (Feb 19, 2012)
WinUsbNet.chm is the HTML help by itself. This is quick download to get you more detailed information before deciding to use the class library.
WinUsbNet.zip is the whole enchilada. All the source code and VS2008 project files, including help example and the installer.
Released: WinUsbNet v. 1.0.0 (Feb 21, 2012)
WinUsbNet.chm is the HTML Help by itself. This is quick download to get you more detailed information before deciding to use the class library.
WinUsbNet.zip is the whole enchilada. All the source code and VS2008 project files, including help example and the installer.
Updated Release: WinUsbNet v. 1.0.0 (Feb 21, 2012)
WinUsbNet.chm is the HTML Help by itself. This is quick download to get you more detailed information before deciding to use the class library.
WinUsbNet.zip is the whole enchilada. All the source code and VS2008 project files, including help example and the installer.
Updated Wiki: Home
The WinUsbNet class library gives .NET managed code direct access to USB devices through WinUSB, the generic USB device driver included with Windows. The project also includes tools to create & install WinUSB installation files, and a sample application.
Purpose
This project is intended for developers who are creating their own USB device. Using WinUsbNet eliminates the need to understand anything about Windows device drivers. If you know what a USB endpoint is and can use the .NET Framework classStream, you know enough to transfer data between your application and your USB device.This project could also be useful for someone who wants to make their own interface to an existing USB device. You will need to understand the data transfer protocols of the target device.
Project Components
- USB INF Builder creates the Windows device driver installation file (INF) that makes WinUSB the device driver for a given USB device.
- Microsoft's installer for WinUSB is included, both 32-bit and 64-bit.
- DeviceInstall, the device driver installer, registers the INF with Windows and makes sure WinUSB is installed.
- The WinUsbNet class library provides the interface between your application and the USB device. Complete documentation of the library in HTML Help is included.
- The WinUsbNet Test App is a sample application that lets you set up small data transfers with the USB device.
Updated Wiki: Documentation
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:
- 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 useCreate 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).
- 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.
- 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.
- To test, start the WinUsbNet Test App (from the WinUsbNet program group on the Start menu). Paste the GUID from Step 1 into theUSB 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.
- 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 aWinUsbManager 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
Updated Wiki: USB INF Builder
Using the USB INF Builder
Just fill in the blanks. Each item includes an explanation in the help region at the bottom. You should create a new GUID, then use the clipboard to copy that GUID into your application source code.
The output file path should be in the Drivers folder of the WinUsbNet installation. This folder has subfolders with Microsoft’s installers for WinUSB.
You can save the data you enter using the Save command on theFile menu. This makes it easy to make changes later. You actually create the INF with theCreate INF command on the File menu, or by using the
button on the toolbar.
The USB INF Builder can also create an INF for a device that will appear as a serial port using the standard windows driver UsbSer.sys. This requires that the device adhere to the USB specification for the Communication Device Class (CDC) using Abstract Control Management (ACM).
Updated Wiki: WinUsbNet Test App
Using the WinUsbNet Test App
To use the WinUsbNet Test App, first copy & paste the GUID that WinUSB uses to identify the device. If you used the USB INF Builder, copy the GUID from there. Clicking theFind button will cause a search for any matching devices already attached. The app will also track as devices are attached and detached.
Tooltips are used to explain the usage of each element on the interface. Take a moment to hover the mouse over the various controls. Controls can become enabled or disabled depending on the endpoint and direction selected.
To transfer data, select an endpoint from the dropdown. Most endpoints are eitherIn or Out, but as shown in the screenshot, it is possible for a single endpoint to be both. To read data from anIn endpoint, just set the number of bytes to read in the Read Length box (decimal) and click the Transfer Data button. The data will show up as hex bytes inblue in the output window. To send data to an Out endpoint, enter the data in the Out Data (hex) text box as a sequence of hex bytes separated by spaces, then click theTransfer Data button. The data you send will be displayed in the output window ingreen.
If relevant to your application, you can perform a USB control transfer by selecting “Control” from the Endpoint dropdown. This will enable the group box labeled Control Transfer (hex values), where you can enter the specifics. You will need to understand USB control transfers, although some basic help is available in tooltips.
New Post: HID device not found
Hello !
I just tried your lib and used the example app. I paste-in the
GUID of the HID class, but my device - which is working - was
not found. Any help would be great.
Btw, I found it ugly to beeing forced to specify a GUID.
The most libs, I found so far, use PID/VID of a device
to identify it. Would it be easy to change the WinUsbManager
manager class to search devices that way ??
Thanks anyway.
++mabra
Source code checked in, #22734
Source code checked in, #22735
New Post: creating and sending input on in-point for Generic HID mouse device and how to create?
New Post: HID device not found
New Post: HID device not found
New Post: HID device not found
https://www.nuget.org/packages/HidSharp/
http://www.zer7.com/software/hidsharp
VID/PID is the most common way on other platform since there is no concept of GUID together with USB devices. I do believe that a VID/PID based enumeration would be a usefull feature, but than again DosMan has a Point in working only with GUID.