Changes between Version 203 and Version 204 of windows_backend
- Timestamp:
- 10/19/11 19:15:22 (19 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
windows_backend
v203 v204 9 9 10 10 This project adds Windows platform support to the [[WikiStart|libusb-1.0]] Open Source library, in order to help developers easily communicate with USB devices on Windows.[[BR]] 11 Currently it supports the [ http://msdn.microsoft.com/en-us/library/windows/hardware/ff540174.aspx WinUSB] driver for generic USB device access, with more drivers to be added later.11 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. 12 12 13 13 == Status == … … 23 23 The following development environments are currently supported for libusb 1.0 on Windows: 24 24 * [http://www.mingw.org MinGW] (32 bit) or [http://mingw-w64.sourceforge.net/ MinGW-w64]. [http://tdm-gcc.tdragon.net/download 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. 25 * [http://msdn.microsoft.com/en-us/visualc/default.aspx 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 Microsoft crippled the 2010 version of Visual C++ Express, so that it chokes on importing project files that have 64 bit builds. If you plan on using Express 2010, you'll have to recreate the project files from scratch.25 * [http://msdn.microsoft.com/en-us/visualc/default.aspx 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. 26 26 * [http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=36a2630f-5d56-43b5-b996-7633f2ec14ff 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. 27 27 * [http://www.cygwin.com/ Cygwin]. Cygwin currently can not produce 64bit binaries. … … 44 44 45 45 On Windows, if you don't want to use git on the commandline, you can use [http://code.google.com/p/tortoisegit/ TortoiseGit] to access and keep in sync with the git repository.[[BR]] 46 Note that before you can install [http://code.google.com/p/tortoisegit/ TortoiseGit] you need to install [http://code.google.com/p/msysgit/ MSysGit] and make sure that, during the installation of MSysGit, when prompted to adjust the PATH environment, you select "Run Git from the Windows Command Prompt" (2nd option). Also, in the general settings of [http://code.google.com/p/tortoisegit/ TortoiseGit], the MSysGit path must point to the MSysGit bin directory (eg: C:Program Files (x86)Gitin")46 Note that before you can install [http://code.google.com/p/tortoisegit/ TortoiseGit] you need to install [http://code.google.com/p/msysgit/ MSysGit]. 47 47 48 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 Makefilecreated for you'''.48 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'''. 49 49 50 50 == Creating applications using libusb == 51 51 52 To create projects relying on libusb 1.0, please refer to how the example executables ( lusb, xusb) are compiled.[[BR]]53 If you use a re vision post '''pbr315''', no additional libraries are needed besides libusb.52 To create projects relying on libusb 1.0, please refer to how the example executables ({{{lsusb}}}, {{{xusb}}}) are compiled.[[BR]] 53 If you use a recent version (post [http://git.libusb.org/?p=libusb-pbatard.git;a=shortlog;js=1 pbr315]), no additional libraries should be needed besides libusb. 54 54 55 55 == USB 3.0 support == 56 56 57 libusb 1.0 s hould support 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 support ofUSB 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.57 libusb 1.0 supports USB 3.0 controllers and devices on Windows, from [http://git.libusb.org/?p=libusb-pbatard.git;a=shortlog;js=1 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. 58 58 59 Also, if you are using a NEC/Renesas USB 3.0 controller, such as the fairly widespread uPD720200/uPD720200A, you MUST upgrade your controller drivers to [http://www.station-drivers.com/page/nec.htm version 2.1.16.0 or later]. Older versions of the driver have a bug that prevents access to USB devices withlibusb.59 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 [http://www.station-drivers.com/page/nec.htm version 2.1.16.0 or later]. Older versions of the drivers have a bug that prevents access to USB devices when using libusb. 60 60 61 61 == .NET support == 62 62 63 63 A .NET version of libusb, called [http://libusbdotnet.sourceforge.net/V2/Index.html LibUsbDotNet], based on libusb 1.0 and the Windows backend has also been developed by Travis Robinson.[[BR]] 64 If you plan to use libusb in a .NET project, pleasemake sure you check [http://libusbdotnet.sourceforge.net] or [http://sourceforge.net/projects/libusbdotnet/]64 If you plan to use libusb in a .NET project, make sure you check [http://libusbdotnet.sourceforge.net] or [http://sourceforge.net/projects/libusbdotnet/] 65 65 66 66 == Driver Installation == 67 67 68 68 To access your USB devices with the Windows backend you need to install the relevant driver. Two options are available: 69 * The easiest option is to use the most recent version of our Automated Driver Installer GUI: "zadig.exe", which is part of the Windows Driver Installer library, '''[http://libwdi.sf.net libwdi]'''.[[BR]]70 The current version, which is compatible with both 32 and 64 bit Windows platforms , should be able to install a WinUSB driver for any USB device for supported Windows OS versions like XP, Vista and Windows 7.[[BR]]71 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 [http ://git.libusb.org/?p=libwdi.git;a=shortlogthe source])[[BR]]72 * [https://sourceforge.net/projects/libwdi/files/zadig/ zadig.exe](You may have to install [http://www.7-zip.org/download.html 7-zip] to uncompress the .7z file)[[BR]]69 * The easiest option is to use the most recent version of the Automated Driver Installer GUI application '''[https://sourceforge.net/projects/libwdi/files/zadig/ Zadig.exe]''', which is part of [http://libwdi.sf.net libwdi], the Windows Driver Installer library.[[BR]] 70 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.[[BR]] 71 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 [https://sourceforge.net/apps/mediawiki/libwdi/index.php?title=Main_Page#Source the source])[[BR]] 72 * '''[https://sourceforge.net/projects/libwdi/files/zadig/ Zadig.exe]''' (You may have to install [http://www.7-zip.org/download.html 7-zip] to uncompress the .7z file)[[BR]] 73 73 NB: When run in advanced mode, Zadig should allows the selection and installation of the latest [http://sourceforge.net/apps/trac/libusb-win32/wiki libusb-win32] and [http://code.google.com/p/usb-travis/ libusbK] drivers.[[BR]] 74 * Or you can download the [http://libusb-winusb-wip.googlecode.com/files/winusb%20driver.zip WinUSB driver files], then customize the .inf for your device and install the driver by following the instructions that are either provided [wiki:winusb_driver_installation here] or in the READMEfile that comes with the driver archive.74 * Or you can download the [http://libusb-winusb-wip.googlecode.com/files/winusb%20driver.zip WinUSB driver files], then customize the {{{.inf}}} for your device and install the driver by following the instructions that are either provided [wiki:winusb_driver_installation here] or in the {{{README}}} file that comes with the driver archive. 75 75 76 76 == Latest Binary Snapshots == … … 80 80 * MinGW -> MinGW32 (32 bit) and MinGW64 (64 bit) directories 81 81 82 Cygwin users should be able to use the MinGW (32 bit) library with the option -mno-cygwin[[BR]]Note that these archives are provided in the 7z format. If you need a decompressor, you caninstall [http://www.7-zip.org/ 7-zip].82 Note that these archives are provided in the 7z format so you may have to install [http://www.7-zip.org/ 7-zip]. 83 83 84 84 * '''[http://libusb-winusb-wip.googlecode.com/files/libusb_2011.09.23.7z 2011.09.23 (pbr345)]''' … … 92 92 == Development Considerations == 93 93 94 * If you want to access devices outside of WinUSB [http://msdn.microsoft.com/en-us/library/ aa476426.aspx WinUSB] or libusbK, such as HID ones, you can use the [http://git.libusb.org/?p=libusb-pbatard.git;a=shortlog;h=refs/heads/HID;js=1 HID branch], which is maintained separately due to an executive decision by the currentlibusb maintainer to remove HID support for Windows. Or you can use another library such as [http://www.signal11.us/oss/hidapi/ HIDAPI].95 * Windows' handling of composite devices is done with multiple drivers ( VID_####&PID_####&MI_##), descendants of the usbccgp.sysdriver (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.96 * 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.94 * If you want to access devices outside of WinUSB [http://msdn.microsoft.com/en-us/library/ff540196.aspx WinUSB], such as HID ones, you can use the [http://git.libusb.org/?p=libusb-pbatard.git;a=shortlog;h=refs/heads/HID;js=1 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 [http://www.signal11.us/oss/hidapi/ HIDAPI]. 95 * 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. 96 * 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. 97 97 98 98 == Known Restrictions == … … 100 100 * WinUSB cannot be used to send an actual reset command to an USB device. This is a limitation of the Microsoft driver. 101 101 * WinUSB cannot be used to set a device configuration that is different from the default one. This is a limitation of the Microsoft driver. 102 * WinUSB does not support multiple concurrent applications (as per the [http:// download.microsoft.com/download/9/C/5/9C5B2167-8017-4BAE-9FDE-D599BAC8184A/WinUsb_HowTo.docx WinUSB Howto whitepaper]).102 * WinUSB does not support multiple concurrent applications (as per the [http://msdn.microsoft.com/en-us/library/windows/hardware/ff540215.aspx MSDN documenation]). 103 103 * WinUSB does not support isochronous transfers. 104 * Because there is no native poll on Windows, the ability to return externally pollable file descriptors on Windows ( libusb_pollfd) has been disabled.104 * Because there is no native poll on Windows, the ability to return externally pollable file descriptors on Windows ([http://libusb.sourceforge.net/api-1.0/group__poll.html#gab1a72869a926552b27a6c667695df3a2 libusb_get_pollfd]) returns an error. 105 105 106 106 == To Do == 107 107 108 * libusb K.sysintegration108 * libusb-win32/libusbK integration 109 109 * hotplug detection 110 110 … … 133 133 == Development Links == 134 134 135 * [http://msdn.microsoft.com/en-us/ windows/hardware/gg487341.aspx How to Use WinUSB to Communicate with a USB Device].[[BR]]Note that the inf file given in the howto has a typo. If you don't change SourceDisksFiles.'''NT'''amd64 to SourceDisksFiles.amd64, the driver installation will fail to copy the required DLLs on 64 bit systems...135 * [http://msdn.microsoft.com/en-us/library/windows/hardware/ff540174.aspx How to Use WinUSB to Communicate with a USB Device] & [http://msdn.microsoft.com/en-us/library/windows/hardware/ff540283.aspx WinUSB (Winusb.sys) Installation].[[BR]]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... 136 136 * [http://209.85.229.132/search?q=cache:3tk2Nqp0wfoJ:www.osronline.com/article.cfm%3Farticle%3D532+selecting+configuration+descriptor+winusb Using WinUSB for User-Mode to USB Device Communication] 137 137 * [http://msdn.microsoft.com/en-us/library/ff540046.aspx#winusb WinUSB User-Mode Client Support Routines] 138 138 * [http://blogs.msdn.com/usbcoreblog/ Microsoft's USB Core Team Blog] (including resources on instrumenting the USB stack in Windows 7) 139 139 * [http://blogs.msdn.com/iliast/archive/2008/03/10/why-do-we-need-wdf-coinstallers.aspx additional] [http://blogs.msdn.com/iliast/archive/2009/08/13/wdf-logo-requirements-regarding-coinstallers.aspx information] about Windows Co-Installers 140 * [http://msdn.microsoft.com/en-us/library/ e5ewb1h3%28v=vs.71%29.aspx Enabling Memory Leak Detection in Visual C++]140 * [http://msdn.microsoft.com/en-us/library/x98tx3cf.aspx Finding Memory Leaks Using the CRT Library] 141 141 142 142 == Mailing list ==