-
-
Notifications
You must be signed in to change notification settings - Fork 116
Windows Backend
IMPORTANT: NEC/Renesas USB 3.0 users, please upgrade your drivers to version 2.1.16.0 or later. Older versions of the driver have a bug that prevents libusbx from accessing devices.
This project adds Windows platform support to the libusbx Open Source library, in order to help developers easily communicate with USB devices on Windows. Currently it supports the WinUSB and HID drivers for generic USB device access (with a restriction for HID keyboards and mice, as only the system can access them). libusb0.sys and libusbK.sys driver support will also be added soon.
The Windows backend is part of the libusbx 1.0.9 official release. While it has been tested for a couple of years and is assumed stable, because libusbx v1.0.9 marks its first official release, it should be considered EXPERIMENTAL over the next few releases.
Pre-built binary snapshots are provided in the release directory under /<current-version>/Windows/
.
These are provided AS IS for your convenience, generated for the following environments:
- Microsoft Visual Studio and DDK/WDK → MS32(32 bit) and MS64 (64 bit) directories
- MinGW -> MinGW32 (32 bit) and MinGW64 (64 bit) directories
Supported systems are all Windows platforms, starting with Windows XP, and including 64 bit versions, with the following exceptions:
- Windows 2003 (Microsoft does not support WinUSB on 32bit/64bit Windows 2003)
- Windows XP 64 bit (Microsoft does not officially support WinUSB on 64bit Windows XP)
libusbx supports USB 3.0 controllers and devices on Windows. Because of the large number of USB 3.0 controllers, the lack of official USB 3.0 support from Microsoft in Windows 7 and earlier as well as limited testing, be mindful that USB 3.0 support should still be considered experimental.
Also, if you are using a NEC/Renesas USB 3.0 controller, such as the fairly widespread uPD720200
/uPD720200A
, make sure that your controller drivers are version 2.1.16.0 or later. Older versions of the drivers have a bug that prevents access to USB devices when using libusbx.
libusbx has been tested under the various Windows 8 Previews (Developer, Consumer, Release) for both 32 and 64 bit and no issues were found.
A .NET version of libusbx, called LibUsbDotNet, based on libusbx 1.0 and the Windows backend has also been developed by Travis Robinson. If you plan to use libusbx in a .NET project, make sure you check http://libusbdotnet.sourceforge.net or http://sourceforge.net/projects/libusbdotnet/
To access your USB devices with the Windows backend, if not using HID, you will need to install the WinUSB driver. Two options are available:
- The easiest option is to use the most recent version of the Automated Driver Installer GUI application Zadig.exe.
- Note: Zadig also allows the selection and installation of the latest libusb-win32 and libusbK drivers.
- Or you can download the WinUSB driver files, then customize the
inf
file for your device.
The handling of composite devices under Windows is done with multiple drivers, descendants of the usbccgp.sys
driver (Composite Generic Parent), as this is the default for the OS. For more info, see "2. How Windows handles a composite device" at http://www.cygnal.org/ubb/Forum9/HTML/001050.html. It is however possible to replace the composite parent driver with WinUSB to access the device.
Because Windows does not provide a native poll()
function, and cygwin is the only development environment that provides such a call, the use of libusbx file descriptors with poll()
on cygwin is NOT supported. In a future version of libusbx, we should provide better handling of native Windows events, but this requires a redesign of the libusbx API, so is unlikely to occur before libusbx 2.0.
- WinUSB cannot be used to send an actual reset command to an USB device.
- WinUSB cannot be used to set a device configuration that is different from the first one.
- WinUSB does not support multiple concurrent applications (as per the MSDN documentation).
- WinUSB does not support isochronous transfers.
- Because there is no native
poll()
on Windows, the ability to return externally pollable file descriptors on Windowslibusb_get_pollfd()
returns an error.
-
libusb0.sys
&libusbk.sys
driver support - hotplug detection
-
How to Use WinUSB to Communicate with a USB Device & WinUSB (Winusb.sys) Installation.
Note that the inf file given in the howto has a typo. If you don't changeSourceDisksFiles.NTamd64
toSourceDisksFiles.amd64
, the driver installation will fail to copy the required DLLs on 64 bit systems... - Using WinUSB for User-Mode to USB Device Communication
- WinUSB User-Mode Client Support Routines
- Microsoft's USB Core Team Blog (including resources on instrumenting the USB stack in Windows 7)
- additional information about Windows Co-Installers
- Finding Memory Leaks Using the CRT Library