-
Notifications
You must be signed in to change notification settings - Fork 1
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 HID keyboards and mice not accessible, as they are reserved by the OS). libusb0.sys and libusbK.sys driver support will also be added soon.
The Windows backend is part of the libusbx official release. While it has been tested for a couple of years and is assumed stable, because it's official inclusion in a release is still recent, 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
7z format so you may have to install 7-zip.
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 at this stage.
Also, if you are using a NEC/Renesas USB 3.0 controller, such as the fairly widespread uPD720200/uPD720200A, please make sure that your controller drivers are version 2.1.16.0 or later. Older versions of the drivers are known to have a bug that prevents access to USB devices.
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, 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/
If your target device is not HID, you install a driver before you can communicate with it using libusbx. Currentlty, this means installing Microsoft's WinUSB driver. Two options are available:
- Easiest: Use the most recent version of Zadig, an Automated Driver Installer GUI application for
WinUSB.- Note: Zadig also allows the selection and installation of the latest libusb-win32 and libusbK drivers.
- Or you can download the WinUSB driver files and customize the
inffile 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. If needed, it is also 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 will require a redesign of the libusbx API, so is won't occur before libusbx 2.0.
-
WinUSBcannot be used to send an actual reset command to an USB device. -
WinUSBcannot be used to set a device configuration that is different from the first one. -
WinUSBdoes not support multiple concurrent applications (as per the MSDN documentation). -
WinUSBdoes not support isochronous transfers. - HID keyboards and mice cannot be accessed using the native HID driver as Windows reserves exclusive access to them.
- The HID Report Descriptors provided by libusbx are recomposed and may present minor differences from the actual ones, as the Windows HID API does not allow to read them directly from the device.
- 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.sysdriver 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.NTamd64toSourceDisksFiles.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