├── .private ├── README.txt ├── bd.cmd ├── bm.sh ├── bwince.cmd ├── post-rewrite.sh ├── pre-commit.sh ├── wbs.txt └── wbs_wince.txt ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── INSTALL_WIN.txt ├── Makefile.am ├── NEWS ├── PORTING ├── README ├── README.git ├── TODO ├── Xcode ├── common.xcconfig ├── config.h ├── debug.xcconfig ├── libusbx.xcconfig ├── libusbx.xcodeproj │ └── project.pbxproj ├── libusbx_debug.xcconfig ├── libusbx_release.xcconfig └── release.xcconfig ├── android ├── README ├── config.h └── jni │ ├── Android.mk │ ├── Application.mk │ ├── examples.mk │ ├── libusb.mk │ └── tests.mk ├── autogen.sh ├── bootstrap.sh ├── configure.ac ├── doc ├── Makefile.am ├── doxygen.cfg.in └── libusbx.png ├── examples ├── Makefile.am ├── dpfp.c ├── dpfp_threaded.c ├── ezusb.c ├── ezusb.h ├── fxload.c ├── getopt │ ├── getopt.c │ ├── getopt.h │ └── getopt1.c ├── hotplugtest.c ├── listdevs.c ├── sam3u_benchmark.c └── xusb.c ├── libusb-1.0.pc.in ├── libusb ├── Makefile.am ├── core.c ├── descriptor.c ├── hotplug.c ├── hotplug.h ├── io.c ├── libusb-1.0.def ├── libusb-1.0.rc ├── libusb.h ├── libusbi.h ├── os │ ├── darwin_usb.c │ ├── darwin_usb.h │ ├── linux_netlink.c │ ├── linux_udev.c │ ├── linux_usbfs.c │ ├── linux_usbfs.h │ ├── netbsd_usb.c │ ├── openbsd_usb.c │ ├── poll_posix.c │ ├── poll_posix.h │ ├── poll_windows.c │ ├── poll_windows.h │ ├── threads_posix.c │ ├── threads_posix.h │ ├── threads_windows.c │ ├── threads_windows.h │ ├── wince_usb.c │ ├── wince_usb.h │ ├── windows_common.h │ ├── windows_usb.c │ └── windows_usb.h ├── strerror.c ├── sync.c ├── version.h └── version_nano.h ├── msvc ├── config.h ├── ddk_build.cmd ├── errno.h ├── fxload_2010.vcxproj ├── fxload_2010.vcxproj.filters ├── fxload_2012.vcxproj ├── fxload_2012.vcxproj.filters ├── fxload_2013.vcxproj ├── fxload_sources ├── getopt_2005.vcproj ├── getopt_2010.vcxproj ├── getopt_2010.vcxproj.filters ├── getopt_2012.vcxproj ├── getopt_2012.vcxproj.filters ├── getopt_2013.vcxproj ├── getopt_sources ├── hotplugtest_2010.vcxproj ├── hotplugtest_2010.vcxproj.filters ├── hotplugtest_2012.vcxproj ├── hotplugtest_2012.vcxproj.filters ├── hotplugtest_2013.vcxproj ├── hotplugtest_sources ├── inttypes.h ├── libusb_dll.dsp ├── libusb_dll_2005.vcproj ├── libusb_dll_2010.vcxproj ├── libusb_dll_2010.vcxproj.filters ├── libusb_dll_2012.vcxproj ├── libusb_dll_2012.vcxproj.filters ├── libusb_dll_2013.vcxproj ├── libusb_dll_wince.vcproj ├── libusb_sources ├── libusb_static.dsp ├── libusb_static_2005.vcproj ├── libusb_static_2010.vcxproj ├── libusb_static_2010.vcxproj.filters ├── libusb_static_2012.vcxproj ├── libusb_static_2012.vcxproj.filters ├── libusb_static_2013.vcxproj ├── libusb_static_wince.vcproj ├── libusbx.dsw ├── libusbx_2005.sln ├── libusbx_2010.sln ├── libusbx_2012.sln ├── libusbx_2013.sln ├── libusbx_wince.sln ├── listdevs.dsp ├── listdevs_2005.vcproj ├── listdevs_2010.vcxproj ├── listdevs_2010.vcxproj.filters ├── listdevs_2012.vcxproj ├── listdevs_2012.vcxproj.filters ├── listdevs_2013.vcxproj ├── listdevs_sources ├── listdevs_wince.vcproj ├── missing.c ├── missing.h ├── stdint.h ├── stress_2005.vcproj ├── stress_2010.vcxproj ├── stress_2010.vcxproj.filters ├── stress_2012.vcxproj ├── stress_2012.vcxproj.filters ├── stress_2013.vcxproj ├── stress_wince.vcproj ├── xusb.dsp ├── xusb_2005.vcproj ├── xusb_2010.vcxproj ├── xusb_2010.vcxproj.filters ├── xusb_2012.vcxproj ├── xusb_2012.vcxproj.filters ├── xusb_2013.vcxproj ├── xusb_sources └── xusb_wince.vcproj └── tests ├── Makefile.am ├── libusbx_testlib.h ├── stress.c └── testlib.c /.private/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains private internal scripts used by the libusbx 2 | project maintainers. 3 | 4 | These scripts are not intended for general usage and will not be 5 | exported when producing release archives. 6 | -------------------------------------------------------------------------------- /.private/bd.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem produce the DDK binary files for snapshots 3 | rem !!!THIS SCRIPT IS FOR INTERNAL DEVELOPER USE ONLY!!! 4 | 5 | if NOT x%DDK_TARGET_OS%==xWinXP goto usage 6 | 7 | set IWD=%~dp0 8 | cd .. 9 | mkdir E:\dailies\%DATE% 10 | for %%A in (MS32 MS64) do mkdir E:\dailies\%DATE%\%%A 11 | for %%A in (MS32 MS64) do mkdir E:\dailies\%DATE%\%%A\static 12 | for %%A in (MS32 MS64) do mkdir E:\dailies\%DATE%\%%A\dll 13 | for %%A in (source bin32 bin64) do mkdir E:\dailies\%DATE%\examples\%%A 14 | copy examples\listdevs.c E:\dailies\%DATE%\examples\source 15 | copy examples\xusb.c E:\dailies\%DATE%\examples\source 16 | copy examples\ezusb.? E:\dailies\%DATE%\examples\source 17 | copy examples\fxload.c E:\dailies\%DATE%\examples\source 18 | copy msvc\stdint.h E:\dailies\%DATE%\examples\source 19 | copy .private\wbs.txt E:\dailies\%DATE%\README.txt 20 | 21 | set ORG_BUILD_ALT_DIR=%BUILD_ALT_DIR% 22 | set ORG_BUILDARCH=%_BUILDARCH% 23 | set ORG_PATH=%PATH% 24 | set ORG_BUILD_DEFAULT_TARGETS=%BUILD_DEFAULT_TARGETS% 25 | 26 | set 386=1 27 | set AMD64= 28 | set BUILD_DEFAULT_TARGETS=-386 29 | set _AMD64bit= 30 | set _BUILDARCH=x86 31 | set PATH=%BASEDIR%\bin\x86;%BASEDIR%\bin\x86\x86 32 | 33 | cd msvc 34 | call ddk_build 35 | cd .. 36 | 37 | @echo off 38 | copy Win32\Release\lib\libusb-1.0.lib E:\dailies\%DATE%\MS32\static 39 | copy Win32\Release\examples\listdevs.exe E:\dailies\%DATE%\examples\bin32 40 | copy Win32\Release\examples\xusb.exe E:\dailies\%DATE%\examples\bin32 41 | copy Win32\Release\examples\fxload.exe E:\dailies\%DATE%\examples\bin32 42 | 43 | cd msvc 44 | call ddk_build DLL 45 | cd .. 46 | 47 | @echo off 48 | copy Win32\Release\lib\libusb-1.0.lib E:\dailies\%DATE%\MS32\dll 49 | copy Win32\Release\dll\libusb-1.0.dll E:\dailies\%DATE%\MS32\dll 50 | copy Win32\Release\dll\libusb-1.0.pdb E:\dailies\%DATE%\MS32\dll 51 | 52 | set 386= 53 | set AMD64=1 54 | set BUILD_DEFAULT_TARGETS=-amd64 55 | set _AMD64bit=true 56 | set _BUILDARCH=AMD64 57 | set PATH=%BASEDIR%\bin\x86\amd64;%BASEDIR%\bin\x86 58 | 59 | cd msvc 60 | call ddk_build 61 | cd .. 62 | 63 | @echo off 64 | copy x64\Release\lib\libusb-1.0.lib E:\dailies\%DATE%\MS64\static 65 | copy x64\Release\examples\listdevs.exe E:\dailies\%DATE%\examples\bin64 66 | copy x64\Release\examples\xusb.exe E:\dailies\%DATE%\examples\bin64 67 | copy x64\Release\examples\fxload.exe E:\dailies\%DATE%\examples\bin64 68 | 69 | cd msvc 70 | call ddk_build DLL 71 | cd .. 72 | 73 | @echo off 74 | copy x64\Release\lib\libusb-1.0.lib E:\dailies\%DATE%\MS64\dll 75 | copy x64\Release\dll\libusb-1.0.dll E:\dailies\%DATE%\MS64\dll 76 | copy x64\Release\dll\libusb-1.0.pdb E:\dailies\%DATE%\MS64\dll 77 | 78 | set BUILD_ALT_DIR=%ORG_BUILD_ALT_DIR% 79 | set _BUILDARCH=%ORG_BUILDARCH% 80 | set PATH=%ORG_PATH% 81 | set BUILD_DEFAULT_TARGETS=%ORG_BUILD_DEFAULT_TARGETS% 82 | 83 | goto done 84 | 85 | :usage 86 | echo must be run in a WXP build environment! 87 | 88 | :done 89 | cd %IWD% -------------------------------------------------------------------------------- /.private/bm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # produce the MinGW binary files for snapshots 3 | # !!!THIS SCRIPT IS FOR INTERNAL DEVELOPER USE ONLY!!! 4 | 5 | PWD=`pwd` 6 | cd .. 7 | date=`date +%Y.%m.%d` 8 | target=e:/dailies/$date 9 | mkdir -p $target/include/libusbx-1.0 10 | cp -v libusb/libusb-1.0.def $target 11 | cp -v libusb/libusb.h $target/include/libusbx-1.0 12 | 13 | # 14 | # 32 bit binaries 15 | # 16 | target=e:/dailies/$date/MinGW32 17 | git clean -fdx 18 | # Not using debug (-g) in CFLAGS DRAMATICALLY reduces the size of the binaries 19 | export CFLAGS="-O2 -m32" 20 | export LDFLAGS="-m32" 21 | export RCFLAGS="--target=pe-i386" 22 | export DLLTOOLFLAGS="-m i386 -f --32" 23 | echo `pwd` 24 | (glibtoolize --version) < /dev/null > /dev/null 2>&1 && LIBTOOLIZE=glibtoolize || LIBTOOLIZE=libtoolize 25 | $LIBTOOLIZE --copy --force || exit 1 26 | aclocal || exit 1 27 | autoheader || exit 1 28 | autoconf || exit 1 29 | automake -a -c || exit 1 30 | ./configure 31 | make -j2 32 | mkdir -p $target/static 33 | mkdir -p $target/dll 34 | cp -v libusb/.libs/libusb-1.0.a $target/static 35 | cp -v libusb/.libs/libusb-1.0.dll $target/dll 36 | cp -v libusb/.libs/libusb-1.0.dll.a $target/dll 37 | make clean -j2 38 | 39 | # 40 | # 64 bit binaries 41 | # 42 | target=e:/dailies/$date/MinGW64 43 | export CFLAGS="-O2" 44 | export LDFLAGS="" 45 | export RCFLAGS="" 46 | export DLLTOOLFLAGS="" 47 | ./configure 48 | make -j2 49 | mkdir -p $target/static 50 | mkdir -p $target/dll 51 | cp -v libusb/.libs/libusb-1.0.a $target/static 52 | cp -v libusb/.libs/libusb-1.0.dll $target/dll 53 | cp -v libusb/.libs/libusb-1.0.dll.a $target/dll 54 | cd $PWD -------------------------------------------------------------------------------- /.private/bwince.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem produce the Win CE binary files for snapshots 3 | rem !!!THIS SCRIPT IS FOR INTERNAL DEVELOPER USE ONLY!!! 4 | 5 | if "x%VSINSTALLDIR%"=="x" goto usage 6 | 7 | if "x%WINCE_TARGET_DIR_BASE%"=="x" set WINCE_TARGET_DIR_BASE=E:\dailies 8 | if "x%WINCE_TARGET_ARCHES%"=="x" set WINCE_TARGET_ARCHES=ARMV4I MIPSII MIPSII_FP MIPSIV MIPSIV_FP SH4 x86 9 | 10 | 11 | set WINCE_TARGET_DIR=%WINCE_TARGET_DIR_BASE%\%DATE:/=-% 12 | set MSBUILD_CMD=msbuild.exe 13 | set MSBUILD_TARGET=Rebuild 14 | set MSBUILD_CONFIGURATION=Release 15 | set WINCE_SLN=msvc\libusbx_wince.sln 16 | set PLATFORM_PREFIX=STANDARDSDK_500 ( 17 | set PLATFORM_POSTFIX=) 18 | 19 | 20 | set PWD=%~dp0 21 | cd .. 22 | 23 | mkdir %WINCE_TARGET_DIR% 24 | mkdir %WINCE_TARGET_DIR%\include\libusbx-1.0 25 | copy libusb\libusb-1.0.def %WINCE_TARGET_DIR% 26 | copy libusb\libusb.h %WINCE_TARGET_DIR%\include\libusbx-1.0 27 | for %%A in (%WINCE_TARGET_ARCHES%) do mkdir %WINCE_TARGET_DIR%\%%A 28 | for %%A in (%WINCE_TARGET_ARCHES%) do mkdir %WINCE_TARGET_DIR%\%%A\static 29 | for %%A in (%WINCE_TARGET_ARCHES%) do mkdir %WINCE_TARGET_DIR%\%%A\dll 30 | for %%A in (%WINCE_TARGET_ARCHES%) do mkdir %WINCE_TARGET_DIR%\examples\%%A 31 | mkdir %WINCE_TARGET_DIR%\examples\source 32 | copy examples\listdevs.c %WINCE_TARGET_DIR%\examples\source 33 | copy examples\xusb.c %WINCE_TARGET_DIR%\examples\source 34 | copy msvc\stdint.h %WINCE_TARGET_DIR%\examples\source 35 | copy .private\wbs_wince.txt %WINCE_TARGET_DIR%\README.txt 36 | copy COPYING %WINCE_TARGET_DIR%\COPYING 37 | 38 | rem Perform the rebuild 39 | for %%A in (%WINCE_TARGET_ARCHES%) do %MSBUILD_CMD% %WINCE_SLN% /property:Platform="%PLATFORM_PREFIX%%%A%PLATFORM_POSTFIX%" /property:Configuration=%MSBUILD_CONFIGURATION% /target:%MSBUILD_TARGET%" 40 | 41 | 42 | rem Copy across the binaries 43 | for %%A in (%WINCE_TARGET_ARCHES%) do ( 44 | copy %%A\%MSBUILD_CONFIGURATION%\lib\libusb-1.0.lib %WINCE_TARGET_DIR%\%%A\static 45 | copy %%A\%MSBUILD_CONFIGURATION%\examples\listdevs.exe %WINCE_TARGET_DIR%\examples\%%A 46 | copy %%A\%MSBUILD_CONFIGURATION%\examples\xusb.exe %WINCE_TARGET_DIR%\examples\%%A 47 | copy %%A\%MSBUILD_CONFIGURATION%\dll\libusb-1.0.lib %WINCE_TARGET_DIR%\%%A\dll 48 | copy %%A\%MSBUILD_CONFIGURATION%\dll\libusb-1.0.dll %WINCE_TARGET_DIR%\%%A\dll 49 | copy %%A\%MSBUILD_CONFIGURATION%\dll\libusb-1.0.pdb %WINCE_TARGET_DIR%\%%A\dll ) 50 | 51 | goto done 52 | 53 | :usage 54 | echo must be run in a Visual Studio 2005 build environment! 55 | 56 | :done 57 | cd %PWD% -------------------------------------------------------------------------------- /.private/post-rewrite.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Detect amended commits and warn user if .amend is missing 4 | # 5 | # To have git run this script on commit, create a "post-rewrite" text file in 6 | # .git/hooks/ with the following content: 7 | # #!/bin/sh 8 | # if [ -x .private/post-rewrite.sh ]; then 9 | # source .private/post-rewrite.sh 10 | # fi 11 | # 12 | # NOTE: These versioning hooks are intended to be used *INTERNALLY* by the 13 | # libusbx development team and are NOT intended to solve versioning for any 14 | # derivative branch, such as one you would create for private development. 15 | # 16 | 17 | case "$1" in 18 | amend) 19 | # Check if a .amend exists. If none, create one and warn user to re-commit. 20 | if [ -f .amend ]; then 21 | rm .amend 22 | else 23 | echo "Amend commit detected, but no .amend file - One has now been created." 24 | echo "Please re-commit as is (amend), so that the version number is correct." 25 | touch .amend 26 | fi ;; 27 | *) ;; 28 | esac 29 | -------------------------------------------------------------------------------- /.private/pre-commit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Sets the nano version according to the number of commits on this branch, as 4 | # well as the branch offset. 5 | # 6 | # To have git run this script on commit, first make sure you change 7 | # BRANCH_OFFSET to 60000 or higher, then create a "pre-commit" text file in 8 | # .git/hooks/ with the following content: 9 | # #!/bin/sh 10 | # if [ -x .private/pre-commit.sh ]; then 11 | # source .private/pre-commit.sh 12 | # fi 13 | # 14 | # NOTE: These versioning hooks are intended to be used *INTERNALLY* by the 15 | # libusbx development team and are NOT intended to solve versioning for any 16 | # derivative branch, such as one you would create for private development. 17 | # 18 | # Should you wish to reuse these scripts for your own versioning, in your own 19 | # private branch, we kindly ask you to first set BRANCH_OFFSET to 60000, or 20 | # higher, as any offset below below 60000 is *RESERVED* for libusbx official 21 | # usage. 22 | 23 | ################################################################################ 24 | ## YOU *MUST* SET THE FOLLOWING TO 60000 OR HIGHER IF YOU REUSE THIS SCRIPT ## 25 | ################################################################################ 26 | BRANCH_OFFSET=10000 27 | ################################################################################ 28 | 29 | type -P git &>/dev/null || { echo "git command not found. Aborting." >&2; exit 1; } 30 | 31 | NANO=`git log --oneline | wc -l` 32 | NANO=`expr $NANO + $BRANCH_OFFSET` 33 | # Amended commits need to have the nano corrected. Current versions of git hooks 34 | # only allow detection of amending post commit, so we require a .amend file, 35 | # which will be created post commit with a user warning if none exists when an 36 | # amend is detected. 37 | if [ -f .amend ]; then 38 | NANO=`expr $NANO - 1` 39 | fi 40 | echo "setting nano to $NANO" 41 | echo "#define LIBUSB_NANO $NANO" > libusb/version_nano.h 42 | git add libusb/version_nano.h 43 | -------------------------------------------------------------------------------- /.private/wbs.txt: -------------------------------------------------------------------------------- 1 | libusbx 1.0 Windows binary snapshot - README 2 | 3 | ********************************************************************* 4 | * The latest version of this snapshot can always be downloaded at: * 5 | * https://sourceforge.net/projects/libusbx/files/ * 6 | ********************************************************************* 7 | 8 | o Visual Studio: 9 | - Open existing or create a new project for your application 10 | - Copy libusb.h, from the include\libusbx-1.0\ directory, into your project and 11 | make sure that the location where the file reside appears in the 'Additional 12 | Include Directories' section (Configuration Properties -> C/C++ -> General). 13 | - Copy the relevant .lib file from MS32\ or MS64\ and add 'libusb-1.0.lib' to 14 | your 'Additional Dependencies' (Configuration Properties -> Linker -> Input) 15 | Also make sure that the directory where libusb-1.0.lib resides is added to 16 | 'Additional Library Directories' (Configuration Properties -> Linker 17 | -> General) 18 | - If you use the static version of the libusbx library, make sure that 19 | 'Runtime Library' is set to 'Multi-threaded DLL (/MD)' (Configuration 20 | Properties -> C/C++ -> Code Generation). 21 | NB: If your application requires /MT (Multi-threaded/libCMT), you need to 22 | recompile a static libusbx 1.0 library from source. 23 | - Compile and run your application. If you use the DLL version of libusb-1.0, 24 | remember that you need to have a copy of the DLL either in the runtime 25 | directory or in system32 26 | 27 | o WDK/DDK: 28 | - The following is an example of a sources files that you can use to compile 29 | a libusbx 1.0 based console application. In this sample ..\libusbx\ is the 30 | directory where you would have copied libusb.h as well as the relevant 31 | libusb-1.0.lib 32 | 33 | TARGETNAME=your_app 34 | TARGETTYPE=PROGRAM 35 | USE_MSVCRT=1 36 | UMTYPE=console 37 | INCLUDES=..\libusbx;$(DDK_INC_PATH) 38 | TARGETLIBS=..\libusbx\libusb-1.0.lib 39 | SOURCES=your_app.c 40 | 41 | - Note that if you plan to use libCMT instead of MSVCRT (USE_LIBCMT=1 instead 42 | of USE_MSVCRT=1), you will need to recompile libusbx to use libCMT. This can 43 | easily be achieved, in the DDK environment, by running 'ddk_build /MT' 44 | 45 | o MinGW/cygwin 46 | - Copy libusb.h, from include/libusbx-1.0/ to your default include directory, 47 | and copy the MinGW32/ or MinGW64/ .a files to your default library directory. 48 | Or, if you don't want to use the default locations, make sure that you feed 49 | the relevant -I and -L options to the compiler. 50 | - Add the '-lusb-1.0' linker option when compiling. 51 | 52 | o Additional information: 53 | - The libusbx 1.0 API documentation can be accessed at: 54 | http://api.libusbx.org 55 | - For some libusb samples (including source), please have a look in examples/ 56 | - For additional information on the libusbx 1.0 Windows backend please visit: 57 | http://windows.libusbx.org 58 | - The MinGW and MS generated DLLs are fully interchangeable, provided that you 59 | use the import libs provided or generate one from the .def also provided. 60 | - If you find any issue, please visit http://libusbx.org/ and check the 61 | Support section 62 | -------------------------------------------------------------------------------- /.private/wbs_wince.txt: -------------------------------------------------------------------------------- 1 | libusbx 1.0 Windows CE binary snapshot - README 2 | 3 | ********************************************************************* 4 | * The latest version of this snapshot can always be downloaded at: * 5 | * https://sourceforge.net/projects/libusbx/files/ * 6 | ********************************************************************* 7 | 8 | The binaries contained in this snapshot are licensed under the 9 | GNU Lesser General Public License version 2.1 or, at your option, any later 10 | version (see COPYING for further details). The source code for these binaries 11 | is available for download at the same location as this binary snapshot. 12 | 13 | o Visual Studio: 14 | - Open existing or create a new project for your application 15 | - Copy libusb.h, from the include\libusbx-1.0\ directory, into your project and 16 | make sure that the location where the file reside appears in the 'Additional 17 | Include Directories' section (Configuration Properties -> C/C++ -> General). 18 | - Copy the relevant .lib file from ARMV4I, MIPSII, MIPSII_FP, MIPSIV, MIPSIV_FP, 19 | SH4 or x86 and add 'libusb-1.0.lib' to your 'Additional Dependencies' 20 | (Configuration Properties -> Linker -> Input). Also make sure that the 21 | directory where libusb-1.0.lib resides is added to 'Additional Library 22 | Directories' (Configuration Properties -> Linker -> General) 23 | - If you use the static version of the libusbx library, make sure that 24 | 'Runtime Library' is set to 'Multi-threaded DLL (/MD)' (Configuration 25 | Properties -> C/C++ -> Code Generation). 26 | NB: If your application requires /MT (Multi-threaded/libCMT), you need to 27 | recompile a static libusbx 1.0 library from source. 28 | - Compile and run your application. If you use the DLL version of libusb-1.0, 29 | remember that you need to have a copy of the DLL either in the runtime 30 | directory or in system32 31 | 32 | o Additional information: 33 | - The libusbx 1.0 API documentation can be accessed at: 34 | http://api.libusbx.org 35 | - For some libusb samples (including source), please have a look in examples/ 36 | - For additional information on the libusbx 1.0 Windows backend please visit: 37 | http://windows.libusbx.org 38 | - It is necessary to install the CE USB Kernel Wrapper driver for libusbx to 39 | function on a device. This is obtainable from: 40 | https://github.com/RealVNC/CEUSBKWrapper 41 | - If you find any issue, please visit http://libusbx.org/ and check the 42 | Support section 43 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Copyright © 2001 Johannes Erdfelt 2 | Copyright © 2007-2009 Daniel Drake 3 | Copyright © 2010-2012 Peter Stuge 4 | Copyright © 2008-2013 Nathan Hjelm 5 | Copyright © 2009-2013 Pete Batard 6 | Copyright © 2009-2013 Ludovic Rousseau 7 | Copyright © 2010-2012 Michael Plante 8 | Copyright © 2011-2013 Hans de Goede 9 | Copyright © 2012-2013 Martin Pieuchot 10 | Copyright © 2012-2013 Toby Gray 11 | 12 | Other contributors: 13 | Alan Ott 14 | Alan Stern 15 | Alex Vatchenko 16 | Andrew Fernandes 17 | Anthony Clay 18 | Artem Egorkine 19 | Aurelien Jarno 20 | Bastien Nocera 21 | Bei Zhang 22 | Benjamin Dobell 23 | Chris Dickens 24 | Colin Walters 25 | Dave Camarillo 26 | David Engraf 27 | David Moore 28 | Davidlohr Bueso 29 | Federico Manzan 30 | Felipe Balbi 31 | Florian Albrechtskirchinger 32 | Francesco Montorsi 33 | Francisco Facioni 34 | Graeme Gill 35 | Gustavo Zacarias 36 | Hans Ulrich Niedermann 37 | Hector Martin 38 | Hoi-Ho Chan 39 | Ilya Konstantinov 40 | James Hanko 41 | Joshua Blake 42 | Karsten Koenig 43 | Konrad Rzepecki 44 | Kuangye Guo 45 | Lars Wirzenius 46 | Luca Longinotti 47 | Martin Koegler 48 | Matthias Bolte 49 | Mike Frysinger 50 | Mikhail Gusarov 51 | Moritz Fischer 52 | Nicholas Corgan 53 | Omri Iluz 54 | Orin Eman 55 | Paul Fertser 56 | Pekka Nikander 57 | Rob Walker 58 | Sean McBride 59 | Sebastian Pipping 60 | Simon Haggett 61 | Thomas Röfer 62 | Tim Roberts 63 | Toby Peterson 64 | Trygve Laugstøl 65 | Uri Lublin 66 | Vasily Khoruzhick 67 | Vegard Storheil Eriksen 68 | Vitali Lovich 69 | Xiaofan Chen 70 | Zoltán Kovács 71 | Роман Донченко 72 | -------------------------------------------------------------------------------- /INSTALL_WIN.txt: -------------------------------------------------------------------------------- 1 | Installation Instructions for Windows 2 | ************************************* 3 | 4 | If you are compiling for MinGW or cygwin, please refer to the INSTALL file. 5 | 6 | If you are using Microsoft Visual Studio: 7 | - Open the relevant solution file in /msvc: 8 | libusb.dsw for MSVC6, libusbx_2005.sln for Visual Studio 2005 or 2008, 9 | libusbx_2010.sln for Visual Studio 2010, 10 | libusbx_2012.sln for Visual Studio 2012 or later, 11 | libusbx_wince.sln for Windows CE support in Visual Studio 2005. 12 | - If you want to debug the library, uncomment the ENABLE_DEBUG_LOGGING define 13 | in msvc\config.h 14 | - Select your configuration and compile the project 15 | 16 | Note that if you are using Visual Studio Express, you may have to install the 17 | Windows SDK to be able to compile the 64 bit version of the library. 18 | 19 | If you are using the freely available Windows DDK/WDK (Driver Development Kit) 20 | - If you want to debug the library, uncomment the ENABLE_DEBUG_LOGGING define 21 | in msvc\config.h 22 | - Open one of the relevant Free Build or Checked Build prompt for your target 23 | platform 24 | - Navigate to the msvc\ directory where the ddk_build.cmd file is located, and 25 | run 'ddk_build' 26 | - To produce a DLL rather than a static library, use: 'ddk_build DLL' 27 | - To produce a static library that uses LIBCMT[d] instead of MSVCRT[d] (/MT[d] 28 | vs /MD[d] in Visual Studio) use: 'ddk_build /MT' 29 | 30 | Note that using the Windows DDK, it is possible to compile both the 32 and 64 31 | bit versions of the library. 32 | 33 | If you are building for Windows CE then you will need the Windows CE Standard 5.00 SDK. 34 | 35 | Destination directories 36 | *********************** 37 | 38 | The 32 bit binaries compiled either from Visual Studio or the DDK are placed in 39 | a Win32\ directory at the root of the library 40 | The 64 bit binaries are placed in an x64\ directory 41 | Windows CE binaries are placed in one of the following directories, depending 42 | on the target processor: ARMV4I, MIPSII, MIPSII_FP, MIPSIV, MIPSIV_FP, SH4 or x86. 43 | 44 | 45 | Troubleshooting 46 | *************** 47 | 48 | If the compilation process complains about missing libraries, ensure that the 49 | default library paths for your project points to the relevant directories. 50 | If needed, these libraries can be obtained by installing either the latest 51 | Windows SDK or the DDK (Links provided at the end of this file). 52 | 53 | For Windows CE it is necessary to install the CE USB Kernel Wrapper driver for 54 | libusbx to function on a device. 55 | 56 | Links 57 | ***** 58 | 59 | Additional information related to the Windows backend: 60 | http://windows.libusbx.org 61 | 62 | Latest Windows Driver (Development) Kit (WDK): 63 | http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=36a2630f-5d56-43b5-b996-7633f2ec14ff 64 | 65 | Latest Microsoft Windows SDK: 66 | http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505 67 | 68 | Windows CE Standard 5.00 SDK: 69 | http://www.microsoft.com/en-gb/download/details.aspx?id=17310 70 | 71 | Windows CE USB Kernel Wrapper Driver: 72 | https://github.com/RealVNC/CEUSBKWrapper 73 | 74 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip 2 | ACLOCAL_AMFLAGS = -I m4 3 | DISTCLEANFILES = libusb-1.0.pc 4 | EXTRA_DIST = TODO PORTING msvc libusb/libusb-1.0.def libusb/version_nano.h \ 5 | examples/getopt/getopt.c examples/getopt/getopt1.c examples/getopt/getopt.h \ 6 | android Xcode 7 | SUBDIRS = libusb doc 8 | 9 | if BUILD_EXAMPLES 10 | SUBDIRS += examples 11 | endif 12 | 13 | if BUILD_TESTS 14 | SUBDIRS += tests 15 | endif 16 | 17 | pkgconfigdir=$(libdir)/pkgconfig 18 | pkgconfig_DATA=libusb-1.0.pc 19 | 20 | .PHONY: dist-up 21 | 22 | reldir = .release/$(distdir) 23 | dist-up: dist 24 | rm -rf $(reldir) 25 | mkdir -p $(reldir) 26 | cp $(distdir).tar.bz2 $(reldir) 27 | rsync -rv $(reldir) frs.sourceforge.net:/home/frs/project/l/li/libusb/libusb-1.0/ 28 | rm -rf $(reldir) 29 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | For the latest libusbx news, please refer to the ChangeLog file, or visit: 2 | http://libusbx.org 3 | -------------------------------------------------------------------------------- /PORTING: -------------------------------------------------------------------------------- 1 | PORTING LIBUSBX TO OTHER PLATFORMS 2 | 3 | Introduction 4 | ============ 5 | 6 | This document is aimed at developers wishing to port libusbx to unsupported 7 | platforms. I believe the libusbx API is OS-independent, so by supporting 8 | multiple operating systems we pave the way for cross-platform USB device 9 | drivers. 10 | 11 | Implementation-wise, the basic idea is that you provide an interface to 12 | libusbx's internal "backend" API, which performs the appropriate operations on 13 | your target platform. 14 | 15 | In terms of USB I/O, your backend provides functionality to submit 16 | asynchronous transfers (synchronous transfers are implemented in the higher 17 | layers, based on the async interface). Your backend must also provide 18 | functionality to cancel those transfers. 19 | 20 | Your backend must also provide an event handling function to "reap" ongoing 21 | transfers and process their results. 22 | 23 | The backend must also provide standard functions for other USB operations, 24 | e.g. setting configuration, obtaining descriptors, etc. 25 | 26 | 27 | File descriptors for I/O polling 28 | ================================ 29 | 30 | For libusbx to work, your event handling function obviously needs to be called 31 | at various points in time. Your backend must provide a set of file descriptors 32 | which libusbx and its users can pass to poll() or select() to determine when 33 | it is time to call the event handling function. 34 | 35 | On Linux, this is easy: the usbfs kernel interface exposes a file descriptor 36 | which can be passed to poll(). If something similar is not true for your 37 | platform, you can emulate this using an internal library thread to reap I/O as 38 | necessary, and a pipe() with the main library to raise events. The file 39 | descriptor of the pipe can then be provided to libusbx as an event source. 40 | 41 | 42 | Interface semantics and documentation 43 | ===================================== 44 | 45 | Documentation of the backend interface can be found in libusbi.h inside the 46 | usbi_os_backend structure definition. 47 | 48 | Your implementations of these functions will need to call various internal 49 | libusbx functions, prefixed with "usbi_". Documentation for these functions 50 | can be found in the .c files where they are implemented. 51 | 52 | You probably want to skim over *all* the documentation before starting your 53 | implementation. For example, you probably need to allocate and store private 54 | OS-specific data for device handles, but the documentation for the mechanism 55 | for doing so is probably not the first thing you will see. 56 | 57 | The Linux backend acts as a good example - view it as a reference 58 | implementation which you should try to match the behaviour of. 59 | 60 | 61 | Getting started 62 | =============== 63 | 64 | 1. Modify configure.ac to detect your platform appropriately (see the OS_LINUX 65 | stuff for an example). 66 | 67 | 2. Implement your backend in the libusb/os/ directory, modifying 68 | libusb/os/Makefile.am appropriately. 69 | 70 | 3. Add preprocessor logic to the top of libusb/core.c to statically assign the 71 | right usbi_backend for your platform. 72 | 73 | 4. Produce and test your implementation. 74 | 75 | 5. Send your implementation to libusbx-devel mailing list. 76 | 77 | 78 | Implementation difficulties? Questions? 79 | ======================================= 80 | 81 | If you encounter difficulties porting libusbx to your platform, please raise 82 | these issues on the libusbx-devel mailing list. Where possible and sensible, I 83 | am interested in solving problems preventing libusbx from operating on other 84 | platforms. 85 | 86 | The libusbx-devel mailing list is also a good place to ask questions and 87 | make suggestions about the internal API. Hopefully we can produce some 88 | better documentation based on your questions and other input. 89 | 90 | You are encouraged to get involved in the process; if the library needs 91 | some infrastructure additions/modifications to better support your platform, 92 | you are encouraged to make such changes (in cleanly distinct patch 93 | submissions). Even if you do not make such changes yourself, please do raise 94 | the issues on the mailing list at the very minimum. 95 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | IMPORTANT NOTE: 2 | This project is no more maintained. 3 | You should use libusb instead. Go to https://libusb.info/ or https://github.com/libusb/libusb 4 | 5 | libusbx 6 | ======= 7 | 8 | libusbx is a library for USB device access from Linux, Mac OS X, 9 | Windows and OpenBSD/NetBSD userspace, with OpenBSD/NetBSD, and to a 10 | lesser extent some of the newest features of Windows (such as libusbK 11 | and libusb-win32 driver support) being EXPERIMENTAL. 12 | It is written in C and licensed under the GNU Lesser General Public 13 | License version 2.1 or, at your option, any later version (see COPYING). 14 | 15 | libusbx is abstracted internally in such a way that it can hopefully 16 | be ported to other operating systems. Please see the PORTING file 17 | for more information. 18 | 19 | libusbx homepage: 20 | http://libusbx.org/ 21 | 22 | Developers will wish to consult the API documentation: 23 | http://api.libusbx.org 24 | 25 | Use the mailing list for questions, comments, etc: 26 | http://mailing-list.libusbx.org 27 | 28 | - Pete Batard 29 | - Hans de Goede 30 | - Xiaofan Chen 31 | - Ludovic Rousseau 32 | - Nathan Hjelm 33 | (Please use the mailing list rather than mailing developers directly) 34 | -------------------------------------------------------------------------------- /README.git: -------------------------------------------------------------------------------- 1 | Notes related to git compilation: 2 | -------------------------------- 3 | 4 | If you retrieved the libusbx repository from git and are using a gcc based 5 | toolchain, be mindful that you should have the autotools installed (autoconf, 6 | automake) and will need to run either ./autogen.sh or ./bootstrap.sh to produce 7 | the configure file. 8 | 9 | The difference between autogen.sh and bootstrap.sh is that the former invokes 10 | configure with a default set of options, and will therefore generate a Makefile, 11 | whereas the latter does not invoke configure at all. If using autogen.sh, note 12 | that you can also append options, that will be passed as is to configure. 13 | 14 | OS X-specific notes: 15 | ------------------- 16 | 17 | Starting with Xcode 4.3, neither Xcode.app nor the Xcode 'command line tools' 18 | includes autotools and so running either autogen.sh or bootstrap.sh will result 19 | in the message: 20 | 21 | libtoolize or glibtoolize was not found! Please install libtool. 22 | 23 | To proceed, you must find and install it from somewhere. 24 | 25 | Alternatively, you can use the Xcode project at Xcode/libusbx.xcodeproj. 26 | 27 | Notes related to submitting new developments: 28 | -------------------------------------------- 29 | 30 | If you submit a new development to libusbx (eg: new backend), that is unlikely 31 | to fit in a couple of small patches, we would kindly suggest that you create a 32 | public account on github, if you don't have one already, and then fork a new 33 | libusbx repository under this account from https://github.com/libusbx/libusbx. 34 | 35 | Then you can create a git branch for your work, that we will be able to better 36 | reference and test. 37 | 38 | We also suggest that, if you are planning to bring in a large development, you 39 | try to involve the libusbx community early by letting the mailing list know, as 40 | you may find that other people might be eager to help you out. 41 | See http://mailing-list.libusbx.org for details on how to join the mailing list. -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | Please see the libusbx roadmap by visiting: 2 | https://github.com/libusbx/libusbx/issues/milestones?direction=asc&sort=due_date -------------------------------------------------------------------------------- /Xcode/common.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // libusbx Xcode configuration file 3 | // Copyright © 2012 Pete Batard 4 | // For more information, please visit: 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License, or (at your option) any later version. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | // libusbx does not follow C99 strict aliasing rules, so disable it. 21 | GCC_STRICT_ALIASING = NO 22 | 23 | // Use C99 dialect. 24 | GCC_C_LANGUAGE_STANDARD = c99 25 | 26 | // Compiler warnings. 27 | CLANG_WARN_EMPTY_BODY = YES 28 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES 29 | GCC_WARN_ABOUT_RETURN_TYPE = YES 30 | GCC_WARN_UNINITIALIZED_AUTOS = YES 31 | GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES 32 | GCC_WARN_SHADOW = YES 33 | GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES 34 | GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES 35 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES 36 | GCC_WARN_ABOUT_MISSING_NEWLINE = YES 37 | GCC_WARN_UNKNOWN_PRAGMAS = YES 38 | GCC_WARN_UNUSED_FUNCTION = YES 39 | GCC_WARN_UNUSED_LABEL = YES 40 | GCC_WARN_UNUSED_VARIABLE = YES 41 | -------------------------------------------------------------------------------- /Xcode/config.h: -------------------------------------------------------------------------------- 1 | /* config.h. Manually generated for Xcode. */ 2 | 3 | /* Default visibility */ 4 | #define DEFAULT_VISIBILITY /**/ 5 | 6 | /* Message logging */ 7 | #define ENABLE_LOGGING 1 8 | 9 | /* Define to 1 if you have the `gettimeofday' function. */ 10 | #define HAVE_GETTIMEOFDAY 1 11 | 12 | /* Define to 1 if you have the header file. */ 13 | #define HAVE_POLL_H 1 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #define HAVE_SYS_TIME_H 1 17 | 18 | /* Darwin backend */ 19 | #define OS_DARWIN 1 20 | 21 | /* type of second poll() argument */ 22 | #define POLL_NFDS_TYPE nfds_t 23 | 24 | /* Use POSIX Threads */ 25 | #define THREADS_POSIX 1 26 | 27 | /* Use GNU extensions */ 28 | #define _GNU_SOURCE 1 29 | -------------------------------------------------------------------------------- /Xcode/debug.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // libusbx Xcode configuration file 3 | // Copyright © 2012 Pete Batard 4 | // For more information, please visit: 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License, or (at your option) any later version. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | #include "common.xcconfig" 21 | 22 | // Embed debug symbols in binary itself. 23 | DEBUG_INFORMATION_FORMAT = dwarf 24 | 25 | // No optimizations in debug. 26 | GCC_OPTIMIZATION_LEVEL = 0 27 | 28 | // 29 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) DEBUG=1 30 | -------------------------------------------------------------------------------- /Xcode/libusbx.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // libusbx Xcode configuration file 3 | // Copyright © 2012 Pete Batard 4 | // For more information, please visit: 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License, or (at your option) any later version. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | // For backwards compatibility with libusb, use the same filename. 21 | PRODUCT_NAME = libusb-1.0.0 22 | -------------------------------------------------------------------------------- /Xcode/libusbx_debug.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // libusbx Xcode configuration file 3 | // Copyright © 2012 Pete Batard 4 | // For more information, please visit: 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License, or (at your option) any later version. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | #include "debug.xcconfig" 21 | #include "libusbx.xcconfig" 22 | -------------------------------------------------------------------------------- /Xcode/libusbx_release.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // libusbx Xcode configuration file 3 | // Copyright © 2012 Pete Batard 4 | // For more information, please visit: 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License, or (at your option) any later version. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | #include "release.xcconfig" 21 | #include "libusbx.xcconfig" 22 | -------------------------------------------------------------------------------- /Xcode/release.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // libusbx Xcode configuration file 3 | // Copyright © 2012 Pete Batard 4 | // For more information, please visit: 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License, or (at your option) any later version. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | #include "common.xcconfig" 21 | 22 | // Put debug symbols in separate .dym file. 23 | DEBUG_INFORMATION_FORMAT = dwarf-with-dsym 24 | 25 | // Optimizations in release. 26 | GCC_OPTIMIZATION_LEVEL = s 27 | 28 | // Define NDEBUG so asserts go away in release. 29 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) NDEBUG=1 30 | -------------------------------------------------------------------------------- /android/README: -------------------------------------------------------------------------------- 1 | libusb for Android 2 | ================== 3 | 4 | Building: 5 | --------- 6 | 7 | To build libusb for Android do the following: 8 | 9 | 1. Download the latest NDK from: 10 | http://developer.android.com/tools/sdk/ndk/index.html 11 | 12 | 2. Extract the NDK. 13 | 14 | 3. Open a shell and make sure there exist an NDK global variable 15 | set to the directory where you extracted the NDK. 16 | 17 | 4. Change directory to libusb's "android/jni" 18 | 19 | 5. Run "$NDK/ndk-build". 20 | 21 | The libusb library, examples and tests can then be found in: 22 | "android/libs/$ARCH" 23 | 24 | Where $ARCH is one of: 25 | armeabi 26 | armeabi-v7a 27 | x86 28 | 29 | 30 | Installing: 31 | ----------- 32 | 33 | If you wish to use libusb from native code in own Android application 34 | then you should add the following line to your Android.mk file: 35 | 36 | include $(PATH_TO_LIBUSB_SRC)/android/jni/libusb.mk 37 | 38 | You will then need to add the following lines to the build 39 | configuration for each native binary which uses libusb: 40 | 41 | LOCAL_C_INCLUDES += $(LIBUSB_ROOT_ABS) 42 | LOCAL_SHARED_LIBRARIES += libusb1.0 43 | 44 | The Android build system will then correctly include libusb in the 45 | application package (APK) file, provided ndk-build is invoked before 46 | the package is built. 47 | 48 | 49 | For a rooted device it is possible to install libusb into the system 50 | image of a running device: 51 | 52 | 1. Enable ADB on the device. 53 | 54 | 2. Connect the device to a machine running ADB. 55 | 56 | 3. Execute the following commands on the machine 57 | running ADB: 58 | 59 | # Make the system partition writable 60 | adb shell su -c "mount -o remount,rw /system" 61 | 62 | # Install libusb 63 | adb push obj/local/armeabi/libusb1.0.so /sdcard/ 64 | adb shell su -c "cat > /system/lib/libusb1.0.so < /sdcard/libusb1.0.so" 65 | adb shell rm /system/lib/libusb1.0.so 66 | 67 | # Install the samples and tests 68 | for B in listdevs fxload xusb sam3u_benchmark hotplugtest stress 69 | do 70 | adb push "obj/local/armeabi/$B" /sdcard/ 71 | adb shell su -c "cat > /system/bin/$B < /sdcard/$B" 72 | adb shell su -c "chmod 0755 /system/bin/$B" 73 | adb shell rm "/sdcard/$B" 74 | done 75 | 76 | # Make the system partition read only again 77 | adb shell su -c "mount -o remount,ro /system" 78 | 79 | # Run listdevs to 80 | adb shell su -c "listdevs" 81 | 82 | 4. If your device only has a single OTG port then ADB can generally 83 | be switched to using Wifi with the following commands when connected 84 | via USB: 85 | 86 | adb shell netcfg 87 | # Note the wifi IP address of the phone 88 | adb tcpip 5555 89 | # Use the IP address from netcfg 90 | adb connect 192.168.1.123:5555 91 | 92 | Runtime Permissions: 93 | -------------------- 94 | 95 | The default system configuration on most Android device will not allow 96 | access to USB devices. There are several options for changing this. 97 | 98 | If you have control of the system image then you can modify the 99 | ueventd.rc used in the image to change the permissions on 100 | /dev/bus/usb/*/*. If using this approach then it is advisable to 101 | create a new Android permission to protect access to these files. 102 | It is not advisable to give all applications read and write permissions 103 | to these files. 104 | 105 | For rooted devices the code using libusb could be executed as root 106 | using the "su" command. An alternative would be to use the "su" command 107 | to change the permissions on the appropriate /dev/bus/usb/ files. 108 | 109 | Users have reported success in using android.hardware.usb.UsbManager 110 | to request permission to use the UsbDevice and then opening the 111 | device. The difficulties in this method is that there is no guarantee 112 | that it will continue to work in the future Android versions, it 113 | requires invoking Java APIs and running code to match each 114 | android.hardware.usb.UsbDevice to a libusb_device. 115 | -------------------------------------------------------------------------------- /android/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Android build config for libusbx 3 | * Copyright © 2012-2013 RealVNC Ltd. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | /* Start with debug message logging enabled */ 21 | /* #undef ENABLE_DEBUG_LOGGING */ 22 | 23 | /* Message logging */ 24 | #define ENABLE_LOGGING 25 | 26 | /* Define to 1 if you have the header file. */ 27 | #define HAVE_DLFCN_H 1 28 | 29 | /* Define to 1 if you have the `gettimeofday' function. */ 30 | #define HAVE_GETTIMEOFDAY 1 31 | 32 | /* Define to 1 if you have the header file. */ 33 | #define HAVE_INTTYPES_H 1 34 | 35 | /* Linux backend */ 36 | #define OS_LINUX 1 37 | 38 | /* Enable output to system log */ 39 | #define USE_SYSTEM_LOGGING_FACILITY 1 40 | 41 | /* type of second poll() argument */ 42 | #define POLL_NFDS_TYPE nfds_t 43 | 44 | /* Use POSIX Threads */ 45 | #define THREADS_POSIX 1 46 | 47 | /* Default visibility */ 48 | #define DEFAULT_VISIBILITY __attribute__((visibility("default"))) 49 | 50 | /* Define to 1 if you have the header file. */ 51 | #define HAVE_MEMORY_H 1 52 | 53 | /* Define to 1 if you have the header file. */ 54 | #define HAVE_POLL_H 1 55 | 56 | /* Define to 1 if you have the header file. */ 57 | #define HAVE_SIGNAL_H 1 58 | 59 | /* Define to 1 if you have the header file. */ 60 | #define HAVE_SYS_STAT_H 1 61 | 62 | /* Define to 1 if you have the header file. */ 63 | #define HAVE_SYS_TIME_H 1 64 | 65 | /* Define to 1 if you have the header file. */ 66 | #define HAVE_SYS_TYPES_H 1 67 | 68 | /* Define to 1 if you have the header file. */ 69 | #define HAVE_UNISTD_H 1 70 | 71 | /* Define to 1 if you have the header file. */ 72 | #define HAVE_LINUX_FILTER_H 1 73 | 74 | /* Define to 1 if you have the header file. */ 75 | #define HAVE_LINUX_NETLINK_H 1 76 | 77 | /* Define to 1 if you have the header file. */ 78 | #define HAVE_ASM_TYPES_H 1 79 | 80 | /* Define to 1 if you have the header file. */ 81 | #define HAVE_SYS_SOCKET_H 1 82 | -------------------------------------------------------------------------------- /android/jni/Android.mk: -------------------------------------------------------------------------------- 1 | # Android build config for libusb, examples and tests 2 | # Copyright © 2012-2013 RealVNC Ltd. 3 | # 4 | # This library is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU Lesser General Public 6 | # License as published by the Free Software Foundation; either 7 | # version 2.1 of the License, or (at your option) any later version. 8 | # 9 | # This library is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | # Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public 15 | # License along with this library; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | # 18 | 19 | LOCAL_PATH:= $(call my-dir) 20 | 21 | include $(LOCAL_PATH)/libusb.mk 22 | include $(LOCAL_PATH)/examples.mk 23 | include $(LOCAL_PATH)/tests.mk 24 | -------------------------------------------------------------------------------- /android/jni/Application.mk: -------------------------------------------------------------------------------- 1 | # Android application build config for libusb 2 | # Copyright © 2012-2013 RealVNC Ltd. 3 | # 4 | # This library is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU Lesser General Public 6 | # License as published by the Free Software Foundation; either 7 | # version 2.1 of the License, or (at your option) any later version. 8 | # 9 | # This library is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | # Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public 15 | # License along with this library; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | # 18 | 19 | APP_ABI := all 20 | 21 | # Workaround for MIPS toolchain linker being unable to find liblog dependency 22 | # of shared object in NDK versions at least up to r9. 23 | # 24 | APP_LDFLAGS := -llog 25 | -------------------------------------------------------------------------------- /android/jni/examples.mk: -------------------------------------------------------------------------------- 1 | # Android build config for libusb examples 2 | # Copyright © 2012-2013 RealVNC Ltd. 3 | # 4 | # This library is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU Lesser General Public 6 | # License as published by the Free Software Foundation; either 7 | # version 2.1 of the License, or (at your option) any later version. 8 | # 9 | # This library is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | # Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public 15 | # License along with this library; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | # 18 | 19 | LOCAL_PATH:= $(call my-dir) 20 | LIBUSB_ROOT_REL:= ../.. 21 | LIBUSB_ROOT_ABS:= $(LOCAL_PATH)/../.. 22 | 23 | # listdevs 24 | 25 | include $(CLEAR_VARS) 26 | 27 | LOCAL_SRC_FILES := \ 28 | $(LIBUSB_ROOT_REL)/examples/listdevs.c 29 | 30 | LOCAL_C_INCLUDES += \ 31 | $(LIBUSB_ROOT_ABS) 32 | 33 | LOCAL_SHARED_LIBRARIES += libusb1.0 34 | 35 | LOCAL_MODULE:= listdevs 36 | 37 | include $(BUILD_EXECUTABLE) 38 | 39 | # xusb 40 | 41 | include $(CLEAR_VARS) 42 | 43 | LOCAL_SRC_FILES := \ 44 | $(LIBUSB_ROOT_REL)/examples/xusb.c 45 | 46 | LOCAL_C_INCLUDES += \ 47 | $(LIBUSB_ROOT_ABS) 48 | 49 | LOCAL_SHARED_LIBRARIES += libusb1.0 50 | 51 | LOCAL_MODULE:= xusb 52 | 53 | include $(BUILD_EXECUTABLE) 54 | 55 | # hotplugtest 56 | 57 | include $(CLEAR_VARS) 58 | 59 | LOCAL_SRC_FILES := \ 60 | $(LIBUSB_ROOT_REL)/examples/hotplugtest.c 61 | 62 | LOCAL_C_INCLUDES += \ 63 | $(LIBUSB_ROOT_ABS) 64 | 65 | LOCAL_SHARED_LIBRARIES += libusb1.0 66 | 67 | LOCAL_MODULE:= hotplugtest 68 | 69 | include $(BUILD_EXECUTABLE) 70 | 71 | # fxload 72 | 73 | include $(CLEAR_VARS) 74 | 75 | LOCAL_SRC_FILES := \ 76 | $(LIBUSB_ROOT_REL)/examples/fxload.c \ 77 | $(LIBUSB_ROOT_REL)/examples/ezusb.c 78 | 79 | LOCAL_C_INCLUDES += \ 80 | $(LIBUSB_ROOT_ABS) 81 | 82 | LOCAL_SHARED_LIBRARIES += libusb1.0 83 | 84 | LOCAL_MODULE:= fxload 85 | 86 | include $(BUILD_EXECUTABLE) 87 | 88 | # sam3u_benchmake 89 | 90 | include $(CLEAR_VARS) 91 | 92 | LOCAL_SRC_FILES := \ 93 | $(LIBUSB_ROOT_REL)/examples/sam3u_benchmark.c 94 | 95 | LOCAL_C_INCLUDES += \ 96 | $(LIBUSB_ROOT_ABS) 97 | 98 | LOCAL_SHARED_LIBRARIES += libusb1.0 99 | 100 | LOCAL_MODULE:= sam3u_benchmark 101 | 102 | include $(BUILD_EXECUTABLE) 103 | 104 | # dpfp 105 | 106 | include $(CLEAR_VARS) 107 | 108 | LOCAL_SRC_FILES := \ 109 | $(LIBUSB_ROOT_REL)/examples/dpfp.c 110 | 111 | LOCAL_C_INCLUDES += \ 112 | $(LIBUSB_ROOT_ABS) 113 | 114 | LOCAL_SHARED_LIBRARIES += libusb1.0 115 | 116 | LOCAL_MODULE:= dpfp 117 | 118 | include $(BUILD_EXECUTABLE) 119 | 120 | # dpfp_threaded 121 | 122 | include $(CLEAR_VARS) 123 | 124 | LOCAL_SRC_FILES := \ 125 | $(LIBUSB_ROOT_REL)/examples/dpfp_threaded.c 126 | 127 | LOCAL_C_INCLUDES += \ 128 | $(LIBUSB_ROOT_ABS) 129 | 130 | LOCAL_SHARED_LIBRARIES += libusb1.0 131 | 132 | LOCAL_MODULE:= dpfp_threaded 133 | 134 | include $(BUILD_EXECUTABLE) 135 | -------------------------------------------------------------------------------- /android/jni/libusb.mk: -------------------------------------------------------------------------------- 1 | # Android build config for libusb 2 | # Copyright © 2012-2013 RealVNC Ltd. 3 | # 4 | # This library is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU Lesser General Public 6 | # License as published by the Free Software Foundation; either 7 | # version 2.1 of the License, or (at your option) any later version. 8 | # 9 | # This library is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | # Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public 15 | # License along with this library; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | # 18 | 19 | LOCAL_PATH:= $(call my-dir) 20 | LIBUSB_ROOT_REL:= ../.. 21 | LIBUSB_ROOT_ABS:= $(LOCAL_PATH)/../.. 22 | 23 | # libusb 24 | 25 | include $(CLEAR_VARS) 26 | 27 | LIBUSB_ROOT_REL:= ../.. 28 | LIBUSB_ROOT_ABS:= $(LOCAL_PATH)/../.. 29 | 30 | LOCAL_SRC_FILES := \ 31 | $(LIBUSB_ROOT_REL)/libusb/core.c \ 32 | $(LIBUSB_ROOT_REL)/libusb/descriptor.c \ 33 | $(LIBUSB_ROOT_REL)/libusb/hotplug.c \ 34 | $(LIBUSB_ROOT_REL)/libusb/io.c \ 35 | $(LIBUSB_ROOT_REL)/libusb/sync.c \ 36 | $(LIBUSB_ROOT_REL)/libusb/strerror.c \ 37 | $(LIBUSB_ROOT_REL)/libusb/os/linux_usbfs.c \ 38 | $(LIBUSB_ROOT_REL)/libusb/os/poll_posix.c \ 39 | $(LIBUSB_ROOT_REL)/libusb/os/threads_posix.c \ 40 | $(LIBUSB_ROOT_REL)/libusb/os/linux_netlink.c 41 | 42 | LOCAL_C_INCLUDES += \ 43 | $(LOCAL_PATH)/.. \ 44 | $(LIBUSB_ROOT_ABS)/libusb \ 45 | $(LIBUSB_ROOT_ABS)/libusb/os 46 | 47 | LOCAL_EXPORT_C_INCLUDES := \ 48 | $(LIBUSB_ROOT_ABS)/libusb 49 | 50 | LOCAL_LDLIBS := -llog 51 | 52 | LOCAL_MODULE := libusb1.0 53 | 54 | include $(BUILD_SHARED_LIBRARY) 55 | -------------------------------------------------------------------------------- /android/jni/tests.mk: -------------------------------------------------------------------------------- 1 | # Android build config for libusb tests 2 | # Copyright © 2012-2013 RealVNC Ltd. 3 | # 4 | # This library is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU Lesser General Public 6 | # License as published by the Free Software Foundation; either 7 | # version 2.1 of the License, or (at your option) any later version. 8 | # 9 | # This library is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | # Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public 15 | # License along with this library; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | # 18 | 19 | LOCAL_PATH:= $(call my-dir) 20 | LIBUSB_ROOT_REL:= ../.. 21 | LIBUSB_ROOT_ABS:= $(LOCAL_PATH)/../.. 22 | 23 | # testlib 24 | 25 | include $(CLEAR_VARS) 26 | 27 | LOCAL_SRC_FILES := \ 28 | $(LIBUSB_ROOT_REL)/tests/testlib.c 29 | 30 | LOCAL_C_INCLUDES += \ 31 | $(LIBUSB_ROOT_ABS)/tests 32 | 33 | LOCAL_EXPORT_C_INCLUDES := \ 34 | $(LIBUSB_ROOT_ABS)/tests 35 | 36 | LOCAL_MODULE := testlib 37 | 38 | include $(BUILD_STATIC_LIBRARY) 39 | 40 | 41 | # stress 42 | 43 | include $(CLEAR_VARS) 44 | 45 | LOCAL_SRC_FILES := \ 46 | $(LIBUSB_ROOT_REL)/tests/stress.c 47 | 48 | LOCAL_C_INCLUDES += \ 49 | $(LIBUSB_ROOT_ABS) 50 | 51 | LOCAL_SHARED_LIBRARIES += libusb1.0 52 | LOCAL_STATIC_LIBRARIES += testlib 53 | 54 | LOCAL_MODULE:= stress 55 | 56 | include $(BUILD_EXECUTABLE) 57 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | ./bootstrap.sh 6 | if test -z "$NOCONFIGURE"; then 7 | exec ./configure --enable-maintainer-mode --enable-examples-build --enable-tests-build "$@" 8 | fi 9 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # use libtoolize if available, otherwise look for glibtoolize (darwin) 6 | if (libtoolize --version) < /dev/null > /dev/null 2>&1; then 7 | LIBTOOLIZE=libtoolize 8 | elif (glibtoolize --version) < /dev/null > /dev/null 2>&1; then 9 | LIBTOOLIZE=glibtoolize 10 | else 11 | echo "libtoolize or glibtoolize was not found! Please install libtool." 1>&2 12 | exit 1 13 | fi 14 | 15 | $LIBTOOLIZE --copy --force || exit 1 16 | aclocal || exit 1 17 | autoheader || exit 1 18 | autoconf || exit 1 19 | automake -a -c || exit 1 20 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = doxygen.cfg.in 2 | 3 | docs: doxygen.cfg 4 | doxygen $^ 5 | 6 | docs-upload: docs 7 | ln -s html api-1.0 8 | scp -r api-1.0 pbatard@web.sourceforge.net:/home/project-web/libusbx/htdocs 9 | rm -f api-1.0 10 | -------------------------------------------------------------------------------- /doc/libusbx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LudovicRousseau/libusbx/c862377a38bff0fc7a661cd7234d25c94b0df54f/doc/libusbx.png -------------------------------------------------------------------------------- /examples/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/libusb 2 | LDADD = ../libusb/libusb-1.0.la 3 | 4 | noinst_PROGRAMS = listdevs xusb fxload hotplugtest 5 | 6 | if HAVE_SIGACTION 7 | noinst_PROGRAMS += dpfp 8 | 9 | if THREADS_POSIX 10 | dpfp_threaded_CFLAGS = $(AM_CFLAGS) 11 | noinst_PROGRAMS += dpfp_threaded 12 | endif 13 | 14 | sam3u_benchmark_SOURCES = sam3u_benchmark.c 15 | noinst_PROGRAMS += sam3u_benchmark 16 | endif 17 | 18 | fxload_SOURCES = ezusb.c ezusb.h fxload.c 19 | fxload_CFLAGS = $(THREAD_CFLAGS) $(AM_CFLAGS) 20 | -------------------------------------------------------------------------------- /examples/ezusb.h: -------------------------------------------------------------------------------- 1 | #ifndef __ezusb_H 2 | #define __ezusb_H 3 | /* 4 | * Copyright © 2001 Stephen Williams (steve@icarus.com) 5 | * Copyright © 2002 David Brownell (dbrownell@users.sourceforge.net) 6 | * Copyright © 2013 Federico Manzan (f.manzan@gmail.com) 7 | * 8 | * This source code is free software; you can redistribute it 9 | * and/or modify it in source code form under the terms of the GNU 10 | * General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) 12 | * any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 22 | */ 23 | #if !defined(_MSC_VER) 24 | #include 25 | #else 26 | #define __attribute__(x) 27 | #if !defined(bool) 28 | #define bool int 29 | #endif 30 | #if !defined(true) 31 | #define true (1 == 1) 32 | #endif 33 | #if !defined(false) 34 | #define false (!true) 35 | #endif 36 | #if defined(_PREFAST_) 37 | #pragma warning(disable:28193) 38 | #endif 39 | #endif 40 | 41 | #define FX_TYPE_UNDEFINED -1 42 | #define FX_TYPE_AN21 0 /* Original AnchorChips parts */ 43 | #define FX_TYPE_FX1 1 /* Updated Cypress versions */ 44 | #define FX_TYPE_FX2 2 /* USB 2.0 versions */ 45 | #define FX_TYPE_FX2LP 3 /* Updated FX2 */ 46 | #define FX_TYPE_FX3 4 /* USB 3.0 versions */ 47 | #define FX_TYPE_MAX 5 48 | #define FX_TYPE_NAMES { "an21", "fx", "fx2", "fx2lp", "fx3" } 49 | 50 | #define IMG_TYPE_UNDEFINED -1 51 | #define IMG_TYPE_HEX 0 /* Intel HEX */ 52 | #define IMG_TYPE_IIC 1 /* Cypress 8051 IIC */ 53 | #define IMG_TYPE_BIX 2 /* Cypress 8051 BIX */ 54 | #define IMG_TYPE_IMG 3 /* Cypress IMG format */ 55 | #define IMG_TYPE_MAX 4 56 | #define IMG_TYPE_NAMES { "Intel HEX", "Cypress 8051 IIC", "Cypress 8051 BIX", "Cypress IMG format" } 57 | 58 | #ifdef __cplusplus 59 | extern "C" { 60 | #endif 61 | 62 | /* 63 | * Automatically identified devices (VID, PID, type, designation). 64 | * TODO: Could use some validation. Also where's the FX2? 65 | */ 66 | typedef struct { 67 | uint16_t vid; 68 | uint16_t pid; 69 | int type; 70 | const char* designation; 71 | } fx_known_device; 72 | 73 | #define FX_KNOWN_DEVICES { \ 74 | { 0x0547, 0x2122, FX_TYPE_AN21, "Cypress EZ-USB (2122S)" },\ 75 | { 0x0547, 0x2125, FX_TYPE_AN21, "Cypress EZ-USB (2121S/2125S)" },\ 76 | { 0x0547, 0x2126, FX_TYPE_AN21, "Cypress EZ-USB (2126S)" },\ 77 | { 0x0547, 0x2131, FX_TYPE_AN21, "Cypress EZ-USB (2131Q/2131S/2135S)" },\ 78 | { 0x0547, 0x2136, FX_TYPE_AN21, "Cypress EZ-USB (2136S)" },\ 79 | { 0x0547, 0x2225, FX_TYPE_AN21, "Cypress EZ-USB (2225)" },\ 80 | { 0x0547, 0x2226, FX_TYPE_AN21, "Cypress EZ-USB (2226)" },\ 81 | { 0x0547, 0x2235, FX_TYPE_AN21, "Cypress EZ-USB (2235)" },\ 82 | { 0x0547, 0x2236, FX_TYPE_AN21, "Cypress EZ-USB (2236)" },\ 83 | { 0x04b4, 0x6473, FX_TYPE_FX1, "Cypress EZ-USB FX1" },\ 84 | { 0x04b4, 0x8613, FX_TYPE_FX2LP, "Cypress EZ-USB FX2LP (68013A/68014A/68015A/68016A)" }, \ 85 | { 0x04b4, 0x00f3, FX_TYPE_FX3, "Cypress FX3" },\ 86 | } 87 | 88 | /* 89 | * This function uploads the firmware from the given file into RAM. 90 | * Stage == 0 means this is a single stage load (or the first of 91 | * two stages). Otherwise it's the second of two stages; the 92 | * caller having preloaded the second stage loader. 93 | * 94 | * The target processor is reset at the end of this upload. 95 | */ 96 | extern int ezusb_load_ram(libusb_device_handle *device, 97 | const char *path, int fx_type, int img_type, int stage); 98 | 99 | /* 100 | * This function uploads the firmware from the given file into EEPROM. 101 | * This uses the right CPUCS address to terminate the EEPROM load with 102 | * a reset command where FX parts behave differently than FX2 ones. 103 | * The configuration byte is as provided here (zero for an21xx parts) 104 | * and the EEPROM type is set so that the microcontroller will boot 105 | * from it. 106 | * 107 | * The caller must have preloaded a second stage loader that knows 108 | * how to respond to the EEPROM write request. 109 | */ 110 | extern int ezusb_load_eeprom(libusb_device_handle *device, 111 | const char *path, int fx_type, int img_type, int config); 112 | 113 | /* Verbosity level (default 1). Can be increased or decreased with options v/q */ 114 | extern int verbose; 115 | 116 | #ifdef __cplusplus 117 | } 118 | #endif 119 | 120 | #endif 121 | -------------------------------------------------------------------------------- /examples/getopt/getopt1.c: -------------------------------------------------------------------------------- 1 | /* getopt_long and getopt_long_only entry points for GNU getopt. 2 | Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 3 | Free Software Foundation, Inc. 4 | This file is part of the GNU C Library. 5 | 6 | The GNU C Library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | The GNU C Library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with the GNU C Library; if not, write to the Free 18 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 19 | 02111-1307 USA. */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include "getopt.h" 26 | 27 | #if !defined __STDC__ || !__STDC__ 28 | /* This is a separate conditional since some stdc systems 29 | reject `defined (const)'. */ 30 | #ifndef const 31 | #define const 32 | #endif 33 | #endif 34 | 35 | #include 36 | 37 | /* Comment out all this code if we are using the GNU C Library, and are not 38 | actually compiling the library itself. This code is part of the GNU C 39 | Library, but also included in many other GNU distributions. Compiling 40 | and linking in this code is a waste when using the GNU C library 41 | (especially if it is a shared library). Rather than having every GNU 42 | program understand `configure --with-gnu-libc' and omit the object files, 43 | it is simpler to just do this in the source for each such file. */ 44 | 45 | #define GETOPT_INTERFACE_VERSION 2 46 | #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 47 | #include 48 | #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION 49 | #define ELIDE_CODE 50 | #endif 51 | #endif 52 | 53 | #ifndef ELIDE_CODE 54 | 55 | 56 | /* This needs to come after some library #include 57 | to get __GNU_LIBRARY__ defined. */ 58 | #ifdef __GNU_LIBRARY__ 59 | #include 60 | #endif 61 | 62 | #ifndef NULL 63 | #define NULL 0 64 | #endif 65 | 66 | int 67 | getopt_long (argc, argv, options, long_options, opt_index) 68 | int argc; 69 | char *const *argv; 70 | const char *options; 71 | const struct option *long_options; 72 | int *opt_index; 73 | { 74 | return _getopt_internal (argc, argv, options, long_options, opt_index, 0); 75 | } 76 | 77 | /* Like getopt_long, but '-' as well as '--' can indicate a long option. 78 | If an option that starts with '-' (not '--') doesn't match a long option, 79 | but does match a short option, it is parsed as a short option 80 | instead. */ 81 | 82 | int 83 | getopt_long_only (argc, argv, options, long_options, opt_index) 84 | int argc; 85 | char *const *argv; 86 | const char *options; 87 | const struct option *long_options; 88 | int *opt_index; 89 | { 90 | return _getopt_internal (argc, argv, options, long_options, opt_index, 1); 91 | } 92 | 93 | 94 | #endif /* Not ELIDE_CODE. */ 95 | 96 | #ifdef TEST 97 | 98 | #include 99 | 100 | int 101 | main (argc, argv) 102 | int argc; 103 | char **argv; 104 | { 105 | int c; 106 | int digit_optind = 0; 107 | 108 | while (1) 109 | { 110 | int this_option_optind = optind ? optind : 1; 111 | int option_index = 0; 112 | static struct option long_options[] = 113 | { 114 | {"add", 1, 0, 0}, 115 | {"append", 0, 0, 0}, 116 | {"delete", 1, 0, 0}, 117 | {"verbose", 0, 0, 0}, 118 | {"create", 0, 0, 0}, 119 | {"file", 1, 0, 0}, 120 | {0, 0, 0, 0} 121 | }; 122 | 123 | c = getopt_long (argc, argv, "abc:d:0123456789", 124 | long_options, &option_index); 125 | if (c == -1) 126 | break; 127 | 128 | switch (c) 129 | { 130 | case 0: 131 | printf ("option %s", long_options[option_index].name); 132 | if (optarg) 133 | printf (" with arg %s", optarg); 134 | printf ("\n"); 135 | break; 136 | 137 | case '0': 138 | case '1': 139 | case '2': 140 | case '3': 141 | case '4': 142 | case '5': 143 | case '6': 144 | case '7': 145 | case '8': 146 | case '9': 147 | if (digit_optind != 0 && digit_optind != this_option_optind) 148 | printf ("digits occur in two different argv-elements.\n"); 149 | digit_optind = this_option_optind; 150 | printf ("option %c\n", c); 151 | break; 152 | 153 | case 'a': 154 | printf ("option a\n"); 155 | break; 156 | 157 | case 'b': 158 | printf ("option b\n"); 159 | break; 160 | 161 | case 'c': 162 | printf ("option c with value `%s'\n", optarg); 163 | break; 164 | 165 | case 'd': 166 | printf ("option d with value `%s'\n", optarg); 167 | break; 168 | 169 | case '?': 170 | break; 171 | 172 | default: 173 | printf ("?? getopt returned character code 0%o ??\n", c); 174 | } 175 | } 176 | 177 | if (optind < argc) 178 | { 179 | printf ("non-option ARGV-elements: "); 180 | while (optind < argc) 181 | printf ("%s ", argv[optind++]); 182 | printf ("\n"); 183 | } 184 | 185 | exit (0); 186 | } 187 | 188 | #endif /* TEST */ 189 | -------------------------------------------------------------------------------- /examples/hotplugtest.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */ 2 | /* 3 | * libusb example program for hotplug API 4 | * Copyright © 2012-2013 Nathan Hjelm 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | #include "libusb.h" 25 | 26 | int done = 0; 27 | libusb_device_handle *handle; 28 | 29 | static int LIBUSB_CALL hotplug_callback(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *user_data) 30 | { 31 | struct libusb_device_descriptor desc; 32 | int rc; 33 | 34 | rc = libusb_get_device_descriptor(dev, &desc); 35 | if (LIBUSB_SUCCESS != rc) { 36 | fprintf (stderr, "Error getting device descriptor\n"); 37 | } 38 | 39 | printf ("Device attached: %04x:%04x\n", desc.idVendor, desc.idProduct); 40 | 41 | libusb_open (dev, &handle); 42 | 43 | done++; 44 | 45 | return 0; 46 | } 47 | 48 | static int LIBUSB_CALL hotplug_callback_detach(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *user_data) 49 | { 50 | printf ("Device detached\n"); 51 | 52 | libusb_close (handle); 53 | 54 | done++; 55 | return 0; 56 | } 57 | 58 | int main(int argc, char *argv[]) 59 | { 60 | libusb_hotplug_callback_handle hp[2]; 61 | int product_id, vendor_id, class_id; 62 | int rc; 63 | 64 | vendor_id = (argc > 1) ? strtol (argv[1], NULL, 0) : 0x045a; 65 | product_id = (argc > 2) ? strtol (argv[2], NULL, 0) : 0x5005; 66 | class_id = (argc > 3) ? strtol (argv[3], NULL, 0) : LIBUSB_HOTPLUG_MATCH_ANY; 67 | 68 | rc = libusb_init (NULL); 69 | if (rc < 0) 70 | { 71 | printf("failed to initialise libusb: %s\n", libusb_error_name(rc)); 72 | return EXIT_FAILURE; 73 | } 74 | 75 | if (!libusb_has_capability (LIBUSB_CAP_HAS_HOTPLUG)) { 76 | printf ("Hotplug capabilites are not supported on this platform\n"); 77 | libusb_exit (NULL); 78 | return EXIT_FAILURE; 79 | } 80 | 81 | rc = libusb_hotplug_register_callback (NULL, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, 0, vendor_id, 82 | product_id, class_id, hotplug_callback, NULL, &hp[0]); 83 | if (LIBUSB_SUCCESS != rc) { 84 | fprintf (stderr, "Error registering callback 0\n"); 85 | libusb_exit (NULL); 86 | return EXIT_FAILURE; 87 | } 88 | 89 | rc = libusb_hotplug_register_callback (NULL, LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT, 0, vendor_id, 90 | product_id,class_id, hotplug_callback_detach, NULL, &hp[1]); 91 | if (LIBUSB_SUCCESS != rc) { 92 | fprintf (stderr, "Error registering callback 1\n"); 93 | libusb_exit (NULL); 94 | return EXIT_FAILURE; 95 | } 96 | 97 | while (done < 2) { 98 | rc = libusb_handle_events (NULL); 99 | if (rc < 0) 100 | printf("libusb_handle_events() failed: %s\n", libusb_error_name(rc)); 101 | } 102 | 103 | libusb_exit (NULL); 104 | } 105 | -------------------------------------------------------------------------------- /examples/listdevs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libusbx example program to list devices on the bus 3 | * Copyright © 2007 Daniel Drake 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #include 21 | 22 | #include "libusb.h" 23 | 24 | static void print_devs(libusb_device **devs) 25 | { 26 | libusb_device *dev; 27 | int i = 0, j = 0; 28 | uint8_t path[8]; 29 | 30 | while ((dev = devs[i++]) != NULL) { 31 | struct libusb_device_descriptor desc; 32 | int r = libusb_get_device_descriptor(dev, &desc); 33 | if (r < 0) { 34 | fprintf(stderr, "failed to get device descriptor"); 35 | return; 36 | } 37 | 38 | printf("%04x:%04x (bus %d, device %d)", 39 | desc.idVendor, desc.idProduct, 40 | libusb_get_bus_number(dev), libusb_get_device_address(dev)); 41 | 42 | r = libusb_get_port_numbers(dev, path, sizeof(path)); 43 | if (r > 0) { 44 | printf(" path: %d", path[0]); 45 | for (j = 1; j < r; j++) 46 | printf(".%d", path[j]); 47 | } 48 | printf("\n"); 49 | } 50 | } 51 | 52 | int main(void) 53 | { 54 | libusb_device **devs; 55 | int r; 56 | ssize_t cnt; 57 | 58 | r = libusb_init(NULL); 59 | if (r < 0) 60 | return r; 61 | 62 | cnt = libusb_get_device_list(NULL, &devs); 63 | if (cnt < 0) 64 | return (int) cnt; 65 | 66 | print_devs(devs); 67 | libusb_free_device_list(devs, 1); 68 | 69 | libusb_exit(NULL); 70 | return 0; 71 | } 72 | -------------------------------------------------------------------------------- /examples/sam3u_benchmark.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libusb example program to measure Atmel SAM3U isochronous performance 3 | * Copyright (C) 2012 Harald Welte 4 | * 5 | * Copied with the author's permission under LGPL-2.1 from 6 | * http://git.gnumonks.org/cgi-bin/gitweb.cgi?p=sam3u-tests.git;a=blob;f=usb-benchmark-project/host/benchmark.c;h=74959f7ee88f1597286cd435f312a8ff52c56b7e 7 | * 8 | * An Atmel SAM3U test firmware is also available in the above repository. 9 | * 10 | * This library is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU Lesser General Public 12 | * License as published by the Free Software Foundation; either 13 | * version 2.1 of the License, or (at your option) any later version. 14 | * 15 | * This library is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | 34 | #define EP_DATA_IN 0x82 35 | #define EP_ISO_IN 0x86 36 | 37 | static int do_exit = 0; 38 | static struct libusb_device_handle *devh = NULL; 39 | 40 | static unsigned long num_bytes = 0, num_xfer = 0; 41 | static struct timeval tv_start; 42 | 43 | static void LIBUSB_CALL cb_xfr(struct libusb_transfer *xfr) 44 | { 45 | unsigned int i; 46 | 47 | if (xfr->status != LIBUSB_TRANSFER_COMPLETED) { 48 | fprintf(stderr, "transfer status %d\n", xfr->status); 49 | libusb_free_transfer(xfr); 50 | exit(3); 51 | } 52 | 53 | if (xfr->type == LIBUSB_TRANSFER_TYPE_ISOCHRONOUS) { 54 | for (i = 0; i < xfr->num_iso_packets; i++) { 55 | struct libusb_iso_packet_descriptor *pack = &xfr->iso_packet_desc[i]; 56 | 57 | if (pack->status != LIBUSB_TRANSFER_COMPLETED) { 58 | fprintf(stderr, "Error: pack %u status %d\n", i, pack->status); 59 | exit(5); 60 | } 61 | 62 | printf("pack%u length:%u, actual_length:%u\n", i, pack->length, pack->actual_length); 63 | } 64 | } 65 | 66 | printf("length:%u, actual_length:%u\n", xfr->length, xfr->actual_length); 67 | for (i = 0; i < xfr->actual_length; i++) { 68 | printf("%02x", xfr->buffer[i]); 69 | if (i % 16) 70 | printf("\n"); 71 | else if (i % 8) 72 | printf(" "); 73 | else 74 | printf(" "); 75 | } 76 | num_bytes += xfr->actual_length; 77 | num_xfer++; 78 | 79 | if (libusb_submit_transfer(xfr) < 0) { 80 | fprintf(stderr, "error re-submitting URB\n"); 81 | exit(1); 82 | } 83 | } 84 | 85 | static int benchmark_in(uint8_t ep) 86 | { 87 | static uint8_t buf[2048]; 88 | static struct libusb_transfer *xfr; 89 | int num_iso_pack = 0; 90 | 91 | if (ep == EP_ISO_IN) 92 | num_iso_pack = 16; 93 | 94 | xfr = libusb_alloc_transfer(num_iso_pack); 95 | if (!xfr) 96 | return -ENOMEM; 97 | 98 | if (ep == EP_ISO_IN) { 99 | libusb_fill_iso_transfer(xfr, devh, ep, buf, 100 | sizeof(buf), num_iso_pack, cb_xfr, NULL, 0); 101 | libusb_set_iso_packet_lengths(xfr, sizeof(buf)/num_iso_pack); 102 | } else 103 | libusb_fill_bulk_transfer(xfr, devh, ep, buf, 104 | sizeof(buf), cb_xfr, NULL, 0); 105 | 106 | gettimeofday(&tv_start, NULL); 107 | 108 | /* NOTE: To reach maximum possible performance the program must 109 | * submit *multiple* transfers here, not just one. 110 | * 111 | * When only one transfer is submitted there is a gap in the bus 112 | * schedule from when the transfer completes until a new transfer 113 | * is submitted by the callback. This causes some jitter for 114 | * isochronous transfers and loss of throughput for bulk transfers. 115 | * 116 | * This is avoided by queueing multiple transfers in advance, so 117 | * that the host controller is always kept busy, and will schedule 118 | * more transfers on the bus while the callback is running for 119 | * transfers which have completed on the bus. 120 | */ 121 | 122 | return libusb_submit_transfer(xfr); 123 | } 124 | 125 | static void measure(void) 126 | { 127 | struct timeval tv_stop; 128 | unsigned int diff_msec; 129 | 130 | gettimeofday(&tv_stop, NULL); 131 | 132 | diff_msec = (tv_stop.tv_sec - tv_start.tv_sec)*1000; 133 | diff_msec += (tv_stop.tv_usec - tv_start.tv_usec)/1000; 134 | 135 | printf("%lu transfers (total %lu bytes) in %u miliseconds => %lu bytes/sec\n", 136 | num_xfer, num_bytes, diff_msec, (num_bytes*1000)/diff_msec); 137 | } 138 | 139 | static void sig_hdlr(int signum) 140 | { 141 | switch (signum) { 142 | case SIGINT: 143 | measure(); 144 | do_exit = 1; 145 | break; 146 | } 147 | } 148 | 149 | int main(int argc, char **argv) 150 | { 151 | int rc; 152 | struct sigaction sigact; 153 | 154 | sigact.sa_handler = sig_hdlr; 155 | sigemptyset(&sigact.sa_mask); 156 | sigact.sa_flags = 0; 157 | sigaction(SIGINT, &sigact, NULL); 158 | 159 | rc = libusb_init(NULL); 160 | if (rc < 0) { 161 | fprintf(stderr, "Error initializing libusb: %s\n", libusb_error_name(rc)); 162 | exit(1); 163 | } 164 | 165 | devh = libusb_open_device_with_vid_pid(NULL, 0x16c0, 0x0763); 166 | if (!devh) { 167 | fprintf(stderr, "Error finding USB device\n"); 168 | goto out; 169 | } 170 | 171 | rc = libusb_claim_interface(devh, 2); 172 | if (rc < 0) { 173 | fprintf(stderr, "Error claiming interface: %s\n", libusb_error_name(rc)); 174 | goto out; 175 | } 176 | 177 | benchmark_in(EP_ISO_IN); 178 | 179 | while (!do_exit) { 180 | rc = libusb_handle_events(NULL); 181 | if (rc != LIBUSB_SUCCESS) 182 | break; 183 | } 184 | 185 | /* Measurement has already been done by the signal handler. */ 186 | 187 | libusb_release_interface(devh, 0); 188 | out: 189 | if (devh) 190 | libusb_close(devh); 191 | libusb_exit(NULL); 192 | return rc; 193 | } 194 | -------------------------------------------------------------------------------- /libusb-1.0.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libusbx-1.0 7 | Description: C API for USB device access from Linux, Mac OS X, Windows and OpenBSD/NetBSD userspace 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lusb-1.0 10 | Libs.private: @LIBS@ 11 | Cflags: -I${includedir}/libusb-1.0 12 | -------------------------------------------------------------------------------- /libusb/Makefile.am: -------------------------------------------------------------------------------- 1 | all: libusb-1.0.la libusb-1.0.dll 2 | 3 | AUTOMAKE_OPTIONS = subdir-objects 4 | 5 | lib_LTLIBRARIES = libusb-1.0.la 6 | 7 | POSIX_POLL_SRC = os/poll_posix.c 8 | LINUX_USBFS_SRC = os/linux_usbfs.c 9 | DARWIN_USB_SRC = os/darwin_usb.c 10 | OPENBSD_USB_SRC = os/openbsd_usb.c 11 | NETBSD_USB_SRC = os/netbsd_usb.c 12 | WINDOWS_USB_SRC = os/poll_windows.c os/windows_usb.c libusb-1.0.rc libusb-1.0.def 13 | WINCE_USB_SRC = os/wince_usb.c os/wince_usb.h 14 | 15 | EXTRA_DIST = $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) $(OPENBSD_USB_SRC) \ 16 | $(NETBSD_USB_SRC) $(WINDOWS_USB_SRC) $(WINCE_USB_SRC) \ 17 | $(POSIX_POLL_SRC) \ 18 | os/threads_posix.c os/threads_windows.c \ 19 | os/linux_udev.c os/linux_netlink.c 20 | 21 | if OS_LINUX 22 | 23 | if USE_UDEV 24 | OS_SRC = $(LINUX_USBFS_SRC) $(POSIX_POLL_SRC) \ 25 | os/linux_udev.c 26 | else 27 | OS_SRC = $(LINUX_USBFS_SRC) $(POSIX_POLL_SRC) \ 28 | os/linux_netlink.c 29 | endif 30 | 31 | endif 32 | 33 | if OS_DARWIN 34 | OS_SRC = $(DARWIN_USB_SRC) $(POSIX_POLL_SRC) 35 | AM_CFLAGS_EXT = -no-cpp-precomp 36 | endif 37 | 38 | if OS_OPENBSD 39 | OS_SRC = $(OPENBSD_USB_SRC) $(POSIX_POLL_SRC) 40 | endif 41 | 42 | if OS_NETBSD 43 | OS_SRC = $(NETBSD_USB_SRC) $(POSIX_POLL_SRC) 44 | endif 45 | 46 | if OS_WINDOWS 47 | OS_SRC = $(WINDOWS_USB_SRC) 48 | 49 | .rc.lo: 50 | $(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) -i $< -o $@ 51 | 52 | libusb-1.0.rc: version.h version_nano.h 53 | endif 54 | 55 | libusb-1.0.dll: libusb-1.0.def 56 | if CREATE_IMPORT_LIB 57 | # Rebuild the import lib from the .def so that MS and MinGW DLLs can be interchanged 58 | $(AM_V_GEN)$(DLLTOOL) $(DLLTOOLFLAGS) --kill-at --input-def $(srcdir)/libusb-1.0.def --dllname $@ --output-lib .libs/$@.a 59 | endif 60 | 61 | if THREADS_POSIX 62 | THREADS_SRC = os/threads_posix.h os/threads_posix.c 63 | else 64 | THREADS_SRC = os/threads_windows.h os/threads_windows.c 65 | endif 66 | 67 | libusb_1_0_la_CFLAGS = $(AM_CFLAGS) 68 | libusb_1_0_la_LDFLAGS = $(LTLDFLAGS) 69 | libusb_1_0_la_SOURCES = libusbi.h core.c descriptor.c io.c strerror.c sync.c \ 70 | os/linux_usbfs.h os/darwin_usb.h os/windows_usb.h os/windows_common.h \ 71 | hotplug.h hotplug.c $(THREADS_SRC) $(OS_SRC) \ 72 | os/poll_posix.h os/poll_windows.h 73 | 74 | hdrdir = $(includedir)/libusb-1.0 75 | hdr_HEADERS = libusb.h 76 | -------------------------------------------------------------------------------- /libusb/hotplug.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */ 2 | /* 3 | * Hotplug support for libusbx 4 | * Copyright © 2012-2013 Nathan Hjelm 5 | * Copyright © 2012-2013 Peter Stuge 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #if !defined(USBI_HOTPLUG_H) 23 | #define USBI_HOTPLUG_H 24 | 25 | #ifndef LIBUSBI_H 26 | #include "libusbi.h" 27 | #endif 28 | 29 | /** \ingroup hotplug 30 | * The hotplug callback structure. The user populates this structure with 31 | * libusb_hotplug_prepare_callback() and then calls libusb_hotplug_register_callback() 32 | * to receive notification of hotplug events. 33 | */ 34 | struct libusb_hotplug_callback { 35 | /** Context this callback is associated with */ 36 | struct libusb_context *ctx; 37 | 38 | /** Vendor ID to match or LIBUSB_HOTPLUG_MATCH_ANY */ 39 | int vendor_id; 40 | 41 | /** Product ID to match or LIBUSB_HOTPLUG_MATCH_ANY */ 42 | int product_id; 43 | 44 | /** Device class to match or LIBUSB_HOTPLUG_MATCH_ANY */ 45 | int dev_class; 46 | 47 | /** Hotplug callback flags */ 48 | libusb_hotplug_flag flags; 49 | 50 | /** Event(s) that will trigger this callback */ 51 | libusb_hotplug_event events; 52 | 53 | /** Callback function to invoke for matching event/device */ 54 | libusb_hotplug_callback_fn cb; 55 | 56 | /** Handle for this callback (used to match on deregister) */ 57 | libusb_hotplug_callback_handle handle; 58 | 59 | /** User data that will be passed to the callback function */ 60 | void *user_data; 61 | 62 | /** Callback is marked for deletion */ 63 | int needs_free; 64 | 65 | /** List this callback is registered in (ctx->hotplug_cbs) */ 66 | struct list_head list; 67 | }; 68 | 69 | typedef struct libusb_hotplug_callback libusb_hotplug_callback; 70 | 71 | struct libusb_hotplug_message { 72 | libusb_hotplug_event event; 73 | struct libusb_device *device; 74 | }; 75 | 76 | typedef struct libusb_hotplug_message libusb_hotplug_message; 77 | 78 | void usbi_hotplug_deregister_all(struct libusb_context *ctx); 79 | void usbi_hotplug_match(struct libusb_context *ctx, struct libusb_device *dev, 80 | libusb_hotplug_event event); 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /libusb/libusb-1.0.rc: -------------------------------------------------------------------------------- 1 | /* 2 | * For Windows: input this file to the Resoure Compiler to produce a binary 3 | * .res file. This is then embedded in the resultant library (like any other 4 | * compilation object). 5 | * The information can then be queried using standard APIs and can also be 6 | * viewed with utilities such as Windows Explorer. 7 | */ 8 | #ifndef _WIN32_WCE 9 | #include "winresrc.h" 10 | #endif 11 | 12 | #include "version.h" 13 | #ifndef LIBUSB_VERSIONSTRING 14 | #define LU_STR(s) #s 15 | #define LU_XSTR(s) LU_STR(s) 16 | #if LIBUSB_NANO > 0 17 | #define LIBUSB_VERSIONSTRING \ 18 | LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." \ 19 | LU_XSTR(LIBUSB_MICRO) "." LU_XSTR(LIBUSB_NANO) LIBUSB_RC "\0" 20 | #else 21 | #define LIBUSB_VERSIONSTRING \ 22 | LU_XSTR(LIBUSB_MAJOR) "." LU_XSTR(LIBUSB_MINOR) "." \ 23 | LU_XSTR(LIBUSB_MICRO) LIBUSB_RC "\0" 24 | #endif 25 | #endif 26 | 27 | VS_VERSION_INFO VERSIONINFO 28 | FILEVERSION LIBUSB_MAJOR,LIBUSB_MINOR,LIBUSB_MICRO,LIBUSB_NANO 29 | PRODUCTVERSION LIBUSB_MAJOR,LIBUSB_MINOR,LIBUSB_MICRO,LIBUSB_NANO 30 | FILEFLAGSMASK 0x3fL 31 | #ifdef _DEBUG 32 | FILEFLAGS 0x1L 33 | #else 34 | FILEFLAGS 0x0L 35 | #endif 36 | FILEOS 0x40004L 37 | FILETYPE 0x2L 38 | FILESUBTYPE 0x0L 39 | BEGIN 40 | BLOCK "StringFileInfo" 41 | BEGIN 42 | BLOCK "040904b0" 43 | BEGIN 44 | VALUE "CompanyName", "libusbx.org\0" 45 | VALUE "FileDescription", "C library for writing portable USB drivers in userspace\0" 46 | VALUE "FileVersion", LIBUSB_VERSIONSTRING 47 | VALUE "InternalName", "libusb\0" 48 | VALUE "LegalCopyright", "See individual source files, GNU LGPL v2.1 or later.\0" 49 | VALUE "LegalTrademarks", "http://www.gnu.org/licenses/lgpl-2.1.html\0" 50 | VALUE "OriginalFilename", "libusb-1.0.dll\0" 51 | VALUE "PrivateBuild", "\0" 52 | VALUE "ProductName", "libusb-1.0\0" 53 | VALUE "ProductVersion", LIBUSB_VERSIONSTRING 54 | VALUE "SpecialBuild", "\0" 55 | END 56 | END 57 | BLOCK "VarFileInfo" 58 | BEGIN 59 | VALUE "Translation", 0x409, 1200 60 | END 61 | END 62 | -------------------------------------------------------------------------------- /libusb/os/darwin_usb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * darwin backend for libusbx 1.0 3 | * Copyright © 2008-2013 Nathan Hjelm 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #if !defined(LIBUSB_DARWIN_H) 21 | #define LIBUSB_DARWIN_H 22 | 23 | #include "libusbi.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | /* IOUSBInterfaceInferface */ 31 | #if defined (kIOUSBInterfaceInterfaceID550) 32 | 33 | #define usb_interface_t IOUSBInterfaceInterface550 34 | #define InterfaceInterfaceID kIOUSBInterfaceInterfaceID550 35 | #define InterfaceVersion 550 36 | 37 | #elif defined (kIOUSBInterfaceInterfaceID500) 38 | 39 | #define usb_interface_t IOUSBInterfaceInterface500 40 | #define InterfaceInterfaceID kIOUSBInterfaceInterfaceID500 41 | #define InterfaceVersion 500 42 | 43 | #elif defined (kIOUSBInterfaceInterfaceID300) 44 | 45 | #define usb_interface_t IOUSBInterfaceInterface300 46 | #define InterfaceInterfaceID kIOUSBInterfaceInterfaceID300 47 | #define InterfaceVersion 300 48 | 49 | #elif defined (kIOUSBInterfaceInterfaceID245) 50 | 51 | #define usb_interface_t IOUSBInterfaceInterface245 52 | #define InterfaceInterfaceID kIOUSBInterfaceInterfaceID245 53 | #define InterfaceVersion 245 54 | 55 | #elif defined (kIOUSBInterfaceInterfaceID220) 56 | 57 | #define usb_interface_t IOUSBInterfaceInterface220 58 | #define InterfaceInterfaceID kIOUSBInterfaceInterfaceID220 59 | #define InterfaceVersion 220 60 | 61 | #else 62 | 63 | #error "IOUSBFamily is too old. Please upgrade your OS" 64 | 65 | #endif 66 | 67 | /* IOUSBDeviceInterface */ 68 | #if defined (kIOUSBDeviceInterfaceID500) 69 | 70 | #define usb_device_t IOUSBDeviceInterface500 71 | #define DeviceInterfaceID kIOUSBDeviceInterfaceID500 72 | #define DeviceVersion 500 73 | 74 | #elif defined (kIOUSBDeviceInterfaceID320) 75 | 76 | #define usb_device_t IOUSBDeviceInterface320 77 | #define DeviceInterfaceID kIOUSBDeviceInterfaceID320 78 | #define DeviceVersion 320 79 | 80 | #elif defined (kIOUSBDeviceInterfaceID300) 81 | 82 | #define usb_device_t IOUSBDeviceInterface300 83 | #define DeviceInterfaceID kIOUSBDeviceInterfaceID300 84 | #define DeviceVersion 300 85 | 86 | #elif defined (kIOUSBDeviceInterfaceID245) 87 | 88 | #define usb_device_t IOUSBDeviceInterface245 89 | #define DeviceInterfaceID kIOUSBDeviceInterfaceID245 90 | #define DeviceVersion 245 91 | 92 | #elif defined (kIOUSBDeviceInterfaceID220) 93 | #define usb_device_t IOUSBDeviceInterface197 94 | #define DeviceInterfaceID kIOUSBDeviceInterfaceID197 95 | #define DeviceVersion 197 96 | 97 | #else 98 | 99 | #error "IOUSBFamily is too old. Please upgrade your OS" 100 | 101 | #endif 102 | 103 | #if !defined(IO_OBJECT_NULL) 104 | #define IO_OBJECT_NULL ((io_object_t) 0) 105 | #endif 106 | 107 | typedef IOCFPlugInInterface *io_cf_plugin_ref_t; 108 | typedef IONotificationPortRef io_notification_port_t; 109 | 110 | /* private structures */ 111 | struct darwin_cached_device { 112 | struct list_head list; 113 | IOUSBDeviceDescriptor dev_descriptor; 114 | UInt32 location; 115 | UInt64 parent_session; 116 | UInt64 session; 117 | UInt16 address; 118 | char sys_path[21]; 119 | usb_device_t **device; 120 | int open_count; 121 | UInt8 first_config, active_config, port; 122 | int can_enumerate; 123 | int refcount; 124 | }; 125 | 126 | struct darwin_device_priv { 127 | struct darwin_cached_device *dev; 128 | }; 129 | 130 | struct darwin_device_handle_priv { 131 | int is_open; 132 | CFRunLoopSourceRef cfSource; 133 | int fds[2]; 134 | 135 | struct darwin_interface { 136 | usb_interface_t **interface; 137 | uint8_t num_endpoints; 138 | CFRunLoopSourceRef cfSource; 139 | uint64_t frames[256]; 140 | uint8_t endpoint_addrs[USB_MAXENDPOINTS]; 141 | } interfaces[USB_MAXINTERFACES]; 142 | }; 143 | 144 | struct darwin_transfer_priv { 145 | /* Isoc */ 146 | IOUSBIsocFrame *isoc_framelist; 147 | int num_iso_packets; 148 | 149 | /* Control */ 150 | IOUSBDevRequestTO req; 151 | 152 | /* Bulk */ 153 | }; 154 | 155 | /* structure for signaling io completion */ 156 | struct darwin_msg_async_io_complete { 157 | struct usbi_transfer *itransfer; 158 | IOReturn result; 159 | UInt32 size; 160 | }; 161 | 162 | #endif 163 | -------------------------------------------------------------------------------- /libusb/os/linux_usbfs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * usbfs header structures 3 | * Copyright © 2007 Daniel Drake 4 | * Copyright © 2001 Johannes Erdfelt 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef LIBUSB_USBFS_H 22 | #define LIBUSB_USBFS_H 23 | 24 | #include 25 | 26 | #define SYSFS_DEVICE_PATH "/sys/bus/usb/devices" 27 | 28 | struct usbfs_ctrltransfer { 29 | /* keep in sync with usbdevice_fs.h:usbdevfs_ctrltransfer */ 30 | uint8_t bmRequestType; 31 | uint8_t bRequest; 32 | uint16_t wValue; 33 | uint16_t wIndex; 34 | uint16_t wLength; 35 | 36 | uint32_t timeout; /* in milliseconds */ 37 | 38 | /* pointer to data */ 39 | void *data; 40 | }; 41 | 42 | struct usbfs_bulktransfer { 43 | /* keep in sync with usbdevice_fs.h:usbdevfs_bulktransfer */ 44 | unsigned int ep; 45 | unsigned int len; 46 | unsigned int timeout; /* in milliseconds */ 47 | 48 | /* pointer to data */ 49 | void *data; 50 | }; 51 | 52 | struct usbfs_setinterface { 53 | /* keep in sync with usbdevice_fs.h:usbdevfs_setinterface */ 54 | unsigned int interface; 55 | unsigned int altsetting; 56 | }; 57 | 58 | #define USBFS_MAXDRIVERNAME 255 59 | 60 | struct usbfs_getdriver { 61 | unsigned int interface; 62 | char driver[USBFS_MAXDRIVERNAME + 1]; 63 | }; 64 | 65 | #define USBFS_URB_SHORT_NOT_OK 0x01 66 | #define USBFS_URB_ISO_ASAP 0x02 67 | #define USBFS_URB_BULK_CONTINUATION 0x04 68 | #define USBFS_URB_QUEUE_BULK 0x10 69 | #define USBFS_URB_ZERO_PACKET 0x40 70 | 71 | enum usbfs_urb_type { 72 | USBFS_URB_TYPE_ISO = 0, 73 | USBFS_URB_TYPE_INTERRUPT = 1, 74 | USBFS_URB_TYPE_CONTROL = 2, 75 | USBFS_URB_TYPE_BULK = 3, 76 | }; 77 | 78 | struct usbfs_iso_packet_desc { 79 | unsigned int length; 80 | unsigned int actual_length; 81 | unsigned int status; 82 | }; 83 | 84 | #define MAX_ISO_BUFFER_LENGTH 32768 85 | #define MAX_BULK_BUFFER_LENGTH 16384 86 | #define MAX_CTRL_BUFFER_LENGTH 4096 87 | 88 | struct usbfs_urb { 89 | unsigned char type; 90 | unsigned char endpoint; 91 | int status; 92 | unsigned int flags; 93 | void *buffer; 94 | int buffer_length; 95 | int actual_length; 96 | int start_frame; 97 | int number_of_packets; 98 | int error_count; 99 | unsigned int signr; 100 | void *usercontext; 101 | struct usbfs_iso_packet_desc iso_frame_desc[0]; 102 | }; 103 | 104 | struct usbfs_connectinfo { 105 | unsigned int devnum; 106 | unsigned char slow; 107 | }; 108 | 109 | struct usbfs_ioctl { 110 | int ifno; /* interface 0..N ; negative numbers reserved */ 111 | int ioctl_code; /* MUST encode size + direction of data so the 112 | * macros in give correct values */ 113 | void *data; /* param buffer (in, or out) */ 114 | }; 115 | 116 | struct usbfs_hub_portinfo { 117 | unsigned char numports; 118 | unsigned char port[127]; /* port to device num mapping */ 119 | }; 120 | 121 | #define USBFS_CAP_ZERO_PACKET 0x01 122 | #define USBFS_CAP_BULK_CONTINUATION 0x02 123 | #define USBFS_CAP_NO_PACKET_SIZE_LIM 0x04 124 | #define USBFS_CAP_BULK_SCATTER_GATHER 0x08 125 | 126 | #define USBFS_DISCONNECT_CLAIM_IF_DRIVER 0x01 127 | #define USBFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02 128 | 129 | struct usbfs_disconnect_claim { 130 | unsigned int interface; 131 | unsigned int flags; 132 | char driver[USBFS_MAXDRIVERNAME + 1]; 133 | }; 134 | 135 | #define IOCTL_USBFS_CONTROL _IOWR('U', 0, struct usbfs_ctrltransfer) 136 | #define IOCTL_USBFS_BULK _IOWR('U', 2, struct usbfs_bulktransfer) 137 | #define IOCTL_USBFS_RESETEP _IOR('U', 3, unsigned int) 138 | #define IOCTL_USBFS_SETINTF _IOR('U', 4, struct usbfs_setinterface) 139 | #define IOCTL_USBFS_SETCONFIG _IOR('U', 5, unsigned int) 140 | #define IOCTL_USBFS_GETDRIVER _IOW('U', 8, struct usbfs_getdriver) 141 | #define IOCTL_USBFS_SUBMITURB _IOR('U', 10, struct usbfs_urb) 142 | #define IOCTL_USBFS_DISCARDURB _IO('U', 11) 143 | #define IOCTL_USBFS_REAPURB _IOW('U', 12, void *) 144 | #define IOCTL_USBFS_REAPURBNDELAY _IOW('U', 13, void *) 145 | #define IOCTL_USBFS_CLAIMINTF _IOR('U', 15, unsigned int) 146 | #define IOCTL_USBFS_RELEASEINTF _IOR('U', 16, unsigned int) 147 | #define IOCTL_USBFS_CONNECTINFO _IOW('U', 17, struct usbfs_connectinfo) 148 | #define IOCTL_USBFS_IOCTL _IOWR('U', 18, struct usbfs_ioctl) 149 | #define IOCTL_USBFS_HUB_PORTINFO _IOR('U', 19, struct usbfs_hub_portinfo) 150 | #define IOCTL_USBFS_RESET _IO('U', 20) 151 | #define IOCTL_USBFS_CLEAR_HALT _IOR('U', 21, unsigned int) 152 | #define IOCTL_USBFS_DISCONNECT _IO('U', 22) 153 | #define IOCTL_USBFS_CONNECT _IO('U', 23) 154 | #define IOCTL_USBFS_CLAIM_PORT _IOR('U', 24, unsigned int) 155 | #define IOCTL_USBFS_RELEASE_PORT _IOR('U', 25, unsigned int) 156 | #define IOCTL_USBFS_GET_CAPABILITIES _IOR('U', 26, __u32) 157 | #define IOCTL_USBFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbfs_disconnect_claim) 158 | 159 | extern usbi_mutex_static_t linux_hotplug_lock; 160 | 161 | #if defined(HAVE_LIBUDEV) 162 | int linux_udev_start_event_monitor(void); 163 | int linux_udev_stop_event_monitor(void); 164 | int linux_udev_scan_devices(struct libusb_context *ctx); 165 | void linux_udev_hotplug_poll(void); 166 | #else 167 | int linux_netlink_start_event_monitor(void); 168 | int linux_netlink_stop_event_monitor(void); 169 | void linux_netlink_hotplug_poll(void); 170 | #endif 171 | 172 | void linux_hotplug_enumerate(uint8_t busnum, uint8_t devaddr, const char *sys_name); 173 | void linux_device_disconnected(uint8_t busnum, uint8_t devaddr, const char *sys_name); 174 | 175 | int linux_get_device_address (struct libusb_context *ctx, int detached, 176 | uint8_t *busnum, uint8_t *devaddr, const char *dev_node, 177 | const char *sys_name); 178 | int linux_enumerate_device(struct libusb_context *ctx, 179 | uint8_t busnum, uint8_t devaddr, const char *sysfs_dir); 180 | 181 | #endif 182 | -------------------------------------------------------------------------------- /libusb/os/poll_posix.c: -------------------------------------------------------------------------------- 1 | /* 2 | * poll_posix: poll compatibility wrapper for POSIX systems 3 | * Copyright © 2013 RealVNC Ltd. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | * 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "libusbi.h" 27 | 28 | int usbi_pipe(int pipefd[2]) 29 | { 30 | int ret = pipe(pipefd); 31 | if (ret != 0) { 32 | return ret; 33 | } 34 | ret = fcntl(pipefd[1], F_GETFL); 35 | if (ret == -1) { 36 | usbi_dbg("Failed to get pipe fd flags: %d", errno); 37 | goto err_close_pipe; 38 | } 39 | ret = fcntl(pipefd[1], F_SETFL, ret | O_NONBLOCK); 40 | if (ret != 0) { 41 | usbi_dbg("Failed to set non-blocking on new pipe: %d", errno); 42 | goto err_close_pipe; 43 | } 44 | 45 | return 0; 46 | 47 | err_close_pipe: 48 | usbi_close(pipefd[0]); 49 | usbi_close(pipefd[1]); 50 | return ret; 51 | } 52 | -------------------------------------------------------------------------------- /libusb/os/poll_posix.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBUSB_POLL_POSIX_H 2 | #define LIBUSB_POLL_POSIX_H 3 | 4 | #define usbi_write write 5 | #define usbi_read read 6 | #define usbi_close close 7 | #define usbi_poll poll 8 | 9 | int usbi_pipe(int pipefd[2]); 10 | 11 | #endif /* LIBUSB_POLL_POSIX_H */ 12 | -------------------------------------------------------------------------------- /libusb/os/poll_windows.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Windows compat: POSIX compatibility wrapper 3 | * Copyright © 2012-2013 RealVNC Ltd. 4 | * Copyright © 2009-2010 Pete Batard 5 | * With contributions from Michael Plante, Orin Eman et al. 6 | * Parts of poll implementation from libusb-win32, by Stephan Meyer et al. 7 | * 8 | * This library is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * This library is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with this library; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | * 22 | */ 23 | #pragma once 24 | 25 | #if defined(_MSC_VER) 26 | // disable /W4 MSVC warnings that are benign 27 | #pragma warning(disable:4127) // conditional expression is constant 28 | #endif 29 | 30 | // Handle synchronous completion through the overlapped structure 31 | #if !defined(STATUS_REPARSE) // reuse the REPARSE status code 32 | #define STATUS_REPARSE ((LONG)0x00000104L) 33 | #endif 34 | #define STATUS_COMPLETED_SYNCHRONOUSLY STATUS_REPARSE 35 | #if defined(_WIN32_WCE) 36 | // WinCE doesn't have a HasOverlappedIoCompleted() macro, so attempt to emulate it 37 | #define HasOverlappedIoCompleted(lpOverlapped) (((DWORD)(lpOverlapped)->Internal) != STATUS_PENDING) 38 | #endif 39 | #define HasOverlappedIoCompletedSync(lpOverlapped) (((DWORD)(lpOverlapped)->Internal) == STATUS_COMPLETED_SYNCHRONOUSLY) 40 | 41 | #define DUMMY_HANDLE ((HANDLE)(LONG_PTR)-2) 42 | 43 | enum windows_version { 44 | WINDOWS_UNSUPPORTED, 45 | WINDOWS_CE, 46 | WINDOWS_XP, 47 | WINDOWS_2003, // also includes XP 64 48 | WINDOWS_VISTA_AND_LATER, 49 | }; 50 | extern enum windows_version windows_version; 51 | 52 | #define MAX_FDS 256 53 | 54 | #define POLLIN 0x0001 /* There is data to read */ 55 | #define POLLPRI 0x0002 /* There is urgent data to read */ 56 | #define POLLOUT 0x0004 /* Writing now will not block */ 57 | #define POLLERR 0x0008 /* Error condition */ 58 | #define POLLHUP 0x0010 /* Hung up */ 59 | #define POLLNVAL 0x0020 /* Invalid request: fd not open */ 60 | 61 | struct pollfd { 62 | int fd; /* file descriptor */ 63 | short events; /* requested events */ 64 | short revents; /* returned events */ 65 | }; 66 | 67 | // access modes 68 | enum rw_type { 69 | RW_NONE, 70 | RW_READ, 71 | RW_WRITE, 72 | }; 73 | 74 | // fd struct that can be used for polling on Windows 75 | typedef int cancel_transfer(struct usbi_transfer *itransfer); 76 | 77 | struct winfd { 78 | int fd; // what's exposed to libusb core 79 | HANDLE handle; // what we need to attach overlapped to the I/O op, so we can poll it 80 | OVERLAPPED* overlapped; // what will report our I/O status 81 | struct usbi_transfer *itransfer; // Associated transfer, or NULL if completed 82 | cancel_transfer *cancel_fn; // Function pointer to cancel transfer API 83 | enum rw_type rw; // I/O transfer direction: read *XOR* write (NOT BOTH) 84 | }; 85 | extern const struct winfd INVALID_WINFD; 86 | 87 | int usbi_pipe(int pipefd[2]); 88 | int usbi_poll(struct pollfd *fds, unsigned int nfds, int timeout); 89 | ssize_t usbi_write(int fd, const void *buf, size_t count); 90 | ssize_t usbi_read(int fd, void *buf, size_t count); 91 | int usbi_close(int fd); 92 | 93 | void init_polling(void); 94 | void exit_polling(void); 95 | struct winfd usbi_create_fd(HANDLE handle, int access_mode, 96 | struct usbi_transfer *transfer, cancel_transfer *cancel_fn); 97 | void usbi_free_fd(struct winfd* winfd); 98 | struct winfd fd_to_winfd(int fd); 99 | struct winfd handle_to_winfd(HANDLE handle); 100 | struct winfd overlapped_to_winfd(OVERLAPPED* overlapped); 101 | 102 | /* 103 | * Timeval operations 104 | */ 105 | #if defined(DDKBUILD) 106 | #include // defines timeval functions on DDK 107 | #endif 108 | 109 | #if !defined(TIMESPEC_TO_TIMEVAL) 110 | #define TIMESPEC_TO_TIMEVAL(tv, ts) { \ 111 | (tv)->tv_sec = (long)(ts)->tv_sec; \ 112 | (tv)->tv_usec = (long)(ts)->tv_nsec / 1000; \ 113 | } 114 | #endif 115 | #if !defined(timersub) 116 | #define timersub(a, b, result) \ 117 | do { \ 118 | (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ 119 | (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ 120 | if ((result)->tv_usec < 0) { \ 121 | --(result)->tv_sec; \ 122 | (result)->tv_usec += 1000000; \ 123 | } \ 124 | } while (0) 125 | #endif 126 | -------------------------------------------------------------------------------- /libusb/os/threads_posix.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libusbx synchronization using POSIX Threads 3 | * 4 | * Copyright © 2011 Vitali Lovich 5 | * Copyright © 2011 Peter Stuge 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #if defined(__linux__) || defined(__OpenBSD__) 23 | # if defined(__linux__) 24 | # define _GNU_SOURCE 25 | # else 26 | # define _BSD_SOURCE 27 | # endif 28 | # include 29 | # include 30 | #elif defined(__APPLE__) 31 | # include 32 | #elif defined(__CYGWIN__) 33 | # include 34 | #endif 35 | 36 | #include "threads_posix.h" 37 | 38 | int usbi_mutex_init_recursive(pthread_mutex_t *mutex, pthread_mutexattr_t *attr) 39 | { 40 | int err; 41 | pthread_mutexattr_t stack_attr; 42 | if (!attr) { 43 | attr = &stack_attr; 44 | err = pthread_mutexattr_init(&stack_attr); 45 | if (err != 0) 46 | return err; 47 | } 48 | 49 | /* mutexattr_settype requires _GNU_SOURCE or _XOPEN_SOURCE >= 500 on Linux */ 50 | err = pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE); 51 | if (err != 0) 52 | goto finish; 53 | 54 | err = pthread_mutex_init(mutex, attr); 55 | 56 | finish: 57 | if (attr == &stack_attr) 58 | pthread_mutexattr_destroy(&stack_attr); 59 | 60 | return err; 61 | } 62 | 63 | int usbi_get_tid(void) 64 | { 65 | int ret = -1; 66 | #if defined(__ANDROID__) 67 | ret = gettid(); 68 | #elif defined(__linux__) 69 | ret = syscall(SYS_gettid); 70 | #elif defined(__OpenBSD__) 71 | /* The following only works with OpenBSD > 5.1 as it requires 72 | real thread support. For 5.1 and earlier, -1 is returned. */ 73 | ret = syscall(SYS_getthrid); 74 | #elif defined(__APPLE__) 75 | ret = mach_thread_self(); 76 | mach_port_deallocate(mach_task_self(), ret); 77 | #elif defined(__CYGWIN__) 78 | ret = GetCurrentThreadId(); 79 | #endif 80 | /* TODO: NetBSD thread ID support */ 81 | return ret; 82 | } 83 | -------------------------------------------------------------------------------- /libusb/os/threads_posix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libusbx synchronization using POSIX Threads 3 | * 4 | * Copyright © 2010 Peter Stuge 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef LIBUSB_THREADS_POSIX_H 22 | #define LIBUSB_THREADS_POSIX_H 23 | 24 | #include 25 | 26 | #define usbi_mutex_static_t pthread_mutex_t 27 | #define USBI_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER 28 | #define usbi_mutex_static_lock pthread_mutex_lock 29 | #define usbi_mutex_static_unlock pthread_mutex_unlock 30 | 31 | #define usbi_mutex_t pthread_mutex_t 32 | #define usbi_mutex_init pthread_mutex_init 33 | #define usbi_mutex_lock pthread_mutex_lock 34 | #define usbi_mutex_unlock pthread_mutex_unlock 35 | #define usbi_mutex_trylock pthread_mutex_trylock 36 | #define usbi_mutex_destroy pthread_mutex_destroy 37 | 38 | #define usbi_cond_t pthread_cond_t 39 | #define usbi_cond_init pthread_cond_init 40 | #define usbi_cond_wait pthread_cond_wait 41 | #define usbi_cond_timedwait pthread_cond_timedwait 42 | #define usbi_cond_broadcast pthread_cond_broadcast 43 | #define usbi_cond_destroy pthread_cond_destroy 44 | #define usbi_cond_signal pthread_cond_signal 45 | 46 | extern int usbi_mutex_init_recursive(pthread_mutex_t *mutex, pthread_mutexattr_t *attr); 47 | 48 | int usbi_get_tid(void); 49 | 50 | #endif /* LIBUSB_THREADS_POSIX_H */ 51 | -------------------------------------------------------------------------------- /libusb/os/threads_windows.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libusbx synchronization on Microsoft Windows 3 | * 4 | * Copyright © 2010 Michael Plante 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef LIBUSB_THREADS_WINDOWS_H 22 | #define LIBUSB_THREADS_WINDOWS_H 23 | 24 | #define usbi_mutex_static_t volatile LONG 25 | #define USBI_MUTEX_INITIALIZER 0 26 | 27 | #define usbi_mutex_t HANDLE 28 | 29 | struct usbi_cond_perthread { 30 | struct list_head list; 31 | DWORD tid; 32 | HANDLE event; 33 | }; 34 | struct usbi_cond_t_ { 35 | // Every time a thread touches the CV, it winds up in one of these lists. 36 | // It stays there until the CV is destroyed, even if the thread 37 | // terminates. 38 | struct list_head waiters; 39 | struct list_head not_waiting; 40 | }; 41 | typedef struct usbi_cond_t_ usbi_cond_t; 42 | 43 | // We *were* getting timespec from pthread.h: 44 | #if (!defined(HAVE_STRUCT_TIMESPEC) && !defined(_TIMESPEC_DEFINED)) 45 | #define HAVE_STRUCT_TIMESPEC 1 46 | #define _TIMESPEC_DEFINED 1 47 | struct timespec { 48 | long tv_sec; 49 | long tv_nsec; 50 | }; 51 | #endif /* HAVE_STRUCT_TIMESPEC | _TIMESPEC_DEFINED */ 52 | 53 | // We *were* getting ETIMEDOUT from pthread.h: 54 | #ifndef ETIMEDOUT 55 | # define ETIMEDOUT 10060 /* This is the value in winsock.h. */ 56 | #endif 57 | 58 | #define usbi_mutexattr_t void 59 | #define usbi_condattr_t void 60 | 61 | // all Windows mutexes are recursive 62 | #define usbi_mutex_init_recursive(mutex, attr) usbi_mutex_init((mutex), (attr)) 63 | 64 | int usbi_mutex_static_lock(usbi_mutex_static_t *mutex); 65 | int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex); 66 | 67 | 68 | int usbi_mutex_init(usbi_mutex_t *mutex, 69 | const usbi_mutexattr_t *attr); 70 | int usbi_mutex_lock(usbi_mutex_t *mutex); 71 | int usbi_mutex_unlock(usbi_mutex_t *mutex); 72 | int usbi_mutex_trylock(usbi_mutex_t *mutex); 73 | int usbi_mutex_destroy(usbi_mutex_t *mutex); 74 | 75 | int usbi_cond_init(usbi_cond_t *cond, 76 | const usbi_condattr_t *attr); 77 | int usbi_cond_destroy(usbi_cond_t *cond); 78 | int usbi_cond_wait(usbi_cond_t *cond, usbi_mutex_t *mutex); 79 | int usbi_cond_timedwait(usbi_cond_t *cond, 80 | usbi_mutex_t *mutex, 81 | const struct timespec *abstime); 82 | int usbi_cond_broadcast(usbi_cond_t *cond); 83 | int usbi_cond_signal(usbi_cond_t *cond); 84 | 85 | int usbi_get_tid(void); 86 | 87 | #endif /* LIBUSB_THREADS_WINDOWS_H */ 88 | -------------------------------------------------------------------------------- /libusb/os/wince_usb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Windows CE backend for libusbx 1.0 3 | * Copyright © 2011-2013 RealVNC Ltd. 4 | * Portions taken from Windows backend, which is 5 | * Copyright © 2009-2010 Pete Batard 6 | * With contributions from Michael Plante, Orin Eman et al. 7 | * Parts of this code adapted from libusb-win32-v1 by Stephan Meyer 8 | * Major code testing contribution by Xiaofan Chen 9 | * 10 | * This library is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU Lesser General Public 12 | * License as published by the Free Software Foundation; either 13 | * version 2.1 of the License, or (at your option) any later version. 14 | * 15 | * This library is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 23 | */ 24 | #pragma once 25 | 26 | #include "windows_common.h" 27 | 28 | #include 29 | #include "poll_windows.h" 30 | 31 | #define MAX_DEVICE_COUNT 256 32 | 33 | // This is a modified dump of the types in the ceusbkwrapper.h library header 34 | // with functions transformed into extern pointers. 35 | // 36 | // This backend dynamically loads ceusbkwrapper.dll and doesn't include 37 | // ceusbkwrapper.h directly to simplify the build process. The kernel 38 | // side wrapper driver is built using the platform image build tools, 39 | // which makes it difficult to reference directly from the libusbx build 40 | // system. 41 | struct UKW_DEVICE_PRIV; 42 | typedef struct UKW_DEVICE_PRIV *UKW_DEVICE; 43 | typedef UKW_DEVICE *PUKW_DEVICE, *LPUKW_DEVICE; 44 | 45 | typedef struct { 46 | UINT8 bLength; 47 | UINT8 bDescriptorType; 48 | UINT16 bcdUSB; 49 | UINT8 bDeviceClass; 50 | UINT8 bDeviceSubClass; 51 | UINT8 bDeviceProtocol; 52 | UINT8 bMaxPacketSize0; 53 | UINT16 idVendor; 54 | UINT16 idProduct; 55 | UINT16 bcdDevice; 56 | UINT8 iManufacturer; 57 | UINT8 iProduct; 58 | UINT8 iSerialNumber; 59 | UINT8 bNumConfigurations; 60 | } UKW_DEVICE_DESCRIPTOR, *PUKW_DEVICE_DESCRIPTOR, *LPUKW_DEVICE_DESCRIPTOR; 61 | 62 | typedef struct { 63 | UINT8 bmRequestType; 64 | UINT8 bRequest; 65 | UINT16 wValue; 66 | UINT16 wIndex; 67 | UINT16 wLength; 68 | } UKW_CONTROL_HEADER, *PUKW_CONTROL_HEADER, *LPUKW_CONTROL_HEADER; 69 | 70 | // Collection of flags which can be used when issuing transfer requests 71 | /* Indicates that the transfer direction is 'in' */ 72 | #define UKW_TF_IN_TRANSFER 0x00000001 73 | /* Indicates that the transfer direction is 'out' */ 74 | #define UKW_TF_OUT_TRANSFER 0x00000000 75 | /* Specifies that the transfer should complete as soon as possible, 76 | * even if no OVERLAPPED structure has been provided. */ 77 | #define UKW_TF_NO_WAIT 0x00000100 78 | /* Indicates that transfers shorter than the buffer are ok */ 79 | #define UKW_TF_SHORT_TRANSFER_OK 0x00000200 80 | #define UKW_TF_SEND_TO_DEVICE 0x00010000 81 | #define UKW_TF_SEND_TO_INTERFACE 0x00020000 82 | #define UKW_TF_SEND_TO_ENDPOINT 0x00040000 83 | /* Don't block when waiting for memory allocations */ 84 | #define UKW_TF_DONT_BLOCK_FOR_MEM 0x00080000 85 | 86 | /* Value to use when dealing with configuration values, such as UkwGetConfigDescriptor, 87 | * to specify the currently active configuration for the device. */ 88 | #define UKW_ACTIVE_CONFIGURATION -1 89 | 90 | DLL_DECLARE(WINAPI, HANDLE, UkwOpenDriver, ()); 91 | DLL_DECLARE(WINAPI, BOOL, UkwGetDeviceList, (HANDLE, LPUKW_DEVICE, DWORD, LPDWORD)); 92 | DLL_DECLARE(WINAPI, void, UkwReleaseDeviceList, (HANDLE, LPUKW_DEVICE, DWORD)); 93 | DLL_DECLARE(WINAPI, BOOL, UkwGetDeviceAddress, (UKW_DEVICE, unsigned char*, unsigned char*, unsigned long*)); 94 | DLL_DECLARE(WINAPI, BOOL, UkwGetDeviceDescriptor, (UKW_DEVICE, LPUKW_DEVICE_DESCRIPTOR)); 95 | DLL_DECLARE(WINAPI, BOOL, UkwGetConfigDescriptor, (UKW_DEVICE, DWORD, LPVOID, DWORD, LPDWORD)); 96 | DLL_DECLARE(WINAPI, void, UkwCloseDriver, (HANDLE)); 97 | DLL_DECLARE(WINAPI, BOOL, UkwCancelTransfer, (UKW_DEVICE, LPOVERLAPPED, DWORD)); 98 | DLL_DECLARE(WINAPI, BOOL, UkwIssueControlTransfer, (UKW_DEVICE, DWORD, LPUKW_CONTROL_HEADER, LPVOID, DWORD, LPDWORD, LPOVERLAPPED)); 99 | DLL_DECLARE(WINAPI, BOOL, UkwClaimInterface, (UKW_DEVICE, DWORD)); 100 | DLL_DECLARE(WINAPI, BOOL, UkwReleaseInterface, (UKW_DEVICE, DWORD)); 101 | DLL_DECLARE(WINAPI, BOOL, UkwSetInterfaceAlternateSetting, (UKW_DEVICE, DWORD, DWORD)); 102 | DLL_DECLARE(WINAPI, BOOL, UkwClearHaltHost, (UKW_DEVICE, UCHAR)); 103 | DLL_DECLARE(WINAPI, BOOL, UkwClearHaltDevice, (UKW_DEVICE, UCHAR)); 104 | DLL_DECLARE(WINAPI, BOOL, UkwGetConfig, (UKW_DEVICE, PUCHAR)); 105 | DLL_DECLARE(WINAPI, BOOL, UkwSetConfig, (UKW_DEVICE, UCHAR)); 106 | DLL_DECLARE(WINAPI, BOOL, UkwResetDevice, (UKW_DEVICE)); 107 | DLL_DECLARE(WINAPI, BOOL, UkwKernelDriverActive, (UKW_DEVICE, DWORD, PBOOL)); 108 | DLL_DECLARE(WINAPI, BOOL, UkwAttachKernelDriver, (UKW_DEVICE, DWORD)); 109 | DLL_DECLARE(WINAPI, BOOL, UkwDetachKernelDriver, (UKW_DEVICE, DWORD)); 110 | DLL_DECLARE(WINAPI, BOOL, UkwIssueBulkTransfer, (UKW_DEVICE, DWORD, UCHAR, LPVOID, DWORD, LPDWORD, LPOVERLAPPED)); 111 | DLL_DECLARE(WINAPI, BOOL, UkwIsPipeHalted, (UKW_DEVICE, UCHAR, LPBOOL)); 112 | 113 | // Used to determine if an endpoint status really is halted on a failed transfer. 114 | #define STATUS_HALT_FLAG 0x1 115 | 116 | struct wince_device_priv { 117 | UKW_DEVICE dev; 118 | UKW_DEVICE_DESCRIPTOR desc; 119 | }; 120 | 121 | struct wince_device_handle_priv { 122 | // This member isn't used, but only exists to avoid an empty structure 123 | // for private data for the device handle. 124 | int reserved; 125 | }; 126 | 127 | struct wince_transfer_priv { 128 | struct winfd pollable_fd; 129 | uint8_t interface_number; 130 | }; 131 | 132 | -------------------------------------------------------------------------------- /libusb/os/windows_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Windows backend common header for libusbx 1.0 3 | * 4 | * This file brings together header code common between 5 | * the desktop Windows and Windows CE backends. 6 | * Copyright © 2012-2013 RealVNC Ltd. 7 | * Copyright © 2009-2012 Pete Batard 8 | * With contributions from Michael Plante, Orin Eman et al. 9 | * Parts of this code adapted from libusb-win32-v1 by Stephan Meyer 10 | * Major code testing contribution by Xiaofan Chen 11 | * 12 | * This library is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Lesser General Public 14 | * License as published by the Free Software Foundation; either 15 | * version 2.1 of the License, or (at your option) any later version. 16 | * 17 | * This library is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | * Lesser General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with this library; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | #pragma once 28 | 29 | // Windows API default is uppercase - ugh! 30 | #if !defined(bool) 31 | #define bool BOOL 32 | #endif 33 | #if !defined(true) 34 | #define true TRUE 35 | #endif 36 | #if !defined(false) 37 | #define false FALSE 38 | #endif 39 | 40 | #define safe_free(p) do {if (p != NULL) {free((void*)p); p = NULL;}} while(0) 41 | #define safe_closehandle(h) do {if (h != INVALID_HANDLE_VALUE) {CloseHandle(h); h = INVALID_HANDLE_VALUE;}} while(0) 42 | #define safe_min(a, b) min((size_t)(a), (size_t)(b)) 43 | #define safe_strcp(dst, dst_max, src, count) do {memcpy(dst, src, safe_min(count, dst_max)); \ 44 | ((char*)dst)[safe_min(count, dst_max)-1] = 0;} while(0) 45 | #define safe_strcpy(dst, dst_max, src) safe_strcp(dst, dst_max, src, safe_strlen(src)+1) 46 | #define safe_strncat(dst, dst_max, src, count) strncat(dst, src, safe_min(count, dst_max - safe_strlen(dst) - 1)) 47 | #define safe_strcat(dst, dst_max, src) safe_strncat(dst, dst_max, src, safe_strlen(src)+1) 48 | #define safe_strcmp(str1, str2) strcmp(((str1==NULL)?"":str1), ((str2==NULL)?"":str2)) 49 | #define safe_stricmp(str1, str2) _stricmp(((str1==NULL)?"":str1), ((str2==NULL)?"":str2)) 50 | #define safe_strncmp(str1, str2, count) strncmp(((str1==NULL)?"":str1), ((str2==NULL)?"":str2), count) 51 | #define safe_strlen(str) ((str==NULL)?0:strlen(str)) 52 | #define safe_sprintf(dst, count, ...) do {_snprintf(dst, count, __VA_ARGS__); (dst)[(count)-1] = 0; } while(0) 53 | #define safe_stprintf _sntprintf 54 | #define safe_tcslen(str) ((str==NULL)?0:_tcslen(str)) 55 | #define safe_unref_device(dev) do {if (dev != NULL) {libusb_unref_device(dev); dev = NULL;}} while(0) 56 | #define wchar_to_utf8_ms(wstr, str, strlen) WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, strlen, NULL, NULL) 57 | #ifndef ARRAYSIZE 58 | #define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) 59 | #endif 60 | 61 | #define ERR_BUFFER_SIZE 256 62 | #define TIMER_REQUEST_RETRY_MS 100 63 | #define MAX_TIMER_SEMAPHORES 128 64 | 65 | 66 | /* 67 | * API macros - from libusb-win32 1.x 68 | */ 69 | #define DLL_DECLARE_PREFIXNAME(api, ret, prefixname, name, args) \ 70 | typedef ret (api * __dll_##name##_t)args; \ 71 | static __dll_##name##_t prefixname = NULL 72 | 73 | #ifndef _WIN32_WCE 74 | #define DLL_STRINGIFY(dll) #dll 75 | #define DLL_GET_MODULE_HANDLE(dll) GetModuleHandleA(DLL_STRINGIFY(dll)) 76 | #define DLL_LOAD_LIBRARY(dll) LoadLibraryA(DLL_STRINGIFY(dll)) 77 | #else 78 | #define DLL_STRINGIFY(dll) L#dll 79 | #define DLL_GET_MODULE_HANDLE(dll) GetModuleHandle(DLL_STRINGIFY(dll)) 80 | #define DLL_LOAD_LIBRARY(dll) LoadLibrary(DLL_STRINGIFY(dll)) 81 | #endif 82 | 83 | #define DLL_LOAD_PREFIXNAME(dll, prefixname, name, ret_on_failure) \ 84 | do { \ 85 | HMODULE h = DLL_GET_MODULE_HANDLE(dll); \ 86 | if (!h) \ 87 | h = DLL_LOAD_LIBRARY(dll); \ 88 | if (!h) { \ 89 | if (ret_on_failure) { return LIBUSB_ERROR_NOT_FOUND; } \ 90 | else { break; } \ 91 | } \ 92 | prefixname = (__dll_##name##_t)GetProcAddress(h, \ 93 | DLL_STRINGIFY(name)); \ 94 | if (prefixname) break; \ 95 | prefixname = (__dll_##name##_t)GetProcAddress(h, \ 96 | DLL_STRINGIFY(name) DLL_STRINGIFY(A)); \ 97 | if (prefixname) break; \ 98 | prefixname = (__dll_##name##_t)GetProcAddress(h, \ 99 | DLL_STRINGIFY(name) DLL_STRINGIFY(W)); \ 100 | if (prefixname) break; \ 101 | if(ret_on_failure) \ 102 | return LIBUSB_ERROR_NOT_FOUND; \ 103 | } while(0) 104 | 105 | #define DLL_DECLARE(api, ret, name, args) DLL_DECLARE_PREFIXNAME(api, ret, name, name, args) 106 | #define DLL_LOAD(dll, name, ret_on_failure) DLL_LOAD_PREFIXNAME(dll, name, name, ret_on_failure) 107 | #define DLL_DECLARE_PREFIXED(api, ret, prefix, name, args) DLL_DECLARE_PREFIXNAME(api, ret, prefix##name, name, args) 108 | #define DLL_LOAD_PREFIXED(dll, prefix, name, ret_on_failure) DLL_LOAD_PREFIXNAME(dll, prefix##name, name, ret_on_failure) 109 | -------------------------------------------------------------------------------- /libusb/version.h: -------------------------------------------------------------------------------- 1 | /* This file is parsed by m4 and windres and RC.EXE so please keep it simple. */ 2 | #include "version_nano.h" 3 | #ifndef LIBUSB_MAJOR 4 | #define LIBUSB_MAJOR 1 5 | #endif 6 | #ifndef LIBUSB_MINOR 7 | #define LIBUSB_MINOR 0 8 | #endif 9 | #ifndef LIBUSB_MICRO 10 | #define LIBUSB_MICRO 18 11 | #endif 12 | #ifndef LIBUSB_NANO 13 | #define LIBUSB_NANO 0 14 | #endif 15 | /* LIBUSB_RC is the release candidate suffix. Should normally be empty. */ 16 | #ifndef LIBUSB_RC 17 | #define LIBUSB_RC "-rc1" 18 | #endif 19 | -------------------------------------------------------------------------------- /libusb/version_nano.h: -------------------------------------------------------------------------------- 1 | #define LIBUSB_NANO 10862 2 | -------------------------------------------------------------------------------- /msvc/config.h: -------------------------------------------------------------------------------- 1 | /* config.h. Manual config for MSVC. */ 2 | 3 | #ifndef _MSC_VER 4 | #warn "msvc/config.h shouldn't be included for your development environment." 5 | #error "Please make sure the msvc/ directory is removed from your build path." 6 | #endif 7 | 8 | /* Disable: warning C4200: nonstandard extension used : zero-sized array in struct/union */ 9 | #pragma warning(disable:4200) 10 | /* Disable: warning C6258: Using TerminateThread does not allow proper thread clean up */ 11 | #pragma warning(disable: 6258) 12 | #if defined(_PREFAST_) 13 | /* Disable "Banned API" errors when using the MS's WDK OACR/Prefast */ 14 | #pragma warning(disable:28719) 15 | /* Disable "The function 'InitializeCriticalSection' must be called from within a try/except block" */ 16 | #pragma warning(disable:28125) 17 | #endif 18 | 19 | /* Default visibility */ 20 | #define DEFAULT_VISIBILITY /**/ 21 | 22 | /* Enable global message logging */ 23 | #define ENABLE_LOGGING 1 24 | 25 | /* Uncomment to start with debug message logging enabled */ 26 | // #define ENABLE_DEBUG_LOGGING 1 27 | 28 | /* Uncomment to enabling logging to system log */ 29 | // #define USE_SYSTEM_LOGGING_FACILITY 30 | 31 | /* type of second poll() argument */ 32 | #define POLL_NFDS_TYPE unsigned int 33 | 34 | /* Windows/WinCE backend */ 35 | #if defined(_WIN32_WCE) 36 | #define OS_WINCE 1 37 | #define HAVE_MISSING_H 38 | #else 39 | #define OS_WINDOWS 1 40 | #define HAVE_SIGNAL_H 1 41 | #define HAVE_SYS_TYPES_H 1 42 | #endif 43 | -------------------------------------------------------------------------------- /msvc/ddk_build.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | ::# default builds static library. 3 | ::# you can pass the following arguments (case insensitive): 4 | ::# - "DLL" to build a DLL instead of a static library 5 | ::# - "/MT" to build a static library compatible with MSVC's /MT option (LIBCMT vs MSVCRT) 6 | 7 | if Test%BUILD_ALT_DIR%==Test goto usage 8 | 9 | ::# process commandline parameters 10 | set TARGET=LIBRARY 11 | set STATIC_LIBC= 12 | set version=1.0 13 | set PWD=%~dp0 14 | set BUILD_CMD=build -bcwgZ -M2 15 | 16 | if "%1" == "" goto no_more_args 17 | ::# /I for case insensitive 18 | if /I Test%1==TestDLL set TARGET=DYNLINK 19 | if /I Test%1==Test/MT set STATIC_LIBC=1 20 | :no_more_args 21 | 22 | cd ..\libusb\os 23 | echo TARGETTYPE=%TARGET% > target 24 | copy target+..\..\msvc\libusb_sources sources >NUL 2>&1 25 | del target 26 | @echo on 27 | %BUILD_CMD% 28 | @echo off 29 | if errorlevel 1 goto builderror 30 | cd ..\.. 31 | 32 | set cpudir=i386 33 | set destType=Win32 34 | if %_BUILDARCH%==x86 goto isI386 35 | set cpudir=amd64 36 | set destType=x64 37 | :isI386 38 | 39 | set srcPath=libusb\os\obj%BUILD_ALT_DIR%\%cpudir% 40 | 41 | set dstPath=%destType%\Debug 42 | if %DDKBUILDENV%==chk goto isDebug 43 | set dstPath=%destType%\Release 44 | :isDebug 45 | 46 | if exist %destType% goto md2 47 | mkdir %destType% 48 | :md2 49 | if exist %dstPath% goto md3 50 | mkdir %dstPath% 51 | :md3 52 | if exist %dstPath%\dll goto md4 53 | mkdir %dstPath%\dll 54 | :md4 55 | if exist %dstPath%\lib goto md5 56 | md %dstPath%\lib 57 | :md5 58 | if exist %dstPath%\examples goto md6 59 | md %dstPath%\examples 60 | :md6 61 | @echo on 62 | 63 | @if /I NOT Test%1==TestDLL goto copylib 64 | copy %srcPath%\libusb-%version%.dll %dstPath%\dll 65 | copy %srcPath%\libusb-%version%.pdb %dstPath%\dll 66 | :copylib 67 | copy %srcPath%\libusb-%version%.lib %dstPath%\lib 68 | 69 | @echo off 70 | 71 | if exist examples\listdevs_ddkbuild goto md7 72 | md examples\listdevs_ddkbuild 73 | :md7 74 | 75 | cd examples\listdevs_ddkbuild 76 | copy ..\..\msvc\listdevs_sources sources >NUL 2>&1 77 | @echo on 78 | %BUILD_CMD% 79 | @echo off 80 | if errorlevel 1 goto builderror 81 | cd ..\.. 82 | 83 | set srcPath=examples\listdevs_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir% 84 | @echo on 85 | 86 | copy %srcPath%\listdevs.exe %dstPath%\examples 87 | copy %srcPath%\listdevs.pdb %dstPath%\examples 88 | 89 | @echo off 90 | 91 | if exist examples\xusb_ddkbuild goto md8 92 | md examples\xusb_ddkbuild 93 | :md8 94 | 95 | cd examples\xusb_ddkbuild 96 | copy ..\..\msvc\xusb_sources sources >NUL 2>&1 97 | @echo on 98 | %BUILD_CMD% 99 | @echo off 100 | if errorlevel 1 goto builderror 101 | cd ..\.. 102 | 103 | set srcPath=examples\xusb_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir% 104 | @echo on 105 | 106 | copy %srcPath%\xusb.exe %dstPath%\examples 107 | copy %srcPath%\xusb.pdb %dstPath%\examples 108 | 109 | @echo off 110 | 111 | if exist examples\getopt\getopt_ddkbuild goto md9 112 | md examples\getopt\getopt_ddkbuild 113 | :md9 114 | 115 | cd examples\getopt\getopt_ddkbuild 116 | copy ..\..\..\msvc\getopt_sources sources >NUL 2>&1 117 | @echo on 118 | %BUILD_CMD% 119 | @echo off 120 | if errorlevel 1 goto builderror 121 | cd ..\..\.. 122 | 123 | if exist examples\fxload_ddkbuild goto md10 124 | md examples\fxload_ddkbuild 125 | :md10 126 | 127 | cd examples\fxload_ddkbuild 128 | copy ..\..\msvc\fxload_sources sources >NUL 2>&1 129 | @echo on 130 | %BUILD_CMD% 131 | @echo off 132 | if errorlevel 1 goto builderror 133 | cd ..\.. 134 | 135 | set srcPath=examples\fxload_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir% 136 | @echo on 137 | 138 | copy %srcPath%\fxload.exe %dstPath%\examples 139 | copy %srcPath%\fxload.pdb %dstPath%\examples 140 | 141 | @echo off 142 | 143 | if exist examples\hotplugtest_ddkbuild goto md11 144 | md examples\hotplugtest_ddkbuild 145 | :md11 146 | 147 | cd examples\hotplugtest_ddkbuild 148 | copy ..\..\msvc\hotplugtest_sources sources >NUL 2>&1 149 | @echo on 150 | %BUILD_CMD% 151 | @echo off 152 | if errorlevel 1 goto builderror 153 | cd ..\.. 154 | 155 | set srcPath=examples\hotplugtest_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir% 156 | @echo on 157 | 158 | copy %srcPath%\hotplugtest.exe %dstPath%\examples 159 | copy %srcPath%\hotplugtest.pdb %dstPath%\examples 160 | 161 | @echo off 162 | 163 | cd msvc 164 | goto done 165 | 166 | :usage 167 | echo ddk_build must be run in a WDK build environment 168 | pause 169 | goto done 170 | 171 | :builderror 172 | echo Build failed 173 | 174 | :done 175 | cd %PWD% 176 | -------------------------------------------------------------------------------- /msvc/errno.h: -------------------------------------------------------------------------------- 1 | /* 2 | * errno.h 3 | * This file has no copyright assigned and is placed in the Public Domain. 4 | * This file is a part of the mingw-runtime package. 5 | * No warranty is given; refer to the file DISCLAIMER within the package. 6 | * 7 | * Error numbers and access to error reporting. 8 | * 9 | */ 10 | 11 | #ifndef _ERRNO_H_ 12 | #define _ERRNO_H_ 13 | 14 | #include 15 | 16 | /* 17 | * Error numbers. 18 | * TODO: Can't be sure of some of these assignments, I guessed from the 19 | * names given by strerror and the defines in the Cygnus errno.h. A lot 20 | * of the names from the Cygnus errno.h are not represented, and a few 21 | * of the descriptions returned by strerror do not obviously match 22 | * their error naming. 23 | */ 24 | #define EPERM 1 /* Operation not permitted */ 25 | #define ENOFILE 2 /* No such file or directory */ 26 | #define ENOENT 2 27 | #define ESRCH 3 /* No such process */ 28 | #define EINTR 4 /* Interrupted function call */ 29 | #define EIO 5 /* Input/output error */ 30 | #define ENXIO 6 /* No such device or address */ 31 | #define E2BIG 7 /* Arg list too long */ 32 | #define ENOEXEC 8 /* Exec format error */ 33 | #define EBADF 9 /* Bad file descriptor */ 34 | #define ECHILD 10 /* No child processes */ 35 | #define EAGAIN 11 /* Resource temporarily unavailable */ 36 | #define ENOMEM 12 /* Not enough space */ 37 | #define EACCES 13 /* Permission denied */ 38 | #define EFAULT 14 /* Bad address */ 39 | /* 15 - Unknown Error */ 40 | #define EBUSY 16 /* strerror reports "Resource device" */ 41 | #define EEXIST 17 /* File exists */ 42 | #define EXDEV 18 /* Improper link (cross-device link?) */ 43 | #define ENODEV 19 /* No such device */ 44 | #define ENOTDIR 20 /* Not a directory */ 45 | #define EISDIR 21 /* Is a directory */ 46 | #define EINVAL 22 /* Invalid argument */ 47 | #define ENFILE 23 /* Too many open files in system */ 48 | #define EMFILE 24 /* Too many open files */ 49 | #define ENOTTY 25 /* Inappropriate I/O control operation */ 50 | /* 26 - Unknown Error */ 51 | #define EFBIG 27 /* File too large */ 52 | #define ENOSPC 28 /* No space left on device */ 53 | #define ESPIPE 29 /* Invalid seek (seek on a pipe?) */ 54 | #define EROFS 30 /* Read-only file system */ 55 | #define EMLINK 31 /* Too many links */ 56 | #define EPIPE 32 /* Broken pipe */ 57 | #define EDOM 33 /* Domain error (math functions) */ 58 | #define ERANGE 34 /* Result too large (possibly too small) */ 59 | /* 35 - Unknown Error */ 60 | #define EDEADLOCK 36 /* Resource deadlock avoided (non-Cyg) */ 61 | #define EDEADLK 36 62 | #if 0 63 | /* 37 - Unknown Error */ 64 | #define ENAMETOOLONG 38 /* Filename too long (91 in Cyg?) */ 65 | #define ENOLCK 39 /* No locks available (46 in Cyg?) */ 66 | #define ENOSYS 40 /* Function not implemented (88 in Cyg?) */ 67 | #define ENOTEMPTY 41 /* Directory not empty (90 in Cyg?) */ 68 | #define EILSEQ 42 /* Illegal byte sequence */ 69 | #endif 70 | 71 | /* 72 | * NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the 73 | * sockets.h header provided with windows32api-0.1.2. 74 | * You should go and put an #if 0 ... #endif around the whole block 75 | * of errors (look at the comment above them). 76 | */ 77 | 78 | #ifndef RC_INVOKED 79 | 80 | #ifdef __cplusplus 81 | extern "C" { 82 | #endif 83 | 84 | /* 85 | * Definitions of errno. For _doserrno, sys_nerr and * sys_errlist, see 86 | * stdlib.h. 87 | */ 88 | #if defined(_UWIN) || defined(_WIN32_WCE) 89 | #undef errno 90 | extern int errno; 91 | #else 92 | _CRTIMP int* __cdecl _errno(void); 93 | #define errno (*_errno()) 94 | #endif 95 | 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | 100 | #endif /* Not RC_INVOKED */ 101 | 102 | #endif /* Not _ERRNO_H_ */ -------------------------------------------------------------------------------- /msvc/fxload_2010.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {651ff73d-037b-4903-8dd3-56e9950be25c} 10 | 11 | 12 | 13 | 14 | Source Files 15 | 16 | 17 | Source Files 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | -------------------------------------------------------------------------------- /msvc/fxload_2012.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {651ff73d-037b-4903-8dd3-56e9950be25c} 10 | 11 | 12 | 13 | 14 | Source Files 15 | 16 | 17 | Source Files 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | -------------------------------------------------------------------------------- /msvc/fxload_sources: -------------------------------------------------------------------------------- 1 | TARGETNAME=fxload 2 | TARGETTYPE=PROGRAM 3 | 386_STDCALL=0 4 | 5 | _NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP) 6 | 7 | !IFNDEF MSC_WARNING_LEVEL 8 | MSC_WARNING_LEVEL=/W3 9 | !ENDIF 10 | 11 | !IFDEF STATIC_LIBC 12 | USE_LIBCMT=1 13 | !ELSE 14 | USE_MSVCRT=1 15 | !ENDIF 16 | 17 | UMTYPE=console 18 | INCLUDES=..\..\msvc;..\..\libusb;..\getopt;$(DDK_INC_PATH) 19 | C_DEFINES=$(C_DEFINES) /D__GNU_LIBRARY__ 20 | UMLIBS=..\..\libusb\os\obj$(BUILD_ALT_DIR)\*\libusb-1.0.lib \ 21 | ..\getopt\getopt_ddkbuild\obj$(BUILD_ALT_DIR)\*\getopt.lib 22 | SOURCES=..\ezusb.c \ 23 | ..\fxload.c 24 | -------------------------------------------------------------------------------- /msvc/getopt_2010.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | 22 | 23 | Header Files 24 | 25 | 26 | -------------------------------------------------------------------------------- /msvc/getopt_2012.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | 22 | 23 | Header Files 24 | 25 | 26 | -------------------------------------------------------------------------------- /msvc/getopt_sources: -------------------------------------------------------------------------------- 1 | TARGETTYPE=LIBRARY 2 | TARGETNAME=getopt 3 | 386_STDCALL=0 4 | 5 | _NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP) 6 | 7 | !IFNDEF MSC_WARNING_LEVEL 8 | MSC_WARNING_LEVEL=/W3 9 | !ENDIF 10 | 11 | USE_MSVCRT=1 12 | 13 | INCLUDES=$(DDK_INC_PATH) 14 | C_DEFINES = $(C_DEFINES) /DDDKBUILD /DHAVE_STRING_H 15 | 16 | TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \ 17 | $(SDK_LIB_PATH)\user32.lib 18 | 19 | SOURCES=..\getopt1.c \ 20 | ..\getopt.c 21 | -------------------------------------------------------------------------------- /msvc/hotplugtest_2010.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc/hotplugtest_2012.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc/hotplugtest_sources: -------------------------------------------------------------------------------- 1 | TARGETNAME=hotplugtest 2 | TARGETTYPE=PROGRAM 3 | 386_STDCALL=0 4 | 5 | _NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP) 6 | 7 | !IFNDEF MSC_WARNING_LEVEL 8 | MSC_WARNING_LEVEL=/W3 9 | !ENDIF 10 | 11 | !IFDEF STATIC_LIBC 12 | USE_LIBCMT=1 13 | !ELSE 14 | USE_MSVCRT=1 15 | !ENDIF 16 | 17 | UMTYPE=console 18 | INCLUDES=..\..\msvc;..\..\libusb;$(DDK_INC_PATH) 19 | UMLIBS=..\..\libusb\os\obj$(BUILD_ALT_DIR)\*\libusb-1.0.lib 20 | SOURCES=..\hotplugtest.c 21 | -------------------------------------------------------------------------------- /msvc/libusb_dll.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="libusb_dll" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 6 | 7 | CFG=libusb_dll - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "libusb_dll.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "libusb_dll.mak" CFG="libusb_dll - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "libusb_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") 21 | !MESSAGE "libusb_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | MTL=midl.exe 30 | RSC=rc.exe 31 | 32 | !IF "$(CFG)" == "libusb_dll - Win32 Release" 33 | 34 | # PROP BASE Use_MFC 0 35 | # PROP BASE Use_Debug_Libraries 0 36 | # PROP BASE Output_Dir "Release" 37 | # PROP BASE Intermediate_Dir "Release" 38 | # PROP BASE Target_Dir "" 39 | # PROP Use_MFC 0 40 | # PROP Use_Debug_Libraries 0 41 | # PROP Output_Dir "../Win32/Release/dll" 42 | # PROP Intermediate_Dir "../Win32/Release/dll" 43 | # PROP Ignore_Export_Lib 0 44 | # PROP Target_Dir "" 45 | # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "LIBUSB_DLL_EXPORTS" /YX /FD /c 46 | # ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../libusb" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_USRDLL" /FR /FD /EHsc /c 47 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 48 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 49 | # ADD BASE RSC /l 0x409 /d "NDEBUG" 50 | # ADD RSC /l 0x409 /d "NDEBUG" 51 | BSC32=bscmake.exe 52 | # ADD BASE BSC32 /nologo 53 | # ADD BSC32 /nologo 54 | LINK32=link.exe 55 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 56 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Win32/Release/dll/libusb-1.0.dll" 57 | 58 | !ELSEIF "$(CFG)" == "libusb_dll - Win32 Debug" 59 | 60 | # PROP BASE Use_MFC 0 61 | # PROP BASE Use_Debug_Libraries 1 62 | # PROP BASE Output_Dir "Debug" 63 | # PROP BASE Intermediate_Dir "Debug" 64 | # PROP BASE Target_Dir "" 65 | # PROP Use_MFC 0 66 | # PROP Use_Debug_Libraries 1 67 | # PROP Output_Dir "../Win32/Debug/dll" 68 | # PROP Intermediate_Dir "../Win32/Debug/dll" 69 | # PROP Ignore_Export_Lib 0 70 | # PROP Target_Dir "" 71 | # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "LIBUSB_DLL_EXPORTS" /YX /FD /GZ /c 72 | # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../libusb" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_USRDLL" /FR /FD /EHsc /c 73 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 74 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 75 | # ADD BASE RSC /l 0x409 /d "_DEBUG" 76 | # ADD RSC /l 0x409 /d "_DEBUG" 77 | BSC32=bscmake.exe 78 | # ADD BASE BSC32 /nologo 79 | # ADD BSC32 /nologo /n 80 | LINK32=link.exe 81 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept 82 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Win32/Debug/dll/libusb-1.0.dll" 83 | # SUBTRACT LINK32 /pdb:none /incremental:no 84 | 85 | !ENDIF 86 | 87 | # Begin Target 88 | 89 | # Name "libusb_dll - Win32 Release" 90 | # Name "libusb_dll - Win32 Debug" 91 | # Begin Group "Source Files" 92 | 93 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 94 | # Begin Source File 95 | 96 | SOURCE=..\libusb\core.c 97 | # End Source File 98 | # Begin Source File 99 | 100 | SOURCE=..\libusb\os\darwin_usb.c 101 | # PROP Exclude_From_Build 1 102 | # End Source File 103 | # Begin Source File 104 | 105 | SOURCE=..\libusb\descriptor.c 106 | # End Source File 107 | # Begin Source File 108 | 109 | SOURCE=..\libusb\io.c 110 | # End Source File 111 | # Begin Source File 112 | 113 | SOURCE="..\libusb\libusb-1.0.rc" 114 | # End Source File 115 | # Begin Source File 116 | 117 | SOURCE="..\libusb\libusb-1.0.def" 118 | # End Source File 119 | # Begin Source File 120 | 121 | SOURCE=..\libusb\os\linux_usbfs.c 122 | # PROP Exclude_From_Build 1 123 | # End Source File 124 | # Begin Source File 125 | 126 | SOURCE=..\libusb\os\poll_windows.c 127 | # End Source File 128 | # Begin Source File 129 | 130 | SOURCE=..\libusb\sync.c 131 | # End Source File 132 | # Begin Source File 133 | 134 | SOURCE=..\libusb\os\threads_windows.c 135 | # End Source File 136 | # Begin Source File 137 | 138 | SOURCE=..\libusb\os\windows_usb.c 139 | # End Source File 140 | # End Group 141 | # Begin Group "Header Files" 142 | 143 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 144 | # Begin Source File 145 | 146 | SOURCE=.\config.h 147 | # End Source File 148 | # Begin Source File 149 | 150 | SOURCE=..\libusb\os\darwin_usb.h 151 | # End Source File 152 | # Begin Source File 153 | 154 | SOURCE=..\libusb\libusb.h 155 | # End Source File 156 | # Begin Source File 157 | 158 | SOURCE=..\libusb\libusbi.h 159 | # End Source File 160 | # Begin Source File 161 | 162 | SOURCE=..\libusb\os\linux_usbfs.h 163 | # End Source File 164 | # Begin Source File 165 | 166 | SOURCE=..\libusb\os\poll_posix.h 167 | # End Source File 168 | # Begin Source File 169 | 170 | SOURCE=..\libusb\os\poll_windows.h 171 | # End Source File 172 | # Begin Source File 173 | 174 | SOURCE=..\libusb\os\threads_posix.h 175 | # End Source File 176 | # Begin Source File 177 | 178 | SOURCE=..\libusb\os\threads_windows.h 179 | # End Source File 180 | # Begin Source File 181 | 182 | SOURCE=..\libusb\os\windows_usb.h 183 | # End Source File 184 | # Begin Source File 185 | 186 | SOURCE=..\libusb\os\windows_common.h 187 | # End Source File 188 | # End Group 189 | # Begin Group "Resource Files" 190 | 191 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 192 | # End Group 193 | # End Target 194 | # End Project 195 | -------------------------------------------------------------------------------- /msvc/libusb_dll_2010.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {d81e81ca-b13e-4a15-b54b-b12b41361e6b} 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | 46 | 47 | Header Files 48 | 49 | 50 | Header Files 51 | 52 | 53 | Header Files 54 | 55 | 56 | Header Files 57 | 58 | 59 | Header Files 60 | 61 | 62 | Header Files 63 | 64 | 65 | Header Files 66 | 67 | 68 | Header Files 69 | 70 | 71 | 72 | 73 | Resource Files 74 | 75 | 76 | 77 | 78 | Resource Files 79 | 80 | 81 | -------------------------------------------------------------------------------- /msvc/libusb_dll_2012.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {d81e81ca-b13e-4a15-b54b-b12b41361e6b} 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | 46 | 47 | Header Files 48 | 49 | 50 | Header Files 51 | 52 | 53 | Header Files 54 | 55 | 56 | Header Files 57 | 58 | 59 | Header Files 60 | 61 | 62 | Header Files 63 | 64 | 65 | Header Files 66 | 67 | 68 | Header Files 69 | 70 | 71 | Header Files 72 | 73 | 74 | 75 | 76 | Resource Files 77 | 78 | 79 | 80 | 81 | Resource Files 82 | 83 | 84 | -------------------------------------------------------------------------------- /msvc/libusb_sources: -------------------------------------------------------------------------------- 1 | #TARGETTYPE is not defined, to allow selection between static lib or DLL with ddk_build 2 | TARGETNAME=libusb-1.0 3 | DLLDEF=..\libusb-1.0.def 4 | 5 | !IFNDEF MSC_WARNING_LEVEL 6 | MSC_WARNING_LEVEL=/W3 7 | !ENDIF 8 | 9 | !IFDEF STATIC_LIBC 10 | USE_LIBCMT=1 11 | !ELSE 12 | USE_MSVCRT=1 13 | !ENDIF 14 | 15 | INCLUDES=..;..\..\msvc;$(DDK_INC_PATH) 16 | C_DEFINES= $(C_DEFINES) $(LIBUSB_DEFINES) /DDDKBUILD 17 | 18 | # http://jpassing.com/2009/10/21/ltcg-issues-with-the-win7amd64-environment-of-wdk-7600/ 19 | # prevents the following error when using the 64 bit static lib with Visual Studio 2010: 20 | # "fatal error C1001: An internal error has occurred in the compiler. 21 | # (compiler file 'f:\dd\vctools\compiler\utc\src\p2\p2symtab.c', line 1823)" 22 | # and the following with Visual Studio 2010: 23 | # "fatal error C1047: The object or library file 'libusb-1.0.lib' was created with 24 | # an older compiler than other objects; rebuild old objects and libraries" 25 | USER_C_FLAGS=/GL- 26 | 27 | TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib 28 | 29 | SOURCES=..\core.c \ 30 | ..\descriptor.c \ 31 | ..\io.c \ 32 | ..\strerror.c \ 33 | ..\sync.c \ 34 | ..\hotplug.c \ 35 | threads_windows.c \ 36 | poll_windows.c \ 37 | windows_usb.c \ 38 | ..\libusb-1.0.rc 39 | -------------------------------------------------------------------------------- /msvc/libusb_static.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="libusb_static" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Static Library" 0x0104 6 | 7 | CFG=libusb_static - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "libusb_static.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "libusb_static.mak" CFG="libusb_static - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "libusb_static - Win32 Release" (based on "Win32 (x86) Static Library") 21 | !MESSAGE "libusb_static - Win32 Debug" (based on "Win32 (x86) Static Library") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "libusb_static - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir "Release" 36 | # PROP BASE Intermediate_Dir "Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir "../Win32/Release/lib" 41 | # PROP Intermediate_Dir "../Win32/Release/lib" 42 | # PROP Target_Dir "" 43 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_LIB" /YX /FD /c 44 | # ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../libusb" /D "WIN32" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_LIB" /FR /FD /EHsc /c 45 | # ADD BASE RSC /l 0x409 /d "NDEBUG" 46 | # ADD RSC /l 0x409 /d "NDEBUG" 47 | BSC32=bscmake.exe 48 | # ADD BASE BSC32 /nologo 49 | # ADD BSC32 /nologo 50 | LIB32=link.exe -lib 51 | # ADD BASE LIB32 /nologo 52 | # ADD LIB32 /nologo /out:"../Win32/Release/lib/libusb-1.0.lib" 53 | 54 | !ELSEIF "$(CFG)" == "libusb_static - Win32 Debug" 55 | 56 | # PROP BASE Use_MFC 0 57 | # PROP BASE Use_Debug_Libraries 1 58 | # PROP BASE Output_Dir "Debug" 59 | # PROP BASE Intermediate_Dir "Debug" 60 | # PROP BASE Target_Dir "" 61 | # PROP Use_MFC 0 62 | # PROP Use_Debug_Libraries 1 63 | # PROP Output_Dir "../Win32/Debug/lib" 64 | # PROP Intermediate_Dir "../Win32/Debug/lib" 65 | # PROP Target_Dir "" 66 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_LIB" /YX /FD /GZ /c 67 | # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../libusb" /D "WIN32" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_LIB" /FR /FD /GZ /EHsc /c 68 | # ADD BASE RSC /l 0x409 /d "_DEBUG" 69 | # ADD RSC /l 0x409 /d "_DEBUG" 70 | BSC32=bscmake.exe 71 | # ADD BASE BSC32 /nologo 72 | # ADD BSC32 /nologo /n 73 | LIB32=link.exe -lib 74 | # ADD BASE LIB32 /nologo 75 | # ADD LIB32 /nologo /out:"../Win32/Debug/lib/libusb-1.0.lib" 76 | 77 | !ENDIF 78 | 79 | # Begin Target 80 | 81 | # Name "libusb_static - Win32 Release" 82 | # Name "libusb_static - Win32 Debug" 83 | # Begin Group "Source Files" 84 | 85 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 86 | # Begin Source File 87 | 88 | SOURCE=..\libusb\core.c 89 | # End Source File 90 | # Begin Source File 91 | 92 | SOURCE=..\libusb\os\darwin_usb.c 93 | # PROP Exclude_From_Build 1 94 | # End Source File 95 | # Begin Source File 96 | 97 | SOURCE=..\libusb\descriptor.c 98 | # End Source File 99 | # Begin Source File 100 | 101 | SOURCE=..\libusb\io.c 102 | # End Source File 103 | # Begin Source File 104 | 105 | SOURCE=..\libusb\os\linux_usbfs.c 106 | # PROP Exclude_From_Build 1 107 | # End Source File 108 | # Begin Source File 109 | 110 | SOURCE=..\libusb\os\poll_windows.c 111 | # End Source File 112 | # Begin Source File 113 | 114 | SOURCE=..\libusb\sync.c 115 | # End Source File 116 | # Begin Source File 117 | 118 | SOURCE=..\libusb\os\threads_windows.c 119 | # End Source File 120 | # Begin Source File 121 | 122 | SOURCE=..\libusb\os\windows_usb.c 123 | # End Source File 124 | # End Group 125 | # Begin Group "Header Files" 126 | 127 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 128 | # Begin Source File 129 | 130 | SOURCE=.\config.h 131 | # End Source File 132 | # Begin Source File 133 | 134 | SOURCE=..\libusb\os\darwin_usb.h 135 | # End Source File 136 | # Begin Source File 137 | 138 | SOURCE=..\libusb\libusb.h 139 | # End Source File 140 | # Begin Source File 141 | 142 | SOURCE=..\libusb\libusbi.h 143 | # End Source File 144 | # Begin Source File 145 | 146 | SOURCE=..\libusb\os\linux_usbfs.h 147 | # End Source File 148 | # Begin Source File 149 | 150 | SOURCE=..\libusb\os\poll_posix.h 151 | # End Source File 152 | # Begin Source File 153 | 154 | SOURCE=..\libusb\os\poll_windows.h 155 | # End Source File 156 | # Begin Source File 157 | 158 | SOURCE=..\libusb\os\threads_posix.h 159 | # End Source File 160 | # Begin Source File 161 | 162 | SOURCE=..\libusb\os\threads_windows.h 163 | # End Source File 164 | # Begin Source File 165 | 166 | SOURCE=..\libusb\os\windows_usb.h 167 | # End Source File 168 | # Begin Source File 169 | 170 | SOURCE=..\libusb\os\windows_common.h 171 | # End Source File 172 | # End Group 173 | # End Target 174 | # End Project 175 | -------------------------------------------------------------------------------- /msvc/libusb_static_2010.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | 43 | 44 | Header Files 45 | 46 | 47 | Header Files 48 | 49 | 50 | Header Files 51 | 52 | 53 | Header Files 54 | 55 | 56 | Header Files 57 | 58 | 59 | Header Files 60 | 61 | 62 | Header Files 63 | 64 | 65 | Header Files 66 | 67 | 68 | Header Files 69 | 70 | 71 | Header Files 72 | 73 | 74 | -------------------------------------------------------------------------------- /msvc/libusb_static_2012.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | 43 | 44 | Header Files 45 | 46 | 47 | Header Files 48 | 49 | 50 | Header Files 51 | 52 | 53 | Header Files 54 | 55 | 56 | Header Files 57 | 58 | 59 | Header Files 60 | 61 | 62 | Header Files 63 | 64 | 65 | Header Files 66 | 67 | 68 | Header Files 69 | 70 | 71 | Header Files 72 | 73 | 74 | -------------------------------------------------------------------------------- /msvc/libusbx.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "libusb_dll"=".\libusb_dll.dsp" - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Project: "libusb_static"=".\libusb_static.dsp" - Package Owner=<4> 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<4> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | Project: "listdevs"=".\listdevs.dsp" - Package Owner=<4> 31 | 32 | Package=<5> 33 | {{{ 34 | }}} 35 | 36 | Package=<4> 37 | {{{ 38 | Begin Project Dependency 39 | Project_Dep_Name libusb_static 40 | End Project Dependency 41 | }}} 42 | 43 | ############################################################################### 44 | 45 | Project: "xusb"=".\xusb.dsp" - Package Owner=<4> 46 | 47 | Package=<5> 48 | {{{ 49 | }}} 50 | 51 | Package=<4> 52 | {{{ 53 | Begin Project Dependency 54 | Project_Dep_Name libusb_static 55 | End Project Dependency 56 | }}} 57 | 58 | ############################################################################### 59 | 60 | Global: 61 | 62 | Package=<5> 63 | {{{ 64 | }}} 65 | 66 | Package=<3> 67 | {{{ 68 | }}} 69 | 70 | ############################################################################### 71 | 72 | -------------------------------------------------------------------------------- /msvc/libusbx_2005.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (static)", "libusb_static_2005.vcproj", "{5AB6B770-1925-48D5-ABC2-930F3259C020}" 5 | ProjectSection(WebsiteProperties) = preProject 6 | Debug.AspNetCompiler.Debug = "True" 7 | Release.AspNetCompiler.Debug = "False" 8 | EndProjectSection 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (dll)", "libusb_dll_2005.vcproj", "{8224C054-5968-4238-832C-167155E7ECC3}" 11 | ProjectSection(WebsiteProperties) = preProject 12 | Debug.AspNetCompiler.Debug = "True" 13 | Release.AspNetCompiler.Debug = "False" 14 | EndProjectSection 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "listdevs", "listdevs_2005.vcproj", "{98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}" 17 | ProjectSection(WebsiteProperties) = preProject 18 | Debug.AspNetCompiler.Debug = "True" 19 | Release.AspNetCompiler.Debug = "False" 20 | EndProjectSection 21 | ProjectSection(ProjectDependencies) = postProject 22 | {5AB6B770-1925-48D5-ABC2-930F3259C020} = {5AB6B770-1925-48D5-ABC2-930F3259C020} 23 | EndProjectSection 24 | EndProject 25 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xusb", "xusb_2005.vcproj", "{08A6FA39-21B7-4A05-9252-2F9864A5E5A4}" 26 | ProjectSection(WebsiteProperties) = preProject 27 | Debug.AspNetCompiler.Debug = "True" 28 | Release.AspNetCompiler.Debug = "False" 29 | EndProjectSection 30 | ProjectSection(ProjectDependencies) = postProject 31 | {5AB6B770-1925-48D5-ABC2-930F3259C020} = {5AB6B770-1925-48D5-ABC2-930F3259C020} 32 | EndProjectSection 33 | EndProject 34 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress", "stress_2005.vcproj", "{53942EFF-C810-458D-B3CB-EE5CE9F1E781}" 35 | ProjectSection(WebsiteProperties) = preProject 36 | Debug.AspNetCompiler.Debug = "True" 37 | Release.AspNetCompiler.Debug = "False" 38 | EndProjectSection 39 | ProjectSection(ProjectDependencies) = postProject 40 | {5AB6B770-1925-48D5-ABC2-930F3259C020} = {5AB6B770-1925-48D5-ABC2-930F3259C020} 41 | EndProjectSection 42 | EndProject 43 | Global 44 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 45 | Debug|Win32 = Debug|Win32 46 | Debug|x64 = Debug|x64 47 | Release|Win32 = Release|Win32 48 | Release|x64 = Release|x64 49 | EndGlobalSection 50 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 51 | {5AB6B770-1925-48D5-ABC2-930F3259C020}.Debug|Win32.ActiveCfg = Debug|Win32 52 | {5AB6B770-1925-48D5-ABC2-930F3259C020}.Debug|Win32.Build.0 = Debug|Win32 53 | {5AB6B770-1925-48D5-ABC2-930F3259C020}.Debug|x64.ActiveCfg = Debug|x64 54 | {5AB6B770-1925-48D5-ABC2-930F3259C020}.Debug|x64.Build.0 = Debug|x64 55 | {5AB6B770-1925-48D5-ABC2-930F3259C020}.Release|Win32.ActiveCfg = Release|Win32 56 | {5AB6B770-1925-48D5-ABC2-930F3259C020}.Release|Win32.Build.0 = Release|Win32 57 | {5AB6B770-1925-48D5-ABC2-930F3259C020}.Release|x64.ActiveCfg = Release|x64 58 | {5AB6B770-1925-48D5-ABC2-930F3259C020}.Release|x64.Build.0 = Release|x64 59 | {8224C054-5968-4238-832C-167155E7ECC3}.Debug|Win32.ActiveCfg = Debug|Win32 60 | {8224C054-5968-4238-832C-167155E7ECC3}.Debug|Win32.Build.0 = Debug|Win32 61 | {8224C054-5968-4238-832C-167155E7ECC3}.Debug|x64.ActiveCfg = Debug|x64 62 | {8224C054-5968-4238-832C-167155E7ECC3}.Debug|x64.Build.0 = Debug|x64 63 | {8224C054-5968-4238-832C-167155E7ECC3}.Release|Win32.ActiveCfg = Release|Win32 64 | {8224C054-5968-4238-832C-167155E7ECC3}.Release|Win32.Build.0 = Release|Win32 65 | {8224C054-5968-4238-832C-167155E7ECC3}.Release|x64.ActiveCfg = Release|x64 66 | {8224C054-5968-4238-832C-167155E7ECC3}.Release|x64.Build.0 = Release|x64 67 | {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Debug|Win32.ActiveCfg = Debug|Win32 68 | {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Debug|Win32.Build.0 = Debug|Win32 69 | {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Debug|x64.ActiveCfg = Debug|x64 70 | {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Debug|x64.Build.0 = Debug|x64 71 | {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Release|Win32.ActiveCfg = Release|Win32 72 | {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Release|Win32.Build.0 = Release|Win32 73 | {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Release|x64.ActiveCfg = Release|x64 74 | {98CFD8FA-EE20-40D5-AF13-F8C4856D6CA5}.Release|x64.Build.0 = Release|x64 75 | {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Debug|Win32.ActiveCfg = Debug|Win32 76 | {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Debug|Win32.Build.0 = Debug|Win32 77 | {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Debug|x64.ActiveCfg = Debug|x64 78 | {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Debug|x64.Build.0 = Debug|x64 79 | {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Release|Win32.ActiveCfg = Release|Win32 80 | {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Release|Win32.Build.0 = Release|Win32 81 | {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Release|x64.ActiveCfg = Release|x64 82 | {08A6FA39-21B7-4A05-9252-2F9864A5E5A4}.Release|x64.Build.0 = Release|x64 83 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.ActiveCfg = Debug|Win32 84 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.Build.0 = Debug|Win32 85 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.ActiveCfg = Debug|x64 86 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.Build.0 = Debug|x64 87 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.ActiveCfg = Release|Win32 88 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.Build.0 = Release|Win32 89 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.ActiveCfg = Release|x64 90 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.Build.0 = Release|x64 91 | EndGlobalSection 92 | GlobalSection(SolutionProperties) = preSolution 93 | HideSolutionNode = FALSE 94 | EndGlobalSection 95 | EndGlobal 96 | -------------------------------------------------------------------------------- /msvc/libusbx_2010.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2010 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (static)", "libusb_static_2010.vcxproj", "{349EE8F9-7D25-4909-AAF5-FF3FADE72187}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (dll)", "libusb_dll_2010.vcxproj", "{349EE8FA-7D25-4909-AAF5-FF3FADE72187}" 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "listdevs", "listdevs_2010.vcxproj", "{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}" 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xusb", "xusb_2010.vcxproj", "{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}" 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fxload", "fxload_2010.vcxproj", "{9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}" 12 | ProjectSection(ProjectDependencies) = postProject 13 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E} = {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E} 14 | EndProjectSection 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "getopt", "getopt_2010.vcxproj", "{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress", "stress_2010.vcxproj", "{53942EFF-C810-458D-B3CB-EE5CE9F1E781}" 19 | EndProject 20 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hotplugtest", "hotplugtest_2010.vcxproj", "{99D2AC64-DC66-4422-91CE-6715C403C9E5}" 21 | EndProject 22 | Global 23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 24 | Debug|Win32 = Debug|Win32 25 | Debug|x64 = Debug|x64 26 | Release|Win32 = Release|Win32 27 | Release|x64 = Release|x64 28 | EndGlobalSection 29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 30 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.ActiveCfg = Debug|Win32 31 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.Build.0 = Debug|Win32 32 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64 33 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.Build.0 = Debug|x64 34 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.ActiveCfg = Release|Win32 35 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.Build.0 = Release|Win32 36 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64 37 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.Build.0 = Release|x64 38 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.ActiveCfg = Debug|Win32 39 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64 40 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.ActiveCfg = Release|Win32 41 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64 42 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|Win32.ActiveCfg = Debug|Win32 43 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|Win32.Build.0 = Debug|Win32 44 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|x64.ActiveCfg = Debug|x64 45 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|x64.Build.0 = Debug|x64 46 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|Win32.ActiveCfg = Release|Win32 47 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|Win32.Build.0 = Release|Win32 48 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|x64.ActiveCfg = Release|x64 49 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|x64.Build.0 = Release|x64 50 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|Win32.ActiveCfg = Debug|Win32 51 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|Win32.Build.0 = Debug|Win32 52 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|x64.ActiveCfg = Debug|x64 53 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|x64.Build.0 = Debug|x64 54 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|Win32.ActiveCfg = Release|Win32 55 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|Win32.Build.0 = Release|Win32 56 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|x64.ActiveCfg = Release|x64 57 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|x64.Build.0 = Release|x64 58 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|Win32.ActiveCfg = Debug|Win32 59 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|Win32.Build.0 = Debug|Win32 60 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|x64.ActiveCfg = Debug|x64 61 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|x64.Build.0 = Debug|x64 62 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|Win32.ActiveCfg = Release|Win32 63 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|Win32.Build.0 = Release|Win32 64 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|x64.ActiveCfg = Release|x64 65 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|x64.Build.0 = Release|x64 66 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|Win32.ActiveCfg = Debug|Win32 67 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|Win32.Build.0 = Debug|Win32 68 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x64.ActiveCfg = Debug|x64 69 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x64.Build.0 = Debug|x64 70 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|Win32.ActiveCfg = Release|Win32 71 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|Win32.Build.0 = Release|Win32 72 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x64.ActiveCfg = Release|x64 73 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x64.Build.0 = Release|x64 74 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.ActiveCfg = Debug|Win32 75 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.Build.0 = Debug|Win32 76 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.ActiveCfg = Debug|x64 77 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.Build.0 = Debug|x64 78 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.ActiveCfg = Release|Win32 79 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.Build.0 = Release|Win32 80 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.ActiveCfg = Release|x64 81 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.Build.0 = Release|x64 82 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|Win32.ActiveCfg = Debug|Win32 83 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|Win32.Build.0 = Debug|Win32 84 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|x64.ActiveCfg = Debug|x64 85 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|x64.Build.0 = Debug|x64 86 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|Win32.ActiveCfg = Release|Win32 87 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|Win32.Build.0 = Release|Win32 88 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|x64.ActiveCfg = Release|x64 89 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|x64.Build.0 = Release|x64 90 | EndGlobalSection 91 | GlobalSection(SolutionProperties) = preSolution 92 | HideSolutionNode = FALSE 93 | EndGlobalSection 94 | EndGlobal 95 | -------------------------------------------------------------------------------- /msvc/libusbx_2012.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 2012 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (static)", "libusb_static_2012.vcxproj", "{349EE8F9-7D25-4909-AAF5-FF3FADE72187}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (dll)", "libusb_dll_2012.vcxproj", "{349EE8FA-7D25-4909-AAF5-FF3FADE72187}" 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "listdevs", "listdevs_2012.vcxproj", "{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}" 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xusb", "xusb_2012.vcxproj", "{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}" 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fxload", "fxload_2012.vcxproj", "{9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}" 12 | ProjectSection(ProjectDependencies) = postProject 13 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E} = {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E} 14 | EndProjectSection 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "getopt", "getopt_2012.vcxproj", "{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress", "stress_2012.vcxproj", "{53942EFF-C810-458D-B3CB-EE5CE9F1E781}" 19 | EndProject 20 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hotplugtest", "hotplugtest_2012.vcxproj", "{99D2AC64-DC66-4422-91CE-6715C403C9E5}" 21 | EndProject 22 | Global 23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 24 | Debug|Win32 = Debug|Win32 25 | Debug|x64 = Debug|x64 26 | Release|Win32 = Release|Win32 27 | Release|x64 = Release|x64 28 | EndGlobalSection 29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 30 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.ActiveCfg = Debug|Win32 31 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.Build.0 = Debug|Win32 32 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64 33 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.Build.0 = Debug|x64 34 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.ActiveCfg = Release|Win32 35 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.Build.0 = Release|Win32 36 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64 37 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.Build.0 = Release|x64 38 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.ActiveCfg = Debug|Win32 39 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64 40 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.ActiveCfg = Release|Win32 41 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64 42 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|Win32.ActiveCfg = Debug|Win32 43 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|Win32.Build.0 = Debug|Win32 44 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|x64.ActiveCfg = Debug|x64 45 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|x64.Build.0 = Debug|x64 46 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|Win32.ActiveCfg = Release|Win32 47 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|Win32.Build.0 = Release|Win32 48 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|x64.ActiveCfg = Release|x64 49 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|x64.Build.0 = Release|x64 50 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|Win32.ActiveCfg = Debug|Win32 51 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|Win32.Build.0 = Debug|Win32 52 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|x64.ActiveCfg = Debug|x64 53 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|x64.Build.0 = Debug|x64 54 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|Win32.ActiveCfg = Release|Win32 55 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|Win32.Build.0 = Release|Win32 56 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|x64.ActiveCfg = Release|x64 57 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|x64.Build.0 = Release|x64 58 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|Win32.ActiveCfg = Debug|Win32 59 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|Win32.Build.0 = Debug|Win32 60 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|x64.ActiveCfg = Debug|x64 61 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|x64.Build.0 = Debug|x64 62 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|Win32.ActiveCfg = Release|Win32 63 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|Win32.Build.0 = Release|Win32 64 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|x64.ActiveCfg = Release|x64 65 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|x64.Build.0 = Release|x64 66 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|Win32.ActiveCfg = Debug|Win32 67 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|Win32.Build.0 = Debug|Win32 68 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x64.ActiveCfg = Debug|x64 69 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x64.Build.0 = Debug|x64 70 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|Win32.ActiveCfg = Release|Win32 71 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|Win32.Build.0 = Release|Win32 72 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x64.ActiveCfg = Release|x64 73 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x64.Build.0 = Release|x64 74 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.ActiveCfg = Debug|Win32 75 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.Build.0 = Debug|Win32 76 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.ActiveCfg = Debug|x64 77 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.Build.0 = Debug|x64 78 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.ActiveCfg = Release|Win32 79 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.Build.0 = Release|Win32 80 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.ActiveCfg = Release|x64 81 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.Build.0 = Release|x64 82 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|Win32.ActiveCfg = Debug|Win32 83 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|Win32.Build.0 = Debug|Win32 84 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|x64.ActiveCfg = Debug|x64 85 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|x64.Build.0 = Debug|x64 86 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|Win32.ActiveCfg = Release|Win32 87 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|Win32.Build.0 = Release|Win32 88 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|x64.ActiveCfg = Release|x64 89 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|x64.Build.0 = Release|x64 90 | EndGlobalSection 91 | GlobalSection(SolutionProperties) = preSolution 92 | HideSolutionNode = FALSE 93 | EndGlobalSection 94 | EndGlobal 95 | -------------------------------------------------------------------------------- /msvc/libusbx_2013.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 2013 3 | VisualStudioVersion = 12.0.21005.1 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (static)", "libusb_static_2013.vcxproj", "{349EE8F9-7D25-4909-AAF5-FF3FADE72187}" 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (dll)", "libusb_dll_2013.vcxproj", "{349EE8FA-7D25-4909-AAF5-FF3FADE72187}" 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "listdevs", "listdevs_2013.vcxproj", "{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}" 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xusb", "xusb_2013.vcxproj", "{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}" 12 | EndProject 13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fxload", "fxload_2013.vcxproj", "{9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}" 14 | ProjectSection(ProjectDependencies) = postProject 15 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E} = {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E} 16 | EndProjectSection 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "getopt", "getopt_2013.vcxproj", "{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}" 19 | EndProject 20 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress", "stress_2013.vcxproj", "{53942EFF-C810-458D-B3CB-EE5CE9F1E781}" 21 | EndProject 22 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hotplugtest", "hotplugtest_2013.vcxproj", "{99D2AC64-DC66-4422-91CE-6715C403C9E5}" 23 | EndProject 24 | Global 25 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 26 | Debug|Win32 = Debug|Win32 27 | Debug|x64 = Debug|x64 28 | Release|Win32 = Release|Win32 29 | Release|x64 = Release|x64 30 | EndGlobalSection 31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 32 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.ActiveCfg = Debug|Win32 33 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.Build.0 = Debug|Win32 34 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64 35 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.Build.0 = Debug|x64 36 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.ActiveCfg = Release|Win32 37 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.Build.0 = Release|Win32 38 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64 39 | {349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.Build.0 = Release|x64 40 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.ActiveCfg = Debug|Win32 41 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|Win32.Build.0 = Debug|Win32 42 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.ActiveCfg = Debug|x64 43 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Debug|x64.Build.0 = Debug|x64 44 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.ActiveCfg = Release|Win32 45 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|Win32.Build.0 = Release|Win32 46 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64 47 | {349EE8FA-7D25-4909-AAF5-FF3FADE72187}.Release|x64.Build.0 = Release|x64 48 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|Win32.ActiveCfg = Debug|Win32 49 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|Win32.Build.0 = Debug|Win32 50 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|x64.ActiveCfg = Debug|x64 51 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Debug|x64.Build.0 = Debug|x64 52 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|Win32.ActiveCfg = Release|Win32 53 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|Win32.Build.0 = Release|Win32 54 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|x64.ActiveCfg = Release|x64 55 | {F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}.Release|x64.Build.0 = Release|x64 56 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|Win32.ActiveCfg = Debug|Win32 57 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|Win32.Build.0 = Debug|Win32 58 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|x64.ActiveCfg = Debug|x64 59 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Debug|x64.Build.0 = Debug|x64 60 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|Win32.ActiveCfg = Release|Win32 61 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|Win32.Build.0 = Release|Win32 62 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|x64.ActiveCfg = Release|x64 63 | {3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}.Release|x64.Build.0 = Release|x64 64 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|Win32.ActiveCfg = Debug|Win32 65 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|Win32.Build.0 = Debug|Win32 66 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|x64.ActiveCfg = Debug|x64 67 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Debug|x64.Build.0 = Debug|x64 68 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|Win32.ActiveCfg = Release|Win32 69 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|Win32.Build.0 = Release|Win32 70 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|x64.ActiveCfg = Release|x64 71 | {9E166F7A-A793-9FB6-0A67-F0AED8AE8C88}.Release|x64.Build.0 = Release|x64 72 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|Win32.ActiveCfg = Debug|Win32 73 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|Win32.Build.0 = Debug|Win32 74 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x64.ActiveCfg = Debug|x64 75 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x64.Build.0 = Debug|x64 76 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|Win32.ActiveCfg = Release|Win32 77 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|Win32.Build.0 = Release|Win32 78 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x64.ActiveCfg = Release|x64 79 | {AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x64.Build.0 = Release|x64 80 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.ActiveCfg = Debug|Win32 81 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|Win32.Build.0 = Debug|Win32 82 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.ActiveCfg = Debug|x64 83 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Debug|x64.Build.0 = Debug|x64 84 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.ActiveCfg = Release|Win32 85 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|Win32.Build.0 = Release|Win32 86 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.ActiveCfg = Release|x64 87 | {53942EFF-C810-458D-B3CB-EE5CE9F1E781}.Release|x64.Build.0 = Release|x64 88 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|Win32.ActiveCfg = Debug|Win32 89 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|Win32.Build.0 = Debug|Win32 90 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|x64.ActiveCfg = Debug|x64 91 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Debug|x64.Build.0 = Debug|x64 92 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|Win32.ActiveCfg = Release|Win32 93 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|Win32.Build.0 = Release|Win32 94 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|x64.ActiveCfg = Release|x64 95 | {99D2AC64-DC66-4422-91CE-6715C403C9E5}.Release|x64.Build.0 = Release|x64 96 | EndGlobalSection 97 | GlobalSection(SolutionProperties) = preSolution 98 | HideSolutionNode = FALSE 99 | EndGlobalSection 100 | EndGlobal 101 | -------------------------------------------------------------------------------- /msvc/listdevs.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="listdevs" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Console Application" 0x0103 6 | 7 | CFG=listdevs - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "listdevs.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "listdevs.mak" CFG="listdevs - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "listdevs - Win32 Release" (based on "Win32 (x86) Console Application") 21 | !MESSAGE "listdevs - Win32 Debug" (based on "Win32 (x86) Console Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "listdevs - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir "Release" 36 | # PROP BASE Intermediate_Dir "Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir "../Win32/Release/examples" 41 | # PROP Intermediate_Dir "../Win32/Release/examples/listdevs" 42 | # PROP Ignore_Export_Lib 0 43 | # PROP Target_Dir "" 44 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c 45 | # ADD CPP /nologo /MD /W3 /GX /O2 /I "../libusb" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /EHsc /c 46 | # ADD BASE RSC /l 0x409 /d "NDEBUG" 47 | # ADD RSC /l 0x409 /d "NDEBUG" 48 | BSC32=bscmake.exe 49 | # ADD BASE BSC32 /nologo 50 | # ADD BSC32 /nologo 51 | LINK32=link.exe 52 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 53 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 54 | 55 | !ELSEIF "$(CFG)" == "listdevs - Win32 Debug" 56 | 57 | # PROP BASE Use_MFC 0 58 | # PROP BASE Use_Debug_Libraries 1 59 | # PROP BASE Output_Dir "Debug" 60 | # PROP BASE Intermediate_Dir "Debug" 61 | # PROP BASE Target_Dir "" 62 | # PROP Use_MFC 0 63 | # PROP Use_Debug_Libraries 1 64 | # PROP Output_Dir "../Win32/Debug/examples" 65 | # PROP Intermediate_Dir "../Win32/Debug/examples/listdevs" 66 | # PROP Ignore_Export_Lib 0 67 | # PROP Target_Dir "" 68 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /GZ /c 69 | # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../libusb" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /GZ /EHsc /c 70 | # ADD BASE RSC /l 0x409 /d "_DEBUG" 71 | # ADD RSC /l 0x409 /d "_DEBUG" 72 | BSC32=bscmake.exe 73 | # ADD BASE BSC32 /nologo 74 | # ADD BSC32 /nologo /n "../Win32/Debug/dll/core.sbr" "../Win32/Debug/dll/descriptor.sbr" "../Win32/Debug/dll/io.sbr" "../Win32/Debug/dll/sync.sbr" "../Win32/Debug/dll/poll_windows.sbr" "../Win32/Debug/dll/threads_windows.sbr" "../Win32/Debug/dll/windows_usb.sbr" 75 | LINK32=link.exe 76 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept 77 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 78 | # SUBTRACT LINK32 /pdb:none 79 | 80 | !ENDIF 81 | 82 | # Begin Target 83 | 84 | # Name "listdevs - Win32 Release" 85 | # Name "listdevs - Win32 Debug" 86 | # Begin Group "Source Files" 87 | 88 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 89 | # Begin Source File 90 | 91 | SOURCE=..\examples\listdevs.c 92 | # End Source File 93 | # End Group 94 | # Begin Group "Header Files" 95 | 96 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 97 | # End Group 98 | # Begin Group "Resource Files" 99 | 100 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 101 | # End Group 102 | # End Target 103 | # End Project 104 | -------------------------------------------------------------------------------- /msvc/listdevs_2010.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc/listdevs_2012.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc/listdevs_sources: -------------------------------------------------------------------------------- 1 | TARGETNAME=listdevs 2 | TARGETTYPE=PROGRAM 3 | 386_STDCALL=0 4 | 5 | _NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP) 6 | !IFNDEF MSC_WARNING_LEVEL 7 | MSC_WARNING_LEVEL=/W3 8 | !ENDIF 9 | 10 | !IFDEF STATIC_LIBC 11 | USE_LIBCMT=1 12 | !ELSE 13 | USE_MSVCRT=1 14 | !ENDIF 15 | 16 | UMTYPE=console 17 | INCLUDES=..\..\libusb;$(DDK_INC_PATH) 18 | UMLIBS=..\..\libusb\os\obj$(BUILD_ALT_DIR)\*\libusb-1.0.lib 19 | SOURCES=..\listdevs.c 20 | -------------------------------------------------------------------------------- /msvc/missing.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Source file for missing WinCE functionality 3 | * Copyright © 2012 RealVNC Ltd. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #include "missing.h" 21 | 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | // The registry path to store environment variables 28 | #define ENVIRONMENT_REG_PATH _T("Software\\libusb\\environment") 29 | 30 | /* Workaround getenv not being available on WinCE. 31 | * Instead look in HKLM\Software\libusb\environment */ 32 | char *getenv(const char *name) 33 | { 34 | static char value[MAX_PATH]; 35 | TCHAR wValue[MAX_PATH]; 36 | WCHAR wName[MAX_PATH]; 37 | DWORD dwType, dwData; 38 | HKEY hkey; 39 | LONG rc; 40 | 41 | if (!name) 42 | return NULL; 43 | 44 | if (MultiByteToWideChar(CP_UTF8, 0, name, -1, wName, MAX_PATH) <= 0) { 45 | usbi_dbg("Failed to convert environment variable name to wide string"); 46 | return NULL; 47 | } 48 | wName[MAX_PATH - 1] = 0; // Be sure it's NUL terminated 49 | 50 | rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ENVIRONMENT_REG_PATH, 0, KEY_QUERY_VALUE, &hkey); 51 | if (rc != ERROR_SUCCESS) { 52 | usbi_dbg("Failed to open registry key for getenv with error %d", rc); 53 | return NULL; 54 | } 55 | 56 | // Attempt to read the key 57 | dwData = sizeof(wValue); 58 | rc = RegQueryValueEx(hkey, wName, NULL, &dwType, 59 | (LPBYTE)&wValue, &dwData); 60 | RegCloseKey(hkey); 61 | if (rc != ERROR_SUCCESS) { 62 | usbi_dbg("Failed to read registry key value for getenv with error %d", rc); 63 | return NULL; 64 | } 65 | if (dwType != REG_SZ) { 66 | usbi_dbg("Registry value was of type %d instead of REG_SZ", dwType); 67 | return NULL; 68 | } 69 | 70 | // Success in reading the key, convert from WCHAR to char 71 | if (WideCharToMultiByte(CP_UTF8, 0, 72 | wValue, dwData / sizeof(*wValue), 73 | value, MAX_PATH, 74 | NULL, NULL) <= 0) { 75 | usbi_dbg("Failed to convert environment variable value to narrow string"); 76 | return NULL; 77 | } 78 | value[MAX_PATH - 1] = 0; // Be sure it's NUL terminated 79 | return value; 80 | } 81 | -------------------------------------------------------------------------------- /msvc/missing.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Header file for missing WinCE functionality 3 | * Copyright © 2012-2013 RealVNC Ltd. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef MISSING_H 21 | #define MISSING_H 22 | 23 | /* Windows CE doesn't have SleepEx() - Fallback to Sleep() */ 24 | #define SleepEx(m, a) Sleep(m) 25 | 26 | /* Windows CE doesn't have any APIs to query environment variables. 27 | * 28 | * This contains a registry based implementation of getenv. 29 | */ 30 | char *getenv(const char *name); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /msvc/stress_2010.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {28b6220e-d087-4f48-bd69-ffe0ac5bcc7a} 10 | 11 | 12 | 13 | 14 | Source Files 15 | 16 | 17 | Source Files 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | -------------------------------------------------------------------------------- /msvc/stress_2012.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {28b6220e-d087-4f48-bd69-ffe0ac5bcc7a} 10 | 11 | 12 | 13 | 14 | Source Files 15 | 16 | 17 | Source Files 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | -------------------------------------------------------------------------------- /msvc/xusb.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="xusb" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Console Application" 0x0103 6 | 7 | CFG=xusb - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "xusb.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "xusb.mak" CFG="xusb - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "xusb - Win32 Release" (based on "Win32 (x86) Console Application") 21 | !MESSAGE "xusb - Win32 Debug" (based on "Win32 (x86) Console Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "xusb - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir "Release" 36 | # PROP BASE Intermediate_Dir "Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir "../Win32/Release/examples" 41 | # PROP Intermediate_Dir "../Win32/Release/examples/xusb" 42 | # PROP Ignore_Export_Lib 0 43 | # PROP Target_Dir "" 44 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c 45 | # ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../libusb" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /EHsc /c 46 | # ADD BASE RSC /l 0x409 /d "NDEBUG" 47 | # ADD RSC /l 0x409 /d "NDEBUG" 48 | BSC32=bscmake.exe 49 | # ADD BASE BSC32 /nologo 50 | # ADD BSC32 /nologo 51 | LINK32=link.exe 52 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 53 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 54 | 55 | !ELSEIF "$(CFG)" == "xusb - Win32 Debug" 56 | 57 | # PROP BASE Use_MFC 0 58 | # PROP BASE Use_Debug_Libraries 1 59 | # PROP BASE Output_Dir "xusb___Win32_Debug" 60 | # PROP BASE Intermediate_Dir "xusb___Win32_Debug" 61 | # PROP BASE Target_Dir "" 62 | # PROP Use_MFC 0 63 | # PROP Use_Debug_Libraries 1 64 | # PROP Output_Dir "../Win32/Debug/examples" 65 | # PROP Intermediate_Dir "../Win32/Debug/examples/xusb" 66 | # PROP Ignore_Export_Lib 0 67 | # PROP Target_Dir "" 68 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /GZ /c 69 | # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../libusb" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /GZ /EHsc /c 70 | # ADD BASE RSC /l 0x409 /d "_DEBUG" 71 | # ADD RSC /l 0x409 /d "_DEBUG" 72 | BSC32=bscmake.exe 73 | # ADD BASE BSC32 /nologo 74 | # ADD BSC32 /nologo /n "../Win32/Debug/dll/core.sbr" "../Win32/Debug/dll/descriptor.sbr" "../Win32/Debug/dll/io.sbr" "../Win32/Debug/dll/sync.sbr" "../Win32/Debug/dll/poll_windows.sbr" "../Win32/Debug/dll/threads_windows.sbr" "../Win32/Debug/dll/windows_usb.sbr" 75 | LINK32=link.exe 76 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept 77 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 78 | 79 | !ENDIF 80 | 81 | # Begin Target 82 | 83 | # Name "xusb - Win32 Release" 84 | # Name "xusb - Win32 Debug" 85 | # Begin Group "Source Files" 86 | 87 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 88 | # Begin Source File 89 | 90 | SOURCE=..\examples\xusb.c 91 | # End Source File 92 | # End Group 93 | # Begin Group "Header Files" 94 | 95 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 96 | # End Group 97 | # Begin Group "Resource Files" 98 | 99 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 100 | # End Group 101 | # End Target 102 | # End Project 103 | -------------------------------------------------------------------------------- /msvc/xusb_2010.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc/xusb_2012.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc/xusb_sources: -------------------------------------------------------------------------------- 1 | TARGETNAME=xusb 2 | TARGETTYPE=PROGRAM 3 | 386_STDCALL=0 4 | 5 | _NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP) 6 | 7 | !IFNDEF MSC_WARNING_LEVEL 8 | MSC_WARNING_LEVEL=/W3 9 | !ENDIF 10 | 11 | !IFDEF STATIC_LIBC 12 | USE_LIBCMT=1 13 | !ELSE 14 | USE_MSVCRT=1 15 | !ENDIF 16 | 17 | UMTYPE=console 18 | INCLUDES=..\..\msvc;..\..\libusb;$(DDK_INC_PATH) 19 | UMLIBS=..\..\libusb\os\obj$(BUILD_ALT_DIR)\*\libusb-1.0.lib 20 | SOURCES=..\xusb.c 21 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/libusb 2 | LDADD = ../libusb/libusb-1.0.la 3 | 4 | noinst_PROGRAMS = stress 5 | 6 | stress_SOURCES = stress.c libusbx_testlib.h testlib.c 7 | -------------------------------------------------------------------------------- /tests/libusbx_testlib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libusbx test library helper functions 3 | * Copyright © 2012 Toby Gray 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef LIBUSBX_TESTLIB_H 21 | #define LIBUSBX_TESTLIB_H 22 | 23 | #include 24 | 25 | #if !defined(bool) 26 | #define bool int 27 | #endif 28 | #if !defined(true) 29 | #define true (1 == 1) 30 | #endif 31 | #if !defined(false) 32 | #define false (!true) 33 | #endif 34 | 35 | /** Values returned from a test function to indicate test result */ 36 | typedef enum { 37 | /** Indicates that the test ran successfully. */ 38 | TEST_STATUS_SUCCESS, 39 | /** Indicates that the test failed one or more test. */ 40 | TEST_STATUS_FAILURE, 41 | /** Indicates that an unexpected error occurred. */ 42 | TEST_STATUS_ERROR, 43 | /** Indicates that the test can't be run. For example this may be 44 | * due to no suitable device being connected to perform the tests.*/ 45 | TEST_STATUS_SKIP 46 | } libusbx_testlib_result; 47 | 48 | /** 49 | * Context for test library functions 50 | */ 51 | typedef struct { 52 | char ** test_names; 53 | int test_count; 54 | bool list_tests; 55 | bool verbose; 56 | int old_stdout; 57 | int old_stderr; 58 | FILE* output_file; 59 | int null_fd; 60 | } libusbx_testlib_ctx; 61 | 62 | /** 63 | * Logs some test information or state 64 | */ 65 | void libusbx_testlib_logf(libusbx_testlib_ctx * ctx, 66 | const char* fmt, ...); 67 | 68 | /** 69 | * Function pointer for a libusbx test function. 70 | * 71 | * Should return TEST_STATUS_SUCCESS on success or another TEST_STATUS value. 72 | */ 73 | typedef libusbx_testlib_result 74 | (*libusbx_testlib_test_function)(libusbx_testlib_ctx * ctx); 75 | 76 | /** 77 | * Structure holding a test description. 78 | */ 79 | typedef struct { 80 | /** Human readable name of the test. */ 81 | const char * name; 82 | /** The test library will call this function to run the test. */ 83 | libusbx_testlib_test_function function; 84 | } libusbx_testlib_test; 85 | 86 | /** 87 | * Value to use at the end of a test array to indicate the last 88 | * element. 89 | */ 90 | #define LIBUSBX_NULL_TEST {NULL, NULL} 91 | 92 | /** 93 | * Runs the tests provided. 94 | * 95 | * Before running any tests argc and argv will be processed 96 | * to determine the mode of operation. 97 | * 98 | * \param argc The argc from main 99 | * \param argv The argv from main 100 | * \param tests A NULL_TEST terminated array of tests 101 | * \return 0 on success, non-zero on failure 102 | */ 103 | int libusbx_testlib_run_tests(int argc, 104 | char ** argv, 105 | const libusbx_testlib_test * tests); 106 | 107 | #endif //LIBUSBX_TESTLIB_H 108 | -------------------------------------------------------------------------------- /tests/stress.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libusbx stress test program to perform simple stress tests 3 | * Copyright © 2012 Toby Gray 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "libusb.h" 25 | #include "libusbx_testlib.h" 26 | 27 | /** Test that creates and destroys a single concurrent context 28 | * 10000 times. */ 29 | static libusbx_testlib_result test_init_and_exit(libusbx_testlib_ctx * tctx) 30 | { 31 | libusb_context * ctx = NULL; 32 | int i; 33 | for (i = 0; i < 10000; ++i) { 34 | int r = libusb_init(&ctx); 35 | if (r != LIBUSB_SUCCESS) { 36 | libusbx_testlib_logf(tctx, 37 | "Failed to init libusb on iteration %d: %d", 38 | i, r); 39 | return TEST_STATUS_FAILURE; 40 | } 41 | libusb_exit(ctx); 42 | ctx = NULL; 43 | } 44 | 45 | return TEST_STATUS_SUCCESS; 46 | } 47 | 48 | /** Tests that devices can be listed 1000 times. */ 49 | static libusbx_testlib_result test_get_device_list(libusbx_testlib_ctx * tctx) 50 | { 51 | libusb_context * ctx = NULL; 52 | int r, i; 53 | r = libusb_init(&ctx); 54 | if (r != LIBUSB_SUCCESS) { 55 | libusbx_testlib_logf(tctx, "Failed to init libusb: %d", r); 56 | return TEST_STATUS_FAILURE; 57 | } 58 | for (i = 0; i < 1000; ++i) { 59 | libusb_device ** device_list; 60 | ssize_t list_size = libusb_get_device_list(ctx, &device_list); 61 | if (list_size < 0 || device_list == NULL) { 62 | libusbx_testlib_logf(tctx, 63 | "Failed to get device list on iteration %d: %d (%p)", 64 | i, -list_size, device_list); 65 | return TEST_STATUS_FAILURE; 66 | } 67 | libusb_free_device_list(device_list, 1); 68 | } 69 | libusb_exit(ctx); 70 | return TEST_STATUS_SUCCESS; 71 | } 72 | 73 | /** Tests that 100 concurrent device lists can be open at a time. */ 74 | static libusbx_testlib_result test_many_device_lists(libusbx_testlib_ctx * tctx) 75 | { 76 | #define LIST_COUNT 100 77 | libusb_context * ctx = NULL; 78 | libusb_device ** device_lists[LIST_COUNT]; 79 | int r, i; 80 | memset(device_lists, 0, sizeof(device_lists)); 81 | 82 | r = libusb_init(&ctx); 83 | if (r != LIBUSB_SUCCESS) { 84 | libusbx_testlib_logf(tctx, "Failed to init libusb: %d", r); 85 | return TEST_STATUS_FAILURE; 86 | } 87 | 88 | /* Create the 100 device lists. */ 89 | for (i = 0; i < LIST_COUNT; ++i) { 90 | ssize_t list_size = libusb_get_device_list(ctx, &(device_lists[i])); 91 | if (list_size < 0 || device_lists[i] == NULL) { 92 | libusbx_testlib_logf(tctx, 93 | "Failed to get device list on iteration %d: %d (%p)", 94 | i, -list_size, device_lists[i]); 95 | return TEST_STATUS_FAILURE; 96 | } 97 | } 98 | 99 | /* Destroy the 100 device lists. */ 100 | for (i = 0; i < LIST_COUNT; ++i) { 101 | if (device_lists[i]) { 102 | libusb_free_device_list(device_lists[i], 1); 103 | device_lists[i] = NULL; 104 | } 105 | } 106 | 107 | libusb_exit(ctx); 108 | return TEST_STATUS_SUCCESS; 109 | #undef LIST_COUNT 110 | } 111 | 112 | /** Tests that the default context (used for various things including 113 | * logging) works correctly when the first context created in a 114 | * process is destroyed. */ 115 | static libusbx_testlib_result test_default_context_change(libusbx_testlib_ctx * tctx) 116 | { 117 | libusb_context * ctx = NULL; 118 | int r, i; 119 | 120 | for (i = 0; i < 100; ++i) { 121 | /* First create a new context */ 122 | r = libusb_init(&ctx); 123 | if (r != LIBUSB_SUCCESS) { 124 | libusbx_testlib_logf(tctx, "Failed to init libusb: %d", r); 125 | return TEST_STATUS_FAILURE; 126 | } 127 | 128 | /* Enable debug output, to be sure to use the context */ 129 | libusb_set_debug(NULL, LIBUSB_LOG_LEVEL_DEBUG); 130 | libusb_set_debug(ctx, LIBUSB_LOG_LEVEL_DEBUG); 131 | 132 | /* Now create a reference to the default context */ 133 | r = libusb_init(NULL); 134 | if (r != LIBUSB_SUCCESS) { 135 | libusbx_testlib_logf(tctx, "Failed to init libusb: %d", r); 136 | return TEST_STATUS_FAILURE; 137 | } 138 | 139 | /* Destroy the first context */ 140 | libusb_exit(ctx); 141 | /* Destroy the default context */ 142 | libusb_exit(NULL); 143 | } 144 | 145 | return TEST_STATUS_SUCCESS; 146 | } 147 | 148 | /* Fill in the list of tests. */ 149 | static const libusbx_testlib_test tests[] = { 150 | {"init_and_exit", &test_init_and_exit}, 151 | {"get_device_list", &test_get_device_list}, 152 | {"many_device_lists", &test_many_device_lists}, 153 | {"default_context_change", &test_default_context_change}, 154 | LIBUSBX_NULL_TEST 155 | }; 156 | 157 | int main (int argc, char ** argv) 158 | { 159 | return libusbx_testlib_run_tests(argc, argv, tests); 160 | } 161 | --------------------------------------------------------------------------------