usb 2.17.0 → 3.0.0-alpha.2

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.
Files changed (207) hide show
  1. package/LICENSE +18 -4
  2. package/README.md +25 -516
  3. package/dist/index.d.ts +67 -13
  4. package/dist/index.js +333 -64
  5. package/index.d.ts +89 -0
  6. package/index.js +583 -0
  7. package/package.json +53 -33
  8. package/CHANGELOG.md +0 -294
  9. package/binding.gyp +0 -128
  10. package/dist/index.js.map +0 -1
  11. package/dist/usb/bindings.d.ts +0 -266
  12. package/dist/usb/bindings.js +0 -10
  13. package/dist/usb/bindings.js.map +0 -1
  14. package/dist/usb/capability.d.ts +0 -13
  15. package/dist/usb/capability.js +0 -17
  16. package/dist/usb/capability.js.map +0 -1
  17. package/dist/usb/descriptors.d.ts +0 -128
  18. package/dist/usb/descriptors.js +0 -3
  19. package/dist/usb/descriptors.js.map +0 -1
  20. package/dist/usb/device.d.ts +0 -100
  21. package/dist/usb/device.js +0 -297
  22. package/dist/usb/device.js.map +0 -1
  23. package/dist/usb/endpoint.d.ts +0 -94
  24. package/dist/usb/endpoint.js +0 -219
  25. package/dist/usb/endpoint.js.map +0 -1
  26. package/dist/usb/index.d.ts +0 -31
  27. package/dist/usb/index.js +0 -116
  28. package/dist/usb/index.js.map +0 -1
  29. package/dist/usb/interface.d.ts +0 -80
  30. package/dist/usb/interface.js +0 -133
  31. package/dist/usb/interface.js.map +0 -1
  32. package/dist/webusb/index.d.ts +0 -64
  33. package/dist/webusb/index.js +0 -295
  34. package/dist/webusb/index.js.map +0 -1
  35. package/dist/webusb/webusb-device.d.ts +0 -54
  36. package/dist/webusb/webusb-device.js +0 -434
  37. package/dist/webusb/webusb-device.js.map +0 -1
  38. package/libusb/.clang-tidy +0 -34
  39. package/libusb/.codespellrc +0 -3
  40. package/libusb/.private/README.txt +0 -5
  41. package/libusb/.private/appveyor_build.sh +0 -26
  42. package/libusb/.private/bm.sh +0 -54
  43. package/libusb/.private/ci-build.sh +0 -92
  44. package/libusb/.private/ci-container-build.sh +0 -67
  45. package/libusb/.private/post-rewrite.sh +0 -32
  46. package/libusb/.private/pre-commit.sh +0 -52
  47. package/libusb/.private/wbs.txt +0 -43
  48. package/libusb/.travis.yml +0 -58
  49. package/libusb/AUTHORS +0 -231
  50. package/libusb/COPYING +0 -504
  51. package/libusb/ChangeLog +0 -365
  52. package/libusb/HACKING +0 -25
  53. package/libusb/INSTALL_WIN.txt +0 -52
  54. package/libusb/KEYS +0 -123
  55. package/libusb/Makefile.am +0 -50
  56. package/libusb/NEWS +0 -2
  57. package/libusb/PORTING +0 -94
  58. package/libusb/README +0 -29
  59. package/libusb/README.git +0 -41
  60. package/libusb/TODO +0 -2
  61. package/libusb/Xcode/common.xcconfig +0 -92
  62. package/libusb/Xcode/config.h +0 -31
  63. package/libusb/Xcode/debug.xcconfig +0 -32
  64. package/libusb/Xcode/libusb.xcconfig +0 -21
  65. package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +0 -1391
  66. package/libusb/Xcode/libusb_debug.xcconfig +0 -21
  67. package/libusb/Xcode/libusb_release.xcconfig +0 -21
  68. package/libusb/Xcode/release.xcconfig +0 -30
  69. package/libusb/android/README +0 -152
  70. package/libusb/android/config.h +0 -55
  71. package/libusb/android/examples/unrooted_android.c +0 -301
  72. package/libusb/android/examples/unrooted_android.h +0 -36
  73. package/libusb/android/jni/Android.mk +0 -23
  74. package/libusb/android/jni/Application.mk +0 -40
  75. package/libusb/android/jni/examples.mk +0 -168
  76. package/libusb/android/jni/libusb.mk +0 -60
  77. package/libusb/android/jni/tests.mk +0 -45
  78. package/libusb/appveyor.yml +0 -108
  79. package/libusb/autogen.sh +0 -10
  80. package/libusb/bootstrap.sh +0 -10
  81. package/libusb/configure.ac +0 -450
  82. package/libusb/doc/Makefile.in +0 -22
  83. package/libusb/doc/doxygen.cfg.in +0 -2571
  84. package/libusb/doc/libusb.png +0 -0
  85. package/libusb/examples/Makefile.am +0 -12
  86. package/libusb/examples/dpfp.c +0 -711
  87. package/libusb/examples/ezusb.c +0 -846
  88. package/libusb/examples/ezusb.h +0 -109
  89. package/libusb/examples/fxload.c +0 -310
  90. package/libusb/examples/hotplugtest.c +0 -147
  91. package/libusb/examples/listdevs.c +0 -73
  92. package/libusb/examples/sam3u_benchmark.c +0 -228
  93. package/libusb/examples/testlibusb.c +0 -312
  94. package/libusb/examples/xusb.c +0 -1254
  95. package/libusb/libusb/Makefile.am +0 -98
  96. package/libusb/libusb/Makefile.am.extra +0 -26
  97. package/libusb/libusb/core.c +0 -2925
  98. package/libusb/libusb/descriptor.c +0 -1558
  99. package/libusb/libusb/hotplug.c +0 -489
  100. package/libusb/libusb/io.c +0 -2865
  101. package/libusb/libusb/libusb-1.0.def +0 -199
  102. package/libusb/libusb/libusb-1.0.rc +0 -53
  103. package/libusb/libusb/libusb.h +0 -2421
  104. package/libusb/libusb/libusbi.h +0 -1535
  105. package/libusb/libusb/os/darwin_usb.c +0 -2977
  106. package/libusb/libusb/os/darwin_usb.h +0 -156
  107. package/libusb/libusb/os/emscripten_webusb.cpp +0 -875
  108. package/libusb/libusb/os/events_posix.c +0 -340
  109. package/libusb/libusb/os/events_posix.h +0 -62
  110. package/libusb/libusb/os/events_windows.c +0 -214
  111. package/libusb/libusb/os/events_windows.h +0 -46
  112. package/libusb/libusb/os/haiku_pollfs.cpp +0 -372
  113. package/libusb/libusb/os/haiku_usb.h +0 -113
  114. package/libusb/libusb/os/haiku_usb_backend.cpp +0 -532
  115. package/libusb/libusb/os/haiku_usb_raw.cpp +0 -231
  116. package/libusb/libusb/os/haiku_usb_raw.h +0 -188
  117. package/libusb/libusb/os/linux_netlink.c +0 -401
  118. package/libusb/libusb/os/linux_udev.c +0 -321
  119. package/libusb/libusb/os/linux_usbfs.c +0 -2829
  120. package/libusb/libusb/os/linux_usbfs.h +0 -221
  121. package/libusb/libusb/os/netbsd_usb.c +0 -617
  122. package/libusb/libusb/os/null_usb.c +0 -111
  123. package/libusb/libusb/os/openbsd_usb.c +0 -700
  124. package/libusb/libusb/os/sunos_usb.c +0 -1619
  125. package/libusb/libusb/os/sunos_usb.h +0 -79
  126. package/libusb/libusb/os/threads_posix.c +0 -126
  127. package/libusb/libusb/os/threads_posix.h +0 -98
  128. package/libusb/libusb/os/threads_windows.c +0 -40
  129. package/libusb/libusb/os/threads_windows.h +0 -113
  130. package/libusb/libusb/os/windows_common.c +0 -923
  131. package/libusb/libusb/os/windows_common.h +0 -424
  132. package/libusb/libusb/os/windows_usbdk.c +0 -724
  133. package/libusb/libusb/os/windows_usbdk.h +0 -106
  134. package/libusb/libusb/os/windows_winusb.c +0 -4766
  135. package/libusb/libusb/os/windows_winusb.h +0 -787
  136. package/libusb/libusb/strerror.c +0 -223
  137. package/libusb/libusb/sync.c +0 -342
  138. package/libusb/libusb/version.h +0 -18
  139. package/libusb/libusb/version_nano.h +0 -1
  140. package/libusb/libusb-1.0.pc.in +0 -11
  141. package/libusb/msvc/Base.props +0 -60
  142. package/libusb/msvc/Configuration.Application.props +0 -7
  143. package/libusb/msvc/Configuration.Base.props +0 -47
  144. package/libusb/msvc/Configuration.DynamicLibrary.props +0 -21
  145. package/libusb/msvc/Configuration.StaticLibrary.props +0 -7
  146. package/libusb/msvc/ProjectConfigurations.Base.props +0 -69
  147. package/libusb/msvc/build_all.ps1 +0 -17
  148. package/libusb/msvc/config.h +0 -58
  149. package/libusb/msvc/dpfp.vcxproj +0 -33
  150. package/libusb/msvc/dpfp_threaded.vcxproj +0 -38
  151. package/libusb/msvc/fxload.vcxproj +0 -46
  152. package/libusb/msvc/getopt/getopt.c +0 -1060
  153. package/libusb/msvc/getopt/getopt.h +0 -180
  154. package/libusb/msvc/getopt/getopt1.c +0 -188
  155. package/libusb/msvc/getopt.vcxproj +0 -33
  156. package/libusb/msvc/hotplugtest.vcxproj +0 -32
  157. package/libusb/msvc/init_context.vcxproj +0 -35
  158. package/libusb/msvc/libusb.sln +0 -542
  159. package/libusb/msvc/libusb_dll.vcxproj +0 -61
  160. package/libusb/msvc/libusb_static.vcxproj +0 -49
  161. package/libusb/msvc/listdevs.vcxproj +0 -32
  162. package/libusb/msvc/sam3u_benchmark.vcxproj +0 -33
  163. package/libusb/msvc/set_option.vcxproj +0 -35
  164. package/libusb/msvc/stress.vcxproj +0 -35
  165. package/libusb/msvc/stress_mt.vcxproj +0 -33
  166. package/libusb/msvc/testlibusb.vcxproj +0 -32
  167. package/libusb/msvc/xusb.vcxproj +0 -38
  168. package/libusb/tests/Makefile.am +0 -40
  169. package/libusb/tests/init_context.c +0 -153
  170. package/libusb/tests/libusb_testlib.h +0 -76
  171. package/libusb/tests/macos.c +0 -130
  172. package/libusb/tests/set_option.c +0 -253
  173. package/libusb/tests/stress.c +0 -172
  174. package/libusb/tests/stress_mt.c +0 -267
  175. package/libusb/tests/testlib.c +0 -184
  176. package/libusb/tests/umockdev.c +0 -1175
  177. package/libusb/tests/webusb-test-shim/index.js +0 -12
  178. package/libusb/tests/webusb-test-shim/package-lock.json +0 -50
  179. package/libusb/tests/webusb-test-shim/package.json +0 -10
  180. package/libusb.gypi +0 -154
  181. package/libusb_config/config.h +0 -1
  182. package/prebuilds/android-arm/node.napi.armv7.node +0 -0
  183. package/prebuilds/android-arm64/node.napi.armv8.node +0 -0
  184. package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
  185. package/prebuilds/linux-arm/node.napi.armv6.node +0 -0
  186. package/prebuilds/linux-arm/node.napi.armv7.node +0 -0
  187. package/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
  188. package/prebuilds/linux-ia32/node.napi.node +0 -0
  189. package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  190. package/prebuilds/linux-x64/node.napi.musl.node +0 -0
  191. package/prebuilds/win32-arm64/node.napi.node +0 -0
  192. package/prebuilds/win32-ia32/node.napi.node +0 -0
  193. package/prebuilds/win32-x64/node.napi.node +0 -0
  194. package/src/device.cc +0 -439
  195. package/src/helpers.h +0 -64
  196. package/src/hotplug/hotplug.h +0 -22
  197. package/src/hotplug/libusb.cc +0 -90
  198. package/src/hotplug/windows.cc +0 -168
  199. package/src/node_usb.cc +0 -314
  200. package/src/node_usb.h +0 -131
  201. package/src/thread_name.cc +0 -79
  202. package/src/thread_name.h +0 -11
  203. package/src/transfer.cc +0 -143
  204. package/src/uv_async_queue.h +0 -41
  205. package/test/usb.coffee +0 -250
  206. package/test/webusb.coffee +0 -227
  207. package/test/worker.cjs +0 -13
@@ -1,49 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <Import Project="ProjectConfigurations.Base.props" />
4
- <PropertyGroup Label="Globals">
5
- <ProjectGuid>{349EE8F9-7D25-4909-AAF5-FF3FADE72187}</ProjectGuid>
6
- </PropertyGroup>
7
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
8
- <Import Project="Configuration.StaticLibrary.props" />
9
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
10
- <ImportGroup Label="ExtensionSettings">
11
- </ImportGroup>
12
- <ImportGroup Label="PropertySheets">
13
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
14
- <Import Project="Base.props" />
15
- </ImportGroup>
16
- <PropertyGroup Label="UserMacros" />
17
- <PropertyGroup>
18
- <OutDir>$(IntDir)..\lib\</OutDir>
19
- <TargetName>libusb-1.0</TargetName>
20
- </PropertyGroup>
21
- <ItemGroup>
22
- <ClCompile Include="..\libusb\core.c" />
23
- <ClCompile Include="..\libusb\descriptor.c" />
24
- <ClCompile Include="..\libusb\os\events_windows.c" />
25
- <ClCompile Include="..\libusb\hotplug.c" />
26
- <ClCompile Include="..\libusb\io.c" />
27
- <ClCompile Include="..\libusb\strerror.c" />
28
- <ClCompile Include="..\libusb\sync.c" />
29
- <ClCompile Include="..\libusb\os\threads_windows.c" />
30
- <ClCompile Include="..\libusb\os\windows_common.c" />
31
- <ClCompile Include="..\libusb\os\windows_usbdk.c" />
32
- <ClCompile Include="..\libusb\os\windows_winusb.c" />
33
- </ItemGroup>
34
- <ItemGroup>
35
- <ClInclude Include=".\config.h" />
36
- <ClInclude Include="..\libusb\os\events_windows.h" />
37
- <ClInclude Include="..\libusb\libusb.h" />
38
- <ClInclude Include="..\libusb\libusbi.h" />
39
- <ClInclude Include="..\libusb\os\threads_windows.h" />
40
- <ClInclude Include="..\libusb\version.h" />
41
- <ClInclude Include="..\libusb\version_nano.h" />
42
- <ClInclude Include="..\libusb\os\windows_common.h" />
43
- <ClInclude Include="..\libusb\os\windows_usbdk.h" />
44
- <ClInclude Include="..\libusb\os\windows_winusb.h" />
45
- </ItemGroup>
46
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
47
- <ImportGroup Label="ExtensionTargets">
48
- </ImportGroup>
49
- </Project>
@@ -1,32 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <Import Project="ProjectConfigurations.Base.props" />
4
- <PropertyGroup Label="Globals">
5
- <ProjectGuid>{F4938DB0-3DE7-4737-9C5A-EAD1BE819F87}</ProjectGuid>
6
- </PropertyGroup>
7
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
8
- <Import Project="Configuration.Application.props" />
9
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
10
- <ImportGroup Label="ExtensionSettings">
11
- </ImportGroup>
12
- <ImportGroup Label="PropertySheets">
13
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
14
- <Import Project="Base.props" />
15
- </ImportGroup>
16
- <PropertyGroup Label="UserMacros" />
17
- <ItemGroup>
18
- <ClCompile Include="..\examples\listdevs.c" />
19
- </ItemGroup>
20
- <ItemGroup>
21
- <ClInclude Include="..\libusb\libusb.h" />
22
- </ItemGroup>
23
- <ItemGroup>
24
- <ProjectReference Include=".\libusb_static.vcxproj">
25
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
26
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
27
- </ProjectReference>
28
- </ItemGroup>
29
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
30
- <ImportGroup Label="ExtensionTargets">
31
- </ImportGroup>
32
- </Project>
@@ -1,33 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <Import Project="ProjectConfigurations.Base.props" />
4
- <PropertyGroup Label="Globals">
5
- <ProjectGuid>{861cdd5f-59a2-4f34-957e-5c1af98be0a4}</ProjectGuid>
6
- </PropertyGroup>
7
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
8
- <Import Project="Configuration.Application.props" />
9
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
10
- <ImportGroup Label="ExtensionSettings">
11
- </ImportGroup>
12
- <ImportGroup Label="PropertySheets">
13
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
14
- <Import Project="Base.props" />
15
- </ImportGroup>
16
- <PropertyGroup Label="UserMacros" />
17
- <ItemGroup>
18
- <ClCompile Include="..\examples\sam3u_benchmark.c" />
19
- </ItemGroup>
20
- <ItemGroup>
21
- <ClInclude Include=".\config.h" />
22
- <ClInclude Include="..\libusb\libusb.h" />
23
- </ItemGroup>
24
- <ItemGroup>
25
- <ProjectReference Include=".\libusb_static.vcxproj">
26
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
27
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
28
- </ProjectReference>
29
- </ItemGroup>
30
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
31
- <ImportGroup Label="ExtensionTargets">
32
- </ImportGroup>
33
- </Project>
@@ -1,35 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <Import Project="ProjectConfigurations.Base.props" />
4
- <PropertyGroup Label="Globals">
5
- <ProjectGuid>{35BD5D4B-5102-4A08-81C0-AAF3285FCB01}</ProjectGuid>
6
- </PropertyGroup>
7
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
8
- <Import Project="Configuration.Application.props" />
9
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
10
- <ImportGroup Label="ExtensionSettings">
11
- </ImportGroup>
12
- <ImportGroup Label="PropertySheets">
13
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
14
- <Import Project="Base.props" />
15
- </ImportGroup>
16
- <PropertyGroup Label="UserMacros" />
17
- <ItemGroup>
18
- <ClCompile Include="..\tests\set_option.c" />
19
- <ClCompile Include="..\tests\testlib.c" />
20
- </ItemGroup>
21
- <ItemGroup>
22
- <ClInclude Include=".\config.h" />
23
- <ClInclude Include="..\libusb\libusb.h" />
24
- <ClInclude Include="..\tests\libusb_testlib.h" />
25
- </ItemGroup>
26
- <ItemGroup>
27
- <ProjectReference Include=".\libusb_static.vcxproj">
28
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
29
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
30
- </ProjectReference>
31
- </ItemGroup>
32
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
33
- <ImportGroup Label="ExtensionTargets">
34
- </ImportGroup>
35
- </Project>
@@ -1,35 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <Import Project="ProjectConfigurations.Base.props" />
4
- <PropertyGroup Label="Globals">
5
- <ProjectGuid>{53942EFF-C810-458D-B3CB-EE5CE9F1E781}</ProjectGuid>
6
- </PropertyGroup>
7
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
8
- <Import Project="Configuration.Application.props" />
9
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
10
- <ImportGroup Label="ExtensionSettings">
11
- </ImportGroup>
12
- <ImportGroup Label="PropertySheets">
13
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
14
- <Import Project="Base.props" />
15
- </ImportGroup>
16
- <PropertyGroup Label="UserMacros" />
17
- <ItemGroup>
18
- <ClCompile Include="..\tests\stress.c" />
19
- <ClCompile Include="..\tests\testlib.c" />
20
- </ItemGroup>
21
- <ItemGroup>
22
- <ClInclude Include=".\config.h" />
23
- <ClInclude Include="..\libusb\libusb.h" />
24
- <ClInclude Include="..\tests\libusb_testlib.h" />
25
- </ItemGroup>
26
- <ItemGroup>
27
- <ProjectReference Include=".\libusb_static.vcxproj">
28
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
29
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
30
- </ProjectReference>
31
- </ItemGroup>
32
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
33
- <ImportGroup Label="ExtensionTargets">
34
- </ImportGroup>
35
- </Project>
@@ -1,33 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <Import Project="ProjectConfigurations.Base.props" />
4
- <PropertyGroup Label="Globals">
5
- <ProjectGuid>{9EAF1311-2BBB-4177-882B-DA7FA0AD7912}</ProjectGuid>
6
- </PropertyGroup>
7
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
8
- <Import Project="Configuration.Application.props" />
9
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
10
- <ImportGroup Label="ExtensionSettings">
11
- </ImportGroup>
12
- <ImportGroup Label="PropertySheets">
13
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
14
- <Import Project="Base.props" />
15
- </ImportGroup>
16
- <PropertyGroup Label="UserMacros" />
17
- <ItemGroup>
18
- <ClCompile Include="..\tests\stress_mt.c" />
19
- </ItemGroup>
20
- <ItemGroup>
21
- <ClInclude Include=".\config.h" />
22
- <ClInclude Include="..\libusb\libusb.h" />
23
- </ItemGroup>
24
- <ItemGroup>
25
- <ProjectReference Include=".\libusb_static.vcxproj">
26
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
27
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
28
- </ProjectReference>
29
- </ItemGroup>
30
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
31
- <ImportGroup Label="ExtensionTargets">
32
- </ImportGroup>
33
- </Project>
@@ -1,32 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <Import Project="ProjectConfigurations.Base.props" />
4
- <PropertyGroup Label="Globals">
5
- <ProjectGuid>{70828935-325B-4749-B381-0E55EF31AEE8}</ProjectGuid>
6
- </PropertyGroup>
7
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
8
- <Import Project="Configuration.Application.props" />
9
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
10
- <ImportGroup Label="ExtensionSettings">
11
- </ImportGroup>
12
- <ImportGroup Label="PropertySheets">
13
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
14
- <Import Project="Base.props" />
15
- </ImportGroup>
16
- <PropertyGroup Label="UserMacros" />
17
- <ItemGroup>
18
- <ClCompile Include="..\examples\testlibusb.c" />
19
- </ItemGroup>
20
- <ItemGroup>
21
- <ClInclude Include="..\libusb\libusb.h" />
22
- </ItemGroup>
23
- <ItemGroup>
24
- <ProjectReference Include=".\libusb_static.vcxproj">
25
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
26
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
27
- </ProjectReference>
28
- </ItemGroup>
29
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
30
- <ImportGroup Label="ExtensionTargets">
31
- </ImportGroup>
32
- </Project>
@@ -1,38 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <Import Project="ProjectConfigurations.Base.props" />
4
- <PropertyGroup Label="Globals">
5
- <ProjectGuid>{3F3138D0-7AB7-4268-9BF3-1A3EA5503A11}</ProjectGuid>
6
- </PropertyGroup>
7
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
8
- <Import Project="Configuration.Application.props" />
9
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
10
- <ImportGroup Label="ExtensionSettings">
11
- </ImportGroup>
12
- <ImportGroup Label="PropertySheets">
13
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
14
- <Import Project="Base.props" />
15
- </ImportGroup>
16
- <PropertyGroup Label="UserMacros" />
17
- <ItemDefinitionGroup>
18
- <ClCompile>
19
- <!--VS2013 complains about while(0)-->
20
- <DisableSpecificWarnings Condition="'$(PlatformToolsetVersion)'&lt;='120'">4127;%(DisableSpecificWarnings)</DisableSpecificWarnings>
21
- </ClCompile>
22
- </ItemDefinitionGroup>
23
- <ItemGroup>
24
- <ClCompile Include="..\examples\xusb.c" />
25
- </ItemGroup>
26
- <ItemGroup>
27
- <ClInclude Include="..\libusb\libusb.h" />
28
- </ItemGroup>
29
- <ItemGroup>
30
- <ProjectReference Include=".\libusb_static.vcxproj">
31
- <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
32
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
33
- </ProjectReference>
34
- </ItemGroup>
35
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
36
- <ImportGroup Label="ExtensionTargets">
37
- </ImportGroup>
38
- </Project>
@@ -1,40 +0,0 @@
1
- AM_CPPFLAGS = -I$(top_srcdir)/libusb
2
- LDADD = ../libusb/libusb-1.0.la
3
- AM_LDFLAGS = -static
4
-
5
- stress_SOURCES = stress.c testlib.c
6
- stress_mt_SOURCES = stress_mt.c
7
- set_option_SOURCES = set_option.c testlib.c
8
- init_context_SOURCES = init_context.c testlib.c
9
- macos_SOURCES = macos.c testlib.c
10
-
11
- stress_mt_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
12
- stress_mt_LDADD = $(LDADD) $(THREAD_LIBS)
13
- stress_mt_LDFLAGS = $(AM_LDFLAGS)
14
-
15
- if OS_EMSCRIPTEN
16
- # On the Web you can't block the main thread as this blocks the event loop itself,
17
- # causing deadlocks when trying to use async APIs like WebUSB.
18
- # We use the PROXY_TO_PTHREAD Emscripten's feature to move the main app to a separate thread
19
- # where it can block safely.
20
- stress_mt_LDFLAGS += ${AM_LDFLAGS} -s PROXY_TO_PTHREAD -s EXIT_RUNTIME
21
- endif
22
-
23
- noinst_HEADERS = libusb_testlib.h
24
- noinst_PROGRAMS = stress stress_mt set_option init_context
25
- if OS_DARWIN
26
- noinst_PROGRAMS += macos
27
- endif
28
-
29
- if BUILD_UMOCKDEV_TEST
30
- # NOTE: We add libumockdev-preload.so so that we can run tests in-process
31
- # We also use -Wl,-lxxx as the compiler doesn't need it and libtool
32
- # would reorder the flags otherwise.
33
- umockdev_CPPFLAGS = ${UMOCKDEV_CFLAGS} -I$(top_srcdir)/libusb
34
- umockdev_LDFLAGS = -Wl,--push-state,--no-as-needed -Wl,-lumockdev-preload -Wl,--pop-state ${UMOCKDEV_LIBS}
35
- umockdev_SOURCES = umockdev.c
36
-
37
- noinst_PROGRAMS += umockdev
38
- endif
39
-
40
- TESTS=$(noinst_PROGRAMS)
@@ -1,153 +0,0 @@
1
- /* -*- Mode: C; indent-tabs-mode:nil -*- */
2
- /*
3
- * Unit tests for libusb_set_option
4
- * Copyright © 2023 Nathan Hjelm <hjelmn@cs.unm.edu>
5
- * Copyright © 2023 Google, LLC. All rights reserved.
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
- #include "config.h"
23
-
24
- #include <stdlib.h>
25
- #include <stdio.h>
26
- #include <inttypes.h>
27
- #include "libusbi.h"
28
- #include "libusb_testlib.h"
29
-
30
- #if defined(_WIN32) && !defined(__CYGWIN__)
31
- #include <winbase.h>
32
-
33
- static int unsetenv(const char *env) {
34
- return _putenv_s(env, "");
35
- }
36
- #endif
37
-
38
- #define LIBUSB_TEST_CLEAN_EXIT(code) \
39
- do { \
40
- if (test_ctx != NULL) { \
41
- libusb_exit(test_ctx); \
42
- } \
43
- unsetenv("LIBUSB_DEBUG"); \
44
- return (code); \
45
- } while (0)
46
-
47
- /**
48
- * Fail the test if the expression does not evaluate to LIBUSB_SUCCESS.
49
- */
50
- #define LIBUSB_TEST_RETURN_ON_ERROR(expr) \
51
- do { \
52
- int _result = (expr); \
53
- if (LIBUSB_SUCCESS != _result) { \
54
- libusb_testlib_logf("Not success (%s) at %s:%d", #expr, \
55
- __FILE__, __LINE__); \
56
- LIBUSB_TEST_CLEAN_EXIT(TEST_STATUS_FAILURE); \
57
- } \
58
- } while (0)
59
-
60
- /**
61
- * Use relational operator to compare two values and fail the test if the
62
- * comparison is false. Intended to compare integer or pointer types.
63
- *
64
- * Example: LIBUSB_EXPECT(==, 0, 1) -> fail, LIBUSB_EXPECT(==, 0, 0) -> ok.
65
- */
66
- #define LIBUSB_EXPECT(operator, lhs, rhs) \
67
- do { \
68
- int64_t _lhs = (int64_t)(intptr_t)(lhs), _rhs = (int64_t)(intptr_t)(rhs); \
69
- if (!(_lhs operator _rhs)) { \
70
- libusb_testlib_logf("Expected %s (%" PRId64 ") " #operator \
71
- " %s (%" PRId64 ") at %s:%d", #lhs, \
72
- (int64_t)(intptr_t)_lhs, #rhs, \
73
- (int64_t)(intptr_t)_rhs, __FILE__, \
74
- __LINE__); \
75
- LIBUSB_TEST_CLEAN_EXIT(TEST_STATUS_FAILURE); \
76
- } \
77
- } while (0)
78
-
79
-
80
- static libusb_testlib_result test_init_context_basic(void) {
81
- libusb_context *test_ctx = NULL;
82
-
83
- /* test basic functionality */
84
- LIBUSB_TEST_RETURN_ON_ERROR(libusb_init_context(&test_ctx, /*options=*/NULL,
85
- /*num_options=*/0));
86
-
87
- LIBUSB_TEST_CLEAN_EXIT(TEST_STATUS_SUCCESS);
88
- }
89
-
90
- static libusb_testlib_result test_init_context_log_level(void) {
91
- libusb_context *test_ctx = NULL;
92
-
93
- struct libusb_init_option options[] = {
94
- {
95
- .option = LIBUSB_OPTION_LOG_LEVEL,
96
- .value = {
97
- .ival = LIBUSB_LOG_LEVEL_ERROR,
98
- },
99
- }
100
- };
101
-
102
- /* test basic functionality */
103
- LIBUSB_TEST_RETURN_ON_ERROR(libusb_init_context(&test_ctx, options,
104
- /*num_options=*/1));
105
-
106
- #if defined(ENABLE_LOGGING) && !defined(ENABLE_DEBUG_LOGGING)
107
- LIBUSB_EXPECT(==, test_ctx->debug, LIBUSB_LOG_LEVEL_ERROR);
108
- #endif
109
-
110
- LIBUSB_TEST_CLEAN_EXIT(TEST_STATUS_SUCCESS);
111
- }
112
-
113
- static void LIBUSB_CALL test_log_cb(libusb_context *ctx, enum libusb_log_level level,
114
- const char *str) {
115
- UNUSED(ctx);
116
- UNUSED(level);
117
- UNUSED(str);
118
- }
119
-
120
- static libusb_testlib_result test_init_context_log_cb(void) {
121
- libusb_context *test_ctx = NULL;
122
-
123
- struct libusb_init_option options[] = {
124
- {
125
- .option = LIBUSB_OPTION_LOG_CB,
126
- .value = {
127
- .log_cbval = (libusb_log_cb) &test_log_cb,
128
- },
129
- }
130
- };
131
-
132
- /* test basic functionality */
133
- LIBUSB_TEST_RETURN_ON_ERROR(libusb_init_context(&test_ctx, options,
134
- /*num_options=*/1));
135
-
136
- #if defined(ENABLE_LOGGING) && !defined(ENABLE_DEBUG_LOGGING)
137
- LIBUSB_EXPECT(==, test_ctx->log_handler, test_log_cb);
138
- #endif
139
-
140
- LIBUSB_TEST_CLEAN_EXIT(TEST_STATUS_SUCCESS);
141
- }
142
-
143
- static const libusb_testlib_test tests[] = {
144
- { "test_init_context_basic", &test_init_context_basic },
145
- { "test_init_context_log_level", &test_init_context_log_level },
146
- { "test_init_context_log_cb", &test_init_context_log_cb },
147
- LIBUSB_NULL_TEST
148
- };
149
-
150
- int main(int argc, char *argv[])
151
- {
152
- return libusb_testlib_run_tests(argc, argv, tests);
153
- }
@@ -1,76 +0,0 @@
1
- /*
2
- * libusb test library helper functions
3
- * Copyright © 2012 Toby Gray <toby.gray@realvnc.com>
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 LIBUSB_TESTLIB_H
21
- #define LIBUSB_TESTLIB_H
22
-
23
- #include <config.h>
24
-
25
- /** Values returned from a test function to indicate test result */
26
- typedef enum {
27
- /** Indicates that the test ran successfully. */
28
- TEST_STATUS_SUCCESS,
29
- /** Indicates that the test failed one or more test. */
30
- TEST_STATUS_FAILURE,
31
- /** Indicates that an unexpected error occurred. */
32
- TEST_STATUS_ERROR,
33
- /** Indicates that the test can't be run. For example this may be
34
- * due to no suitable device being connected to perform the tests. */
35
- TEST_STATUS_SKIP
36
- } libusb_testlib_result;
37
-
38
- /**
39
- * Logs some test information or state
40
- */
41
- void libusb_testlib_logf(const char *fmt, ...) PRINTF_FORMAT(1, 2);
42
-
43
- /**
44
- * Structure holding a test description.
45
- */
46
- typedef struct {
47
- /** Human readable name of the test. */
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);
54
- } libusb_testlib_test;
55
-
56
- /**
57
- * Value to use at the end of a test array to indicate the last
58
- * element.
59
- */
60
- #define LIBUSB_NULL_TEST { NULL, NULL }
61
-
62
- /**
63
- * Runs the tests provided.
64
- *
65
- * Before running any tests argc and argv will be processed
66
- * to determine the mode of operation.
67
- *
68
- * \param argc The argc from main
69
- * \param argv The argv from main
70
- * \param tests A NULL_TEST terminated array of tests
71
- * \return 0 on success, non-zero on failure
72
- */
73
- int libusb_testlib_run_tests(int argc, char *argv[],
74
- const libusb_testlib_test *tests);
75
-
76
- #endif //LIBUSB_TESTLIB_H