usb 2.1.2 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +20 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/usb/bindings.d.ts +4 -0
- package/dist/usb/device.js +5 -0
- package/dist/usb/device.js.map +1 -1
- package/dist/usb/index.js +7 -16
- package/dist/usb/index.js.map +1 -1
- package/dist/webusb/webusb-device.d.ts +2 -1
- package/dist/webusb/webusb-device.js +21 -14
- package/dist/webusb/webusb-device.js.map +1 -1
- package/libusb/.gitattributes +2 -6
- package/libusb/.private/appveyor_build.sh +22 -0
- package/libusb/.private/bm.sh +1 -1
- package/libusb/.private/ci-build.sh +67 -0
- package/libusb/.private/ci-container-build.sh +70 -0
- package/libusb/.private/post-rewrite.sh +5 -1
- package/libusb/.private/pre-commit.sh +5 -1
- package/libusb/.private/wbs.txt +4 -19
- package/libusb/.travis.yml +32 -23
- package/libusb/AUTHORS +86 -3
- package/libusb/ChangeLog +54 -3
- package/libusb/INSTALL_WIN.txt +22 -44
- package/libusb/Makefile.am +32 -10
- package/libusb/{README.md → README} +2 -2
- package/libusb/README.git +3 -3
- package/libusb/Xcode/common.xcconfig +23 -19
- package/libusb/Xcode/config.h +25 -13
- package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +511 -109
- package/libusb/android/README +90 -54
- package/libusb/android/config.h +23 -43
- package/libusb/android/examples/unrooted_android.c +300 -0
- package/libusb/android/examples/unrooted_android.h +36 -0
- package/libusb/android/jni/Android.mk +1 -1
- package/libusb/android/jni/Application.mk +16 -0
- package/libusb/android/jni/examples.mk +63 -29
- package/libusb/android/jni/libusb.mk +14 -8
- package/libusb/android/jni/tests.mk +13 -24
- package/libusb/appveyor.yml +73 -30
- package/libusb/autogen.sh +5 -3
- package/libusb/bootstrap.sh +6 -2
- package/libusb/configure.ac +314 -227
- package/libusb/doc/Makefile.in +22 -0
- package/libusb/doc/doxygen.cfg.in +460 -223
- package/libusb/examples/Makefile.am +6 -13
- package/libusb/examples/dpfp.c +276 -73
- package/libusb/examples/ezusb.c +18 -8
- package/libusb/examples/ezusb.h +6 -17
- package/libusb/examples/fxload.c +4 -5
- package/libusb/examples/hotplugtest.c +1 -1
- package/libusb/examples/sam3u_benchmark.c +59 -24
- package/libusb/examples/testlibusb.c +138 -104
- package/libusb/examples/xusb.c +26 -22
- package/libusb/libusb/Makefile.am +57 -70
- package/libusb/libusb/Makefile.am.extra +26 -0
- package/libusb/libusb/core.c +432 -423
- package/libusb/libusb/descriptor.c +365 -419
- package/libusb/libusb/hotplug.c +200 -104
- package/libusb/libusb/io.c +522 -535
- package/libusb/libusb/libusb-1.0.def +7 -3
- package/libusb/libusb/libusb-1.0.rc +1 -9
- package/libusb/libusb/libusb.h +302 -226
- package/libusb/libusb/libusbi.h +607 -316
- package/libusb/libusb/os/darwin_usb.c +703 -329
- package/libusb/libusb/os/darwin_usb.h +39 -15
- package/libusb/libusb/os/events_posix.c +300 -0
- package/libusb/libusb/os/events_posix.h +59 -0
- package/libusb/libusb/os/events_windows.c +214 -0
- package/libusb/{msvc/missing.h → libusb/os/events_windows.h} +25 -11
- package/libusb/libusb/os/haiku_pollfs.cpp +14 -9
- package/libusb/libusb/os/haiku_usb.h +12 -12
- package/libusb/libusb/os/haiku_usb_backend.cpp +36 -37
- package/libusb/libusb/os/haiku_usb_raw.cpp +80 -116
- package/libusb/libusb/os/linux_netlink.c +55 -63
- package/libusb/libusb/os/linux_udev.c +61 -69
- package/libusb/libusb/os/linux_usbfs.c +926 -1015
- package/libusb/libusb/os/linux_usbfs.h +74 -57
- package/libusb/libusb/os/netbsd_usb.c +103 -168
- package/libusb/libusb/os/null_usb.c +111 -0
- package/libusb/libusb/os/openbsd_usb.c +71 -120
- package/libusb/libusb/os/sunos_usb.c +289 -375
- package/libusb/libusb/os/sunos_usb.h +0 -1
- package/libusb/libusb/os/threads_posix.c +81 -32
- package/libusb/libusb/os/threads_posix.h +19 -23
- package/libusb/libusb/os/threads_windows.c +9 -95
- package/libusb/libusb/os/threads_windows.h +33 -31
- package/libusb/libusb/os/windows_common.c +915 -0
- package/libusb/libusb/os/windows_common.h +330 -42
- package/libusb/libusb/os/windows_usbdk.c +161 -267
- package/libusb/libusb/os/windows_usbdk.h +5 -2
- package/libusb/libusb/os/windows_winusb.c +1355 -1192
- package/libusb/libusb/os/windows_winusb.h +167 -167
- package/libusb/libusb/strerror.c +20 -30
- package/libusb/libusb/sync.c +20 -21
- package/libusb/libusb/version.h +1 -1
- package/libusb/libusb/version_nano.h +1 -1
- package/libusb/msvc/.gitattributes +3 -0
- package/libusb/msvc/config.h +27 -20
- package/libusb/msvc/{hotplugtest_2012.vcxproj → dpfp_2013.vcxproj} +14 -10
- package/libusb/msvc/dpfp_2013.vcxproj.filters +26 -0
- package/libusb/msvc/{listdevs_2010.vcxproj → dpfp_2015.vcxproj} +14 -9
- package/libusb/msvc/dpfp_2015.vcxproj.filters +26 -0
- package/libusb/msvc/dpfp_2017.vcxproj +106 -0
- package/libusb/msvc/dpfp_2017.vcxproj.filters +26 -0
- package/libusb/msvc/dpfp_2019.vcxproj +106 -0
- package/libusb/msvc/dpfp_2019.vcxproj.filters +26 -0
- package/libusb/msvc/dpfp_threaded_2013.vcxproj +87 -0
- package/libusb/msvc/dpfp_threaded_2013.vcxproj.filters +26 -0
- package/libusb/msvc/dpfp_threaded_2015.vcxproj +87 -0
- package/libusb/msvc/dpfp_threaded_2015.vcxproj.filters +26 -0
- package/libusb/msvc/dpfp_threaded_2017.vcxproj +106 -0
- package/libusb/msvc/dpfp_threaded_2017.vcxproj.filters +26 -0
- package/libusb/msvc/{fxload_2012.vcxproj → dpfp_threaded_2019.vcxproj} +32 -17
- package/libusb/msvc/dpfp_threaded_2019.vcxproj.filters +26 -0
- package/libusb/msvc/fxload_2013.vcxproj +6 -3
- package/libusb/msvc/fxload_2013.vcxproj.filters +35 -0
- package/libusb/msvc/fxload_2015.vcxproj +6 -3
- package/libusb/msvc/fxload_2015.vcxproj.filters +35 -0
- package/libusb/msvc/fxload_2017.vcxproj +6 -7
- package/libusb/msvc/fxload_2017.vcxproj.filters +35 -0
- package/libusb/msvc/{fxload_2010.vcxproj → fxload_2019.vcxproj} +29 -6
- package/libusb/msvc/fxload_2019.vcxproj.filters +35 -0
- package/libusb/{examples → msvc}/getopt/getopt.c +0 -0
- package/libusb/{examples → msvc}/getopt/getopt.h +0 -0
- package/libusb/{examples → msvc}/getopt/getopt1.c +0 -0
- package/libusb/msvc/getopt_2013.vcxproj +4 -5
- package/libusb/msvc/getopt_2013.vcxproj.filters +26 -0
- package/libusb/msvc/getopt_2015.vcxproj +4 -4
- package/libusb/msvc/getopt_2015.vcxproj.filters +26 -0
- package/libusb/msvc/getopt_2017.vcxproj +4 -10
- package/libusb/msvc/getopt_2017.vcxproj.filters +26 -0
- package/libusb/msvc/{getopt_2012.vcxproj → getopt_2019.vcxproj} +25 -6
- package/libusb/msvc/getopt_2019.vcxproj.filters +26 -0
- package/libusb/msvc/hotplugtest_2013.vcxproj +6 -3
- package/libusb/msvc/hotplugtest_2013.vcxproj.filters +23 -0
- package/libusb/msvc/hotplugtest_2015.vcxproj +6 -3
- package/libusb/msvc/hotplugtest_2015.vcxproj.filters +23 -0
- package/libusb/msvc/hotplugtest_2017.vcxproj +6 -7
- package/libusb/msvc/hotplugtest_2017.vcxproj.filters +23 -0
- package/libusb/msvc/hotplugtest_2019.vcxproj +105 -0
- package/libusb/msvc/hotplugtest_2019.vcxproj.filters +23 -0
- package/libusb/msvc/libusb_2013.sln +50 -20
- package/libusb/msvc/libusb_2015.sln +51 -21
- package/libusb/msvc/libusb_2017.sln +90 -36
- package/libusb/msvc/libusb_2019.sln +240 -0
- package/libusb/msvc/libusb_dll_2013.vcxproj +6 -9
- package/libusb/msvc/libusb_dll_2013.vcxproj.filters +94 -0
- package/libusb/msvc/libusb_dll_2015.vcxproj +6 -8
- package/libusb/msvc/libusb_dll_2015.vcxproj.filters +94 -0
- package/libusb/msvc/libusb_dll_2017.vcxproj +6 -16
- package/libusb/msvc/libusb_dll_2017.vcxproj.filters +94 -0
- package/libusb/msvc/{libusb_dll_2010.vcxproj → libusb_dll_2019.vcxproj} +27 -9
- package/libusb/msvc/libusb_dll_2019.vcxproj.filters +94 -0
- package/libusb/msvc/libusb_static_2013.vcxproj +5 -9
- package/libusb/msvc/libusb_static_2013.vcxproj.filters +80 -0
- package/libusb/msvc/libusb_static_2015.vcxproj +5 -8
- package/libusb/msvc/libusb_static_2015.vcxproj.filters +80 -0
- package/libusb/msvc/libusb_static_2017.vcxproj +5 -8
- package/libusb/msvc/libusb_static_2017.vcxproj.filters +80 -0
- package/libusb/msvc/{libusb_static_2010.vcxproj → libusb_static_2019.vcxproj} +26 -9
- package/libusb/msvc/libusb_static_2019.vcxproj.filters +80 -0
- package/libusb/msvc/listdevs_2013.vcxproj +6 -3
- package/libusb/msvc/listdevs_2013.vcxproj.filters +23 -0
- package/libusb/msvc/listdevs_2015.vcxproj +6 -3
- package/libusb/msvc/listdevs_2015.vcxproj.filters +23 -0
- package/libusb/msvc/listdevs_2017.vcxproj +6 -7
- package/libusb/msvc/listdevs_2017.vcxproj.filters +23 -0
- package/libusb/msvc/listdevs_2019.vcxproj +105 -0
- package/libusb/msvc/listdevs_2019.vcxproj.filters +23 -0
- package/libusb/msvc/{listdevs_2012.vcxproj → sam3u_benchmark_2013.vcxproj} +13 -9
- package/libusb/msvc/sam3u_benchmark_2013.vcxproj.filters +26 -0
- package/libusb/msvc/{hotplugtest_2010.vcxproj → sam3u_benchmark_2015.vcxproj} +13 -8
- package/libusb/msvc/sam3u_benchmark_2015.vcxproj.filters +26 -0
- package/libusb/msvc/sam3u_benchmark_2017.vcxproj +106 -0
- package/libusb/msvc/sam3u_benchmark_2017.vcxproj.filters +26 -0
- package/libusb/msvc/sam3u_benchmark_2019.vcxproj +106 -0
- package/libusb/msvc/sam3u_benchmark_2019.vcxproj.filters +26 -0
- package/libusb/msvc/stress_2013.vcxproj +4 -2
- package/libusb/msvc/stress_2013.vcxproj.filters +32 -0
- package/libusb/msvc/stress_2015.vcxproj +4 -2
- package/libusb/msvc/stress_2015.vcxproj.filters +32 -0
- package/libusb/msvc/stress_2017.vcxproj +4 -6
- package/libusb/msvc/stress_2017.vcxproj.filters +32 -0
- package/libusb/msvc/{stress_2010.vcxproj → stress_2019.vcxproj} +26 -4
- package/libusb/msvc/stress_2019.vcxproj.filters +32 -0
- package/libusb/msvc/testlibusb_2013.vcxproj +6 -3
- package/libusb/msvc/testlibusb_2013.vcxproj.filters +23 -0
- package/libusb/msvc/testlibusb_2015.vcxproj +6 -3
- package/libusb/msvc/testlibusb_2015.vcxproj.filters +23 -0
- package/libusb/msvc/testlibusb_2017.vcxproj +6 -7
- package/libusb/msvc/testlibusb_2017.vcxproj.filters +23 -0
- package/libusb/msvc/{testlibusb_2010.vcxproj → testlibusb_2019.vcxproj} +28 -5
- package/libusb/msvc/testlibusb_2019.vcxproj.filters +23 -0
- package/libusb/msvc/xusb_2013.vcxproj +6 -3
- package/libusb/msvc/xusb_2013.vcxproj.filters +23 -0
- package/libusb/msvc/xusb_2015.vcxproj +6 -3
- package/libusb/msvc/xusb_2015.vcxproj.filters +23 -0
- package/libusb/msvc/xusb_2017.vcxproj +6 -7
- package/libusb/msvc/xusb_2017.vcxproj.filters +23 -0
- package/libusb/msvc/{xusb_2010.vcxproj → xusb_2019.vcxproj} +28 -5
- package/libusb/msvc/xusb_2019.vcxproj.filters +23 -0
- package/libusb/tests/Makefile.am +13 -1
- package/libusb/tests/libusb_testlib.h +12 -43
- package/libusb/tests/stress.c +59 -50
- package/libusb/tests/testlib.c +78 -171
- package/libusb/tests/umockdev.c +1175 -0
- package/libusb.gypi +10 -11
- package/package.json +2 -2
- package/prebuilds/android-arm/node.napi.armv7.node +0 -0
- package/prebuilds/android-arm64/node.napi.armv8.node +0 -0
- package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
- package/prebuilds/linux-arm/node.napi.armv6.node +0 -0
- package/prebuilds/linux-arm/node.napi.armv7.node +0 -0
- package/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
- package/prebuilds/linux-ia32/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
- package/prebuilds/linux-x64/node.napi.musl.node +0 -0
- package/prebuilds/win32-ia32/node.napi.node +0 -0
- package/prebuilds/win32-x64/node.napi.node +0 -0
- package/src/device.cc +12 -7
- package/src/node_usb.cc +10 -0
- package/test/usb.coffee +6 -0
- package/tsc/index.ts +2 -0
- package/tsc/usb/bindings.ts +5 -0
- package/tsc/usb/device.ts +6 -0
- package/tsc/usb/index.ts +5 -8
- package/tsc/webusb/webusb-device.ts +12 -8
- package/libusb/.private/bd.cmd +0 -89
- package/libusb/.private/bwince.cmd +0 -57
- package/libusb/.private/wbs_wince.txt +0 -42
- package/libusb/Brewfile +0 -4
- package/libusb/appveyor_cygwin.bat +0 -11
- package/libusb/appveyor_minGW.bat +0 -19
- package/libusb/doc/Makefile.am +0 -9
- package/libusb/examples/dpfp_threaded.c +0 -557
- package/libusb/libusb/hotplug.h +0 -99
- package/libusb/libusb/os/poll_posix.c +0 -84
- package/libusb/libusb/os/poll_posix.h +0 -14
- package/libusb/libusb/os/poll_windows.c +0 -447
- package/libusb/libusb/os/poll_windows.h +0 -98
- package/libusb/libusb/os/wince_usb.c +0 -888
- package/libusb/libusb/os/wince_usb.h +0 -126
- package/libusb/libusb/os/windows_nt_common.c +0 -1010
- package/libusb/libusb/os/windows_nt_common.h +0 -110
- package/libusb/libusb/os/windows_nt_shared_types.h +0 -147
- package/libusb/msvc/appveyor.bat +0 -27
- package/libusb/msvc/ddk_build.cmd +0 -219
- package/libusb/msvc/errno.h +0 -102
- package/libusb/msvc/fxload_sources +0 -23
- package/libusb/msvc/getopt_2005.vcproj +0 -288
- package/libusb/msvc/getopt_2010.vcxproj +0 -72
- package/libusb/msvc/getopt_sources +0 -24
- package/libusb/msvc/hotplugtest_sources +0 -20
- package/libusb/msvc/inttypes.h +0 -295
- package/libusb/msvc/libusb.dsw +0 -71
- package/libusb/msvc/libusb_2005.sln +0 -95
- package/libusb/msvc/libusb_2010.sln +0 -105
- package/libusb/msvc/libusb_2012.sln +0 -105
- package/libusb/msvc/libusb_dll.dsp +0 -194
- package/libusb/msvc/libusb_dll_2005.vcproj +0 -464
- package/libusb/msvc/libusb_dll_2012.vcxproj +0 -107
- package/libusb/msvc/libusb_dll_wince.vcproj +0 -1251
- package/libusb/msvc/libusb_sources +0 -43
- package/libusb/msvc/libusb_static.dsp +0 -174
- package/libusb/msvc/libusb_static_2005.vcproj +0 -390
- package/libusb/msvc/libusb_static_2012.vcxproj +0 -98
- package/libusb/msvc/libusb_static_wince.vcproj +0 -1179
- package/libusb/msvc/libusb_wince.sln +0 -246
- package/libusb/msvc/listdevs.dsp +0 -103
- package/libusb/msvc/listdevs_2005.vcproj +0 -360
- package/libusb/msvc/listdevs_sources +0 -20
- package/libusb/msvc/listdevs_wince.vcproj +0 -1120
- package/libusb/msvc/missing.c +0 -80
- package/libusb/msvc/stdint.h +0 -256
- package/libusb/msvc/stress_2005.vcproj +0 -390
- package/libusb/msvc/stress_2012.vcxproj +0 -87
- package/libusb/msvc/stress_sources +0 -21
- package/libusb/msvc/stress_wince.vcproj +0 -1128
- package/libusb/msvc/testlibusb_2012.vcxproj +0 -83
- package/libusb/msvc/testlibusb_sources +0 -20
- package/libusb/msvc/xusb.dsp +0 -102
- package/libusb/msvc/xusb_2005.vcproj +0 -344
- package/libusb/msvc/xusb_2012.vcxproj +0 -83
- package/libusb/msvc/xusb_sources +0 -20
- package/libusb/msvc/xusb_wince.vcproj +0 -1120
- package/libusb/travis-autogen.sh +0 -39
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<Project DefaultTargets="Build" ToolsVersion="
|
|
2
|
+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
3
|
<ItemGroup Label="ProjectConfigurations">
|
|
4
|
+
<ProjectConfiguration Include="Debug|ARM">
|
|
5
|
+
<Configuration>Debug</Configuration>
|
|
6
|
+
<Platform>ARM</Platform>
|
|
7
|
+
</ProjectConfiguration>
|
|
8
|
+
<ProjectConfiguration Include="Debug|ARM64">
|
|
9
|
+
<Configuration>Debug</Configuration>
|
|
10
|
+
<Platform>ARM64</Platform>
|
|
11
|
+
</ProjectConfiguration>
|
|
4
12
|
<ProjectConfiguration Include="Debug|Win32">
|
|
5
13
|
<Configuration>Debug</Configuration>
|
|
6
14
|
<Platform>Win32</Platform>
|
|
@@ -9,6 +17,14 @@
|
|
|
9
17
|
<Configuration>Debug</Configuration>
|
|
10
18
|
<Platform>x64</Platform>
|
|
11
19
|
</ProjectConfiguration>
|
|
20
|
+
<ProjectConfiguration Include="Release|ARM">
|
|
21
|
+
<Configuration>Release</Configuration>
|
|
22
|
+
<Platform>ARM</Platform>
|
|
23
|
+
</ProjectConfiguration>
|
|
24
|
+
<ProjectConfiguration Include="Release|ARM64">
|
|
25
|
+
<Configuration>Release</Configuration>
|
|
26
|
+
<Platform>ARM64</Platform>
|
|
27
|
+
</ProjectConfiguration>
|
|
12
28
|
<ProjectConfiguration Include="Release|Win32">
|
|
13
29
|
<Configuration>Release</Configuration>
|
|
14
30
|
<Platform>Win32</Platform>
|
|
@@ -23,11 +39,15 @@
|
|
|
23
39
|
<ProjectGuid>{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}</ProjectGuid>
|
|
24
40
|
<RootNamespace>examples</RootNamespace>
|
|
25
41
|
<Keyword>Win32Proj</Keyword>
|
|
42
|
+
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
|
|
43
|
+
<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
|
|
44
|
+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
|
26
45
|
</PropertyGroup>
|
|
27
46
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
28
47
|
<PropertyGroup Label="Configuration">
|
|
29
48
|
<ConfigurationType>Application</ConfigurationType>
|
|
30
49
|
<CharacterSet>Unicode</CharacterSet>
|
|
50
|
+
<PlatformToolset>v142</PlatformToolset>
|
|
31
51
|
<WholeProgramOptimization Condition="'$(Configuration)'=='Release'">true</WholeProgramOptimization>
|
|
32
52
|
</PropertyGroup>
|
|
33
53
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
@@ -45,14 +65,13 @@
|
|
|
45
65
|
<ItemDefinitionGroup>
|
|
46
66
|
<ClCompile>
|
|
47
67
|
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
|
48
|
-
<AdditionalIncludeDirectories
|
|
68
|
+
<AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
49
69
|
<PreprocessorDefinitions>_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
50
70
|
<WarningLevel>Level3</WarningLevel>
|
|
51
71
|
</ClCompile>
|
|
52
72
|
<ClCompile Condition="'$(Configuration)'=='Debug'">
|
|
53
73
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
|
54
74
|
<Optimization>Disabled</Optimization>
|
|
55
|
-
<MinimalRebuild>true</MinimalRebuild>
|
|
56
75
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
|
57
76
|
</ClCompile>
|
|
58
77
|
<ClCompile Condition="'$(Configuration)'=='Release'">
|
|
@@ -62,6 +81,7 @@
|
|
|
62
81
|
<Link>
|
|
63
82
|
<ProgramDatabaseFile>$(TargetDir)$(ProjectName).pdb</ProgramDatabaseFile>
|
|
64
83
|
<SubSystem>Console</SubSystem>
|
|
84
|
+
<AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
65
85
|
</Link>
|
|
66
86
|
<Link Condition="'$(Configuration)'=='Debug'">
|
|
67
87
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
@@ -71,7 +91,10 @@
|
|
|
71
91
|
<ClCompile Include="..\examples\xusb.c" />
|
|
72
92
|
</ItemGroup>
|
|
73
93
|
<ItemGroup>
|
|
74
|
-
<
|
|
94
|
+
<ClInclude Include="..\libusb\libusb.h" />
|
|
95
|
+
</ItemGroup>
|
|
96
|
+
<ItemGroup>
|
|
97
|
+
<ProjectReference Include=".\libusb_static_2019.vcxproj">
|
|
75
98
|
<Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
|
|
76
99
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
|
77
100
|
</ProjectReference>
|
|
@@ -79,4 +102,4 @@
|
|
|
79
102
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
80
103
|
<ImportGroup Label="ExtensionTargets">
|
|
81
104
|
</ImportGroup>
|
|
82
|
-
</Project>
|
|
105
|
+
</Project>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
<ItemGroup>
|
|
4
|
+
<Filter Include="Source Files">
|
|
5
|
+
<UniqueIdentifier>{4bdcefa9-8c79-431b-965b-15b234737380}</UniqueIdentifier>
|
|
6
|
+
<Extensions>c</Extensions>
|
|
7
|
+
</Filter>
|
|
8
|
+
<Filter Include="Header Files">
|
|
9
|
+
<UniqueIdentifier>{f81e24cd-e12b-4324-ada3-accbab00ef08}</UniqueIdentifier>
|
|
10
|
+
<Extensions>h</Extensions>
|
|
11
|
+
</Filter>
|
|
12
|
+
</ItemGroup>
|
|
13
|
+
<ItemGroup>
|
|
14
|
+
<ClInclude Include="..\libusb\libusb.h">
|
|
15
|
+
<Filter>Header Files</Filter>
|
|
16
|
+
</ClInclude>
|
|
17
|
+
</ItemGroup>
|
|
18
|
+
<ItemGroup>
|
|
19
|
+
<ClCompile Include="..\examples\xusb.c">
|
|
20
|
+
<Filter>Source Files</Filter>
|
|
21
|
+
</ClCompile>
|
|
22
|
+
</ItemGroup>
|
|
23
|
+
</Project>
|
package/libusb/tests/Makefile.am
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
AM_CPPFLAGS = -I$(top_srcdir)/libusb
|
|
2
2
|
LDADD = ../libusb/libusb-1.0.la
|
|
3
|
+
LIBS =
|
|
4
|
+
|
|
5
|
+
stress_SOURCES = stress.c libusb_testlib.h testlib.c
|
|
3
6
|
|
|
4
7
|
noinst_PROGRAMS = stress
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
if BUILD_UMOCKDEV_TEST
|
|
10
|
+
# NOTE: We add libumockdev-preload.so so that we can run tests in-process
|
|
11
|
+
# We also use -Wl,-lxxx as the compiler doesn't need it and libtool
|
|
12
|
+
# would reorder the flags otherwise.
|
|
13
|
+
umockdev_CPPFLAGS = ${UMOCKDEV_CFLAGS} -I$(top_srcdir)/libusb
|
|
14
|
+
umockdev_LDFLAGS = -Wl,--push-state,--no-as-needed -Wl,-lumockdev-preload -Wl,--pop-state ${UMOCKDEV_LIBS}
|
|
15
|
+
umockdev_SOURCES = umockdev.c
|
|
16
|
+
|
|
17
|
+
noinst_PROGRAMS += umockdev
|
|
18
|
+
endif
|
|
@@ -20,17 +20,7 @@
|
|
|
20
20
|
#ifndef LIBUSB_TESTLIB_H
|
|
21
21
|
#define LIBUSB_TESTLIB_H
|
|
22
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
|
|
23
|
+
#include <config.h>
|
|
34
24
|
|
|
35
25
|
/** Values returned from a test function to indicate test result */
|
|
36
26
|
typedef enum {
|
|
@@ -41,53 +31,33 @@ typedef enum {
|
|
|
41
31
|
/** Indicates that an unexpected error occurred. */
|
|
42
32
|
TEST_STATUS_ERROR,
|
|
43
33
|
/** Indicates that the test can't be run. For example this may be
|
|
44
|
-
|
|
34
|
+
* due to no suitable device being connected to perform the tests. */
|
|
45
35
|
TEST_STATUS_SKIP
|
|
46
36
|
} libusb_testlib_result;
|
|
47
37
|
|
|
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
|
-
} libusb_testlib_ctx;
|
|
61
|
-
|
|
62
38
|
/**
|
|
63
39
|
* Logs some test information or state
|
|
64
40
|
*/
|
|
65
|
-
void libusb_testlib_logf(
|
|
66
|
-
const char* fmt, ...);
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Function pointer for a libusb test function.
|
|
70
|
-
*
|
|
71
|
-
* Should return TEST_STATUS_SUCCESS on success or another TEST_STATUS value.
|
|
72
|
-
*/
|
|
73
|
-
typedef libusb_testlib_result
|
|
74
|
-
(*libusb_testlib_test_function)(libusb_testlib_ctx * ctx);
|
|
41
|
+
void libusb_testlib_logf(const char *fmt, ...) PRINTF_FORMAT(1, 2);
|
|
75
42
|
|
|
76
43
|
/**
|
|
77
44
|
* Structure holding a test description.
|
|
78
45
|
*/
|
|
79
46
|
typedef struct {
|
|
80
47
|
/** Human readable name of the test. */
|
|
81
|
-
const char *
|
|
82
|
-
/** The test library will call this function to run the test.
|
|
83
|
-
|
|
48
|
+
const char *name;
|
|
49
|
+
/** The test library will call this function to run the test.
|
|
50
|
+
*
|
|
51
|
+
* Should return TEST_STATUS_SUCCESS on success or another TEST_STATUS value.
|
|
52
|
+
*/
|
|
53
|
+
libusb_testlib_result (*function)(void);
|
|
84
54
|
} libusb_testlib_test;
|
|
85
55
|
|
|
86
56
|
/**
|
|
87
57
|
* Value to use at the end of a test array to indicate the last
|
|
88
58
|
* element.
|
|
89
59
|
*/
|
|
90
|
-
#define LIBUSB_NULL_TEST {NULL, NULL}
|
|
60
|
+
#define LIBUSB_NULL_TEST { NULL, NULL }
|
|
91
61
|
|
|
92
62
|
/**
|
|
93
63
|
* Runs the tests provided.
|
|
@@ -100,8 +70,7 @@ typedef struct {
|
|
|
100
70
|
* \param tests A NULL_TEST terminated array of tests
|
|
101
71
|
* \return 0 on success, non-zero on failure
|
|
102
72
|
*/
|
|
103
|
-
int libusb_testlib_run_tests(int argc,
|
|
104
|
-
|
|
105
|
-
const libusb_testlib_test * tests);
|
|
73
|
+
int libusb_testlib_run_tests(int argc, char *argv[],
|
|
74
|
+
const libusb_testlib_test *tests);
|
|
106
75
|
|
|
107
76
|
#endif //LIBUSB_TESTLIB_H
|
package/libusb/tests/stress.c
CHANGED
|
@@ -17,122 +17,131 @@
|
|
|
17
17
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
#include <
|
|
20
|
+
#include <config.h>
|
|
21
|
+
|
|
21
22
|
#include <string.h>
|
|
22
|
-
#include <memory.h>
|
|
23
23
|
|
|
24
24
|
#include "libusb.h"
|
|
25
25
|
#include "libusb_testlib.h"
|
|
26
26
|
|
|
27
27
|
/** Test that creates and destroys a single concurrent context
|
|
28
28
|
* 10000 times. */
|
|
29
|
-
static libusb_testlib_result test_init_and_exit(
|
|
29
|
+
static libusb_testlib_result test_init_and_exit(void)
|
|
30
30
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
for (int i = 0; i < 10000; ++i) {
|
|
32
|
+
libusb_context *ctx = NULL;
|
|
33
|
+
int r;
|
|
34
|
+
|
|
35
|
+
r = libusb_init(&ctx);
|
|
35
36
|
if (r != LIBUSB_SUCCESS) {
|
|
36
|
-
libusb_testlib_logf(
|
|
37
|
+
libusb_testlib_logf(
|
|
37
38
|
"Failed to init libusb on iteration %d: %d",
|
|
38
39
|
i, r);
|
|
39
40
|
return TEST_STATUS_FAILURE;
|
|
40
41
|
}
|
|
41
42
|
libusb_exit(ctx);
|
|
42
|
-
ctx = NULL;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
return TEST_STATUS_SUCCESS;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/** Tests that devices can be listed 1000 times. */
|
|
49
|
-
static libusb_testlib_result test_get_device_list(
|
|
49
|
+
static libusb_testlib_result test_get_device_list(void)
|
|
50
50
|
{
|
|
51
|
-
libusb_context *
|
|
52
|
-
int r
|
|
51
|
+
libusb_context *ctx;
|
|
52
|
+
int r;
|
|
53
|
+
|
|
53
54
|
r = libusb_init(&ctx);
|
|
54
55
|
if (r != LIBUSB_SUCCESS) {
|
|
55
|
-
libusb_testlib_logf(
|
|
56
|
+
libusb_testlib_logf("Failed to init libusb: %d", r);
|
|
56
57
|
return TEST_STATUS_FAILURE;
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
|
|
60
|
+
for (int i = 0; i < 1000; ++i) {
|
|
61
|
+
libusb_device **device_list = NULL;
|
|
60
62
|
ssize_t list_size = libusb_get_device_list(ctx, &device_list);
|
|
61
|
-
if (list_size < 0 || device_list
|
|
62
|
-
libusb_testlib_logf(
|
|
63
|
-
"Failed to get device list on iteration %d: %
|
|
64
|
-
i, -list_size, device_list);
|
|
63
|
+
if (list_size < 0 || !device_list) {
|
|
64
|
+
libusb_testlib_logf(
|
|
65
|
+
"Failed to get device list on iteration %d: %ld (%p)",
|
|
66
|
+
i, (long)-list_size, device_list);
|
|
67
|
+
libusb_exit(ctx);
|
|
65
68
|
return TEST_STATUS_FAILURE;
|
|
66
69
|
}
|
|
67
70
|
libusb_free_device_list(device_list, 1);
|
|
68
71
|
}
|
|
72
|
+
|
|
69
73
|
libusb_exit(ctx);
|
|
70
74
|
return TEST_STATUS_SUCCESS;
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
/** Tests that 100 concurrent device lists can be open at a time. */
|
|
74
|
-
static libusb_testlib_result test_many_device_lists(
|
|
78
|
+
static libusb_testlib_result test_many_device_lists(void)
|
|
75
79
|
{
|
|
76
80
|
#define LIST_COUNT 100
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
libusb_testlib_result result = TEST_STATUS_SUCCESS;
|
|
82
|
+
libusb_context *ctx = NULL;
|
|
83
|
+
libusb_device **device_lists[LIST_COUNT];
|
|
84
|
+
int r;
|
|
81
85
|
|
|
82
86
|
r = libusb_init(&ctx);
|
|
83
87
|
if (r != LIBUSB_SUCCESS) {
|
|
84
|
-
libusb_testlib_logf(
|
|
88
|
+
libusb_testlib_logf("Failed to init libusb: %d", r);
|
|
85
89
|
return TEST_STATUS_FAILURE;
|
|
86
90
|
}
|
|
87
91
|
|
|
92
|
+
memset(device_lists, 0, sizeof(device_lists));
|
|
93
|
+
|
|
88
94
|
/* Create the 100 device lists. */
|
|
89
|
-
for (i = 0; i < LIST_COUNT; ++i) {
|
|
90
|
-
ssize_t list_size = libusb_get_device_list(ctx, &
|
|
91
|
-
if (list_size < 0 || device_lists[i]
|
|
92
|
-
libusb_testlib_logf(
|
|
93
|
-
"Failed to get device list on iteration %d: %
|
|
94
|
-
i, -list_size, device_lists[i]);
|
|
95
|
-
|
|
95
|
+
for (int i = 0; i < LIST_COUNT; ++i) {
|
|
96
|
+
ssize_t list_size = libusb_get_device_list(ctx, &device_lists[i]);
|
|
97
|
+
if (list_size < 0 || !device_lists[i]) {
|
|
98
|
+
libusb_testlib_logf(
|
|
99
|
+
"Failed to get device list on iteration %d: %ld (%p)",
|
|
100
|
+
i, (long)-list_size, device_lists[i]);
|
|
101
|
+
result = TEST_STATUS_FAILURE;
|
|
102
|
+
break;
|
|
96
103
|
}
|
|
97
104
|
}
|
|
98
105
|
|
|
99
106
|
/* Destroy the 100 device lists. */
|
|
100
|
-
for (i = 0; i < LIST_COUNT; ++i) {
|
|
101
|
-
if (device_lists[i])
|
|
107
|
+
for (int i = 0; i < LIST_COUNT; ++i) {
|
|
108
|
+
if (device_lists[i])
|
|
102
109
|
libusb_free_device_list(device_lists[i], 1);
|
|
103
|
-
device_lists[i] = NULL;
|
|
104
|
-
}
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
libusb_exit(ctx);
|
|
108
|
-
return
|
|
113
|
+
return result;
|
|
109
114
|
#undef LIST_COUNT
|
|
110
115
|
}
|
|
111
116
|
|
|
112
117
|
/** Tests that the default context (used for various things including
|
|
113
118
|
* logging) works correctly when the first context created in a
|
|
114
119
|
* process is destroyed. */
|
|
115
|
-
static libusb_testlib_result test_default_context_change(
|
|
120
|
+
static libusb_testlib_result test_default_context_change(void)
|
|
116
121
|
{
|
|
117
|
-
|
|
118
|
-
|
|
122
|
+
for (int i = 0; i < 100; ++i) {
|
|
123
|
+
libusb_context *ctx = NULL;
|
|
124
|
+
int r;
|
|
119
125
|
|
|
120
|
-
for (i = 0; i < 100; ++i) {
|
|
121
126
|
/* First create a new context */
|
|
122
127
|
r = libusb_init(&ctx);
|
|
123
128
|
if (r != LIBUSB_SUCCESS) {
|
|
124
|
-
libusb_testlib_logf(
|
|
129
|
+
libusb_testlib_logf("Failed to init libusb: %d", r);
|
|
125
130
|
return TEST_STATUS_FAILURE;
|
|
126
131
|
}
|
|
127
132
|
|
|
128
|
-
/* Enable debug output, to be sure to use the context */
|
|
129
|
-
libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_DEBUG);
|
|
133
|
+
/* Enable debug output on new context, to be sure to use the context */
|
|
130
134
|
libusb_set_option(ctx, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_DEBUG);
|
|
131
135
|
|
|
136
|
+
/* Enable debug output on the default context. This should work even before
|
|
137
|
+
* the context has been created. */
|
|
138
|
+
libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_DEBUG);
|
|
139
|
+
|
|
132
140
|
/* Now create a reference to the default context */
|
|
133
141
|
r = libusb_init(NULL);
|
|
134
142
|
if (r != LIBUSB_SUCCESS) {
|
|
135
|
-
libusb_testlib_logf(
|
|
143
|
+
libusb_testlib_logf("Failed to init libusb: %d", r);
|
|
144
|
+
libusb_exit(ctx);
|
|
136
145
|
return TEST_STATUS_FAILURE;
|
|
137
146
|
}
|
|
138
147
|
|
|
@@ -147,14 +156,14 @@ static libusb_testlib_result test_default_context_change(libusb_testlib_ctx * tc
|
|
|
147
156
|
|
|
148
157
|
/* Fill in the list of tests. */
|
|
149
158
|
static const libusb_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},
|
|
159
|
+
{ "init_and_exit", &test_init_and_exit },
|
|
160
|
+
{ "get_device_list", &test_get_device_list },
|
|
161
|
+
{ "many_device_lists", &test_many_device_lists },
|
|
162
|
+
{ "default_context_change", &test_default_context_change },
|
|
154
163
|
LIBUSB_NULL_TEST
|
|
155
164
|
};
|
|
156
165
|
|
|
157
|
-
int main
|
|
166
|
+
int main(int argc, char *argv[])
|
|
158
167
|
{
|
|
159
168
|
return libusb_testlib_run_tests(argc, argv, tests);
|
|
160
169
|
}
|