|Version 208 (modified by pbatard, 19 months ago) (diff)|
IMPORTANT: NEC/Renesas USB 3.0 users, please upgrade your drivers to version 220.127.116.11 or later.
Older versions of the driver have a bug that prevents libusb from accessing devices.
This project adds Windows platform support to the libusb-1.0 Open Source library, in order to help developers easily communicate with USB devices on Windows.
Currently it supports the [msdn.microsoft.com/en-us/library/windows/hardware/ff540207.aspx WinUSB] driver for generic USB device access, with more drivers to be added later.
As is the case with newly integrated code, the Windows backend should be considered EXPERIMENTAL and will continue to remain so until a few months after the first official release of libusb-1.0 that includes it. Currently, it is still in pre-release stages, with only parts of it included in the official libusb v1.0 tree and some more parts in the latest Release Candidate.
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 support WinUSB on 64bit Windows XP)
Supported development environments
The following development environments are currently supported for libusb 1.0 on Windows:
- MinGW (32 bit) or MinGW-w64. TDM64 is a good MinGW-w64 distribution under Windows. It is also possible cross-build libusb-1.0 Windows backend under Linux or other OS using MinGW and MinGW-w64.
- Microsoft Visual C++ (Visual Studio), either Express or full version, starting with version 6.0. You should be able to produce both win32 and x64 binaries using Visual C++. Take note that the Express version of Visual C++ can not produce 64bit binaries. Also note that you may have to install the Windows SDK if trying to compile for 64 bit with Visual C++ Express.
- Windows DDK build environment, which is freely available, through the use of the 'ddk_build.cmd' file. This will also produce both 32 and 64 bits binaries.
- Cygwin. Cygwin currently can not produce 64bit binaries.
For those not familiar with git, here are the git commands you can use retrieve and compile the Windows branch:
git clone git://git.libusb.org/libusb-pbatard.git ; retrieve development branch (this only needs to be done once) cd libusb-pbatard git pull ; keep in sync with the remote tree
If you want to switch to using a branch (eg. HID), you can do so by issuing the following. This only needs to be done if you want to use an alternate branch (i.e. if you know what you are doing). If you are new to libusb/Windows, you should skip this part.
git branch -a ; list all the remote branches git checkout -b HID origin/HID ; switch to the HID branch
On Windows, if you don't want to use git on the commandline, you can use TortoiseGit to access and keep in sync with the git repository.
Note that before you can install TortoiseGit you need to install MSysGit.
Also note that, for MinGW and cygwin, as with the original libusb 1.0 development tree, you need to run ./autogen.sh in order to have configure and Makefile created for you.
Creating applications using libusb
To create projects relying on libusb 1.0, please refer to how the example executables (lsusb, xusb) are compiled.
If you use a recent version (post pbr315), no additional libraries should be needed besides libusb.
USB 3.0 support
libusb 1.0 supports USB 3.0 controllers and devices on Windows, from pbr339 onwards. Because of the large number of USB 3.0 controllers existing, the lack of official USB 3.0 support from Microsoft and limited testing, be mindful that USB 3.0 support should be considered experimental at this stage and may not work as expected. Also, if you are using a NEC/Renesas USB 3.0 controller, such as the fairly widespread uPD720200/uPD720200A, you please make sure that your controller drivers are version 18.104.22.168 or later. Older versions of the drivers have a bug that prevents access to USB devices when using libusb.
A .NET version of libusb, called LibUsbDotNet, based on libusb 1.0 and the Windows backend has also been developed by Travis Robinson.
If you plan to use libusb 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 you need to install the relevant driver. Two options are available:
- The easiest option is to use the most recent version of the Automated Driver Installer GUI application Zadig.exe, which is part of libwdi, the Windows Driver Installer library.
The current version, which is compatible with both 32 and 64 bit Windows platforms starting with Windows XP, can install a WinUSB driver for any USB device.
Note that because the installer needs to run with administrative privileges, it is recommended to check the md5 checksum after download (or recompile your own version from the source)
- Or you can download the WinUSB driver files, then customize the .inf for your device and install the driver by following the instructions that are either provided here or in the README file that comes with the driver archive.
Latest Binary Snapshots
The following pre-built binary snapshots 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
Note that these archives are provided in the 7z format so you may have to install 7-zip.
- 2011.11.02 (pbr346)
- 2011.09.23 (pbr345)
- 2011.09.19 (pbr344)
- 2011.09.07 (pbr342)
- 2011.07.20 (pbr341)
- 2011.07.06 (pbr340)
- If you want to access devices outside of WinUSB WinUSB, such as HID ones, you can use the HID branch, which is maintained separately due to an executive decision by the libusb maintainer to remove HID support for Windows. Or you can use another library such as HIDAPI.
- Windows' handling of composite devices is done with multiple drivers (VID_####&PID_####&MI_##), descendants of the usbccgp.sys driver (Composite Generic Parent), as this is Windows' default. 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 libusb file descriptors with poll() on cygwin is NOT supported. In a future version of libusb, we will try to provide better handling of native Windows events, but this will require a redesign of the libusb API, so is unlikely to occur before libusb 2.0.
- WinUSB cannot be used to send an actual reset command to an USB device. This is a limitation of the Microsoft driver.
- WinUSB cannot be used to set a device configuration that is different from the default one. This is a limitation of the Microsoft driver.
- WinUSB does not support multiple concurrent applications (as per the MSDN documenation).
- WinUSB does not support isochronous transfers.
- When using interface control requests (LIBUSB_RECIPIENT_INTERFACE), WinUSB overrides the low byte of wIndex with the destination interface. This is a limitation of the Microsoft driver. See here for more details.
- Because there is no native poll on Windows, the ability to return externally pollable file descriptors on Windows (libusb_get_pollfd) returns an error.
- libusb-win32/libusbK integration
- hotplug detection
- HID removal
- automated driver installation (libwdi)
- full pthread-win32 dependency removal
- multithreading/concurrent access
- HID support
- device enumeration
- descriptors retrieval
- composite devices & interface selection
- poll and pipe
- control transfers
- bulk/interrupt transfers
- device reset
- transfer cancellation
- MSVC compatibility
Development's status log
- 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 change SourceDisksFiles.NTamd64 to SourceDisksFiles.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
The libusb-devel mailing list exists for the users of the library, plus developers interested in contributing to the library itself.
(145.1 KB) -
added by pbatard 3 years ago.
Precompiled version of pthread-win32, for 32 and 64 bit platforms, /MT and /MD versions, with 64 bit patch applied (Orin Eman)
(345.5 KB) -
added by stuge 3 years ago.
libusb-pbatard.git 1ebd8c90 cross-compiled using x86_64-w64-mingw32
Download all attachments as: .zip