usb 2.1.3 → 2.2.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.
Files changed (279) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +3 -0
  3. package/dist/index.d.ts +2 -1
  4. package/dist/index.js +3 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/usb/bindings.d.ts +4 -0
  7. package/dist/usb/device.js +5 -0
  8. package/dist/usb/device.js.map +1 -1
  9. package/libusb/.gitattributes +2 -6
  10. package/libusb/.private/appveyor_build.sh +22 -0
  11. package/libusb/.private/bm.sh +1 -1
  12. package/libusb/.private/ci-build.sh +67 -0
  13. package/libusb/.private/post-rewrite.sh +5 -1
  14. package/libusb/.private/pre-commit.sh +5 -1
  15. package/libusb/.private/wbs.txt +4 -19
  16. package/libusb/.travis.yml +32 -23
  17. package/libusb/AUTHORS +76 -3
  18. package/libusb/ChangeLog +41 -3
  19. package/libusb/INSTALL_WIN.txt +22 -44
  20. package/libusb/Makefile.am +32 -10
  21. package/libusb/{README.md → README} +2 -2
  22. package/libusb/README.git +3 -3
  23. package/libusb/Xcode/common.xcconfig +23 -19
  24. package/libusb/Xcode/config.h +25 -13
  25. package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +511 -109
  26. package/libusb/android/README +90 -54
  27. package/libusb/android/config.h +23 -43
  28. package/libusb/android/examples/unrooted_android.c +301 -0
  29. package/libusb/android/examples/unrooted_android.h +36 -0
  30. package/libusb/android/jni/Android.mk +1 -1
  31. package/libusb/android/jni/Application.mk +16 -0
  32. package/libusb/android/jni/examples.mk +63 -29
  33. package/libusb/android/jni/libusb.mk +14 -8
  34. package/libusb/android/jni/tests.mk +13 -24
  35. package/libusb/appveyor.yml +69 -30
  36. package/libusb/autogen.sh +5 -3
  37. package/libusb/bootstrap.sh +6 -2
  38. package/libusb/configure.ac +302 -228
  39. package/libusb/doc/Makefile.in +22 -0
  40. package/libusb/doc/doxygen.cfg.in +460 -223
  41. package/libusb/examples/Makefile.am +6 -13
  42. package/libusb/examples/dpfp.c +276 -73
  43. package/libusb/examples/ezusb.c +18 -8
  44. package/libusb/examples/ezusb.h +6 -17
  45. package/libusb/examples/fxload.c +4 -5
  46. package/libusb/examples/hotplugtest.c +1 -1
  47. package/libusb/examples/sam3u_benchmark.c +59 -24
  48. package/libusb/examples/testlibusb.c +138 -104
  49. package/libusb/examples/xusb.c +26 -22
  50. package/libusb/libusb/Makefile.am +57 -70
  51. package/libusb/libusb/Makefile.am.extra +26 -0
  52. package/libusb/libusb/core.c +420 -423
  53. package/libusb/libusb/descriptor.c +365 -419
  54. package/libusb/libusb/hotplug.c +197 -104
  55. package/libusb/libusb/io.c +491 -528
  56. package/libusb/libusb/libusb-1.0.def +7 -3
  57. package/libusb/libusb/libusb-1.0.rc +1 -9
  58. package/libusb/libusb/libusb.h +295 -226
  59. package/libusb/libusb/libusbi.h +587 -314
  60. package/libusb/libusb/os/darwin_usb.c +634 -317
  61. package/libusb/libusb/os/darwin_usb.h +39 -15
  62. package/libusb/libusb/os/events_posix.c +300 -0
  63. package/libusb/libusb/os/events_posix.h +59 -0
  64. package/libusb/libusb/os/events_windows.c +214 -0
  65. package/libusb/{msvc/missing.h → libusb/os/events_windows.h} +25 -11
  66. package/libusb/libusb/os/haiku_pollfs.cpp +14 -9
  67. package/libusb/libusb/os/haiku_usb.h +12 -12
  68. package/libusb/libusb/os/haiku_usb_backend.cpp +36 -37
  69. package/libusb/libusb/os/haiku_usb_raw.cpp +80 -116
  70. package/libusb/libusb/os/linux_netlink.c +55 -63
  71. package/libusb/libusb/os/linux_udev.c +61 -69
  72. package/libusb/libusb/os/linux_usbfs.c +926 -1015
  73. package/libusb/libusb/os/linux_usbfs.h +74 -57
  74. package/libusb/libusb/os/netbsd_usb.c +103 -168
  75. package/libusb/libusb/os/null_usb.c +111 -0
  76. package/libusb/libusb/os/openbsd_usb.c +71 -120
  77. package/libusb/libusb/os/sunos_usb.c +289 -375
  78. package/libusb/libusb/os/sunos_usb.h +0 -1
  79. package/libusb/libusb/os/threads_posix.c +81 -32
  80. package/libusb/libusb/os/threads_posix.h +19 -23
  81. package/libusb/libusb/os/threads_windows.c +9 -95
  82. package/libusb/libusb/os/threads_windows.h +33 -31
  83. package/libusb/libusb/os/windows_common.c +904 -0
  84. package/libusb/libusb/os/windows_common.h +329 -42
  85. package/libusb/libusb/os/windows_usbdk.c +161 -267
  86. package/libusb/libusb/os/windows_usbdk.h +5 -2
  87. package/libusb/libusb/os/windows_winusb.c +1326 -1190
  88. package/libusb/libusb/os/windows_winusb.h +167 -167
  89. package/libusb/libusb/strerror.c +20 -30
  90. package/libusb/libusb/sync.c +20 -21
  91. package/libusb/libusb/version.h +1 -1
  92. package/libusb/libusb/version_nano.h +1 -1
  93. package/libusb/msvc/.gitattributes +3 -0
  94. package/libusb/msvc/config.h +27 -20
  95. package/libusb/msvc/{hotplugtest_2012.vcxproj → dpfp_2013.vcxproj} +14 -10
  96. package/libusb/msvc/dpfp_2013.vcxproj.filters +26 -0
  97. package/libusb/msvc/{listdevs_2010.vcxproj → dpfp_2015.vcxproj} +14 -9
  98. package/libusb/msvc/dpfp_2015.vcxproj.filters +26 -0
  99. package/libusb/msvc/dpfp_2017.vcxproj +106 -0
  100. package/libusb/msvc/dpfp_2017.vcxproj.filters +26 -0
  101. package/libusb/msvc/dpfp_2019.vcxproj +106 -0
  102. package/libusb/msvc/dpfp_2019.vcxproj.filters +26 -0
  103. package/libusb/msvc/dpfp_threaded_2013.vcxproj +87 -0
  104. package/libusb/msvc/dpfp_threaded_2013.vcxproj.filters +26 -0
  105. package/libusb/msvc/dpfp_threaded_2015.vcxproj +87 -0
  106. package/libusb/msvc/dpfp_threaded_2015.vcxproj.filters +26 -0
  107. package/libusb/msvc/dpfp_threaded_2017.vcxproj +106 -0
  108. package/libusb/msvc/dpfp_threaded_2017.vcxproj.filters +26 -0
  109. package/libusb/msvc/{fxload_2012.vcxproj → dpfp_threaded_2019.vcxproj} +32 -17
  110. package/libusb/msvc/dpfp_threaded_2019.vcxproj.filters +26 -0
  111. package/libusb/msvc/fxload_2013.vcxproj +6 -3
  112. package/libusb/msvc/fxload_2013.vcxproj.filters +35 -0
  113. package/libusb/msvc/fxload_2015.vcxproj +6 -3
  114. package/libusb/msvc/fxload_2015.vcxproj.filters +35 -0
  115. package/libusb/msvc/fxload_2017.vcxproj +6 -7
  116. package/libusb/msvc/fxload_2017.vcxproj.filters +35 -0
  117. package/libusb/msvc/{fxload_2010.vcxproj → fxload_2019.vcxproj} +29 -6
  118. package/libusb/msvc/fxload_2019.vcxproj.filters +35 -0
  119. package/libusb/{examples → msvc}/getopt/getopt.c +0 -0
  120. package/libusb/{examples → msvc}/getopt/getopt.h +0 -0
  121. package/libusb/{examples → msvc}/getopt/getopt1.c +0 -0
  122. package/libusb/msvc/getopt_2013.vcxproj +4 -5
  123. package/libusb/msvc/getopt_2013.vcxproj.filters +26 -0
  124. package/libusb/msvc/getopt_2015.vcxproj +4 -4
  125. package/libusb/msvc/getopt_2015.vcxproj.filters +26 -0
  126. package/libusb/msvc/getopt_2017.vcxproj +4 -10
  127. package/libusb/msvc/getopt_2017.vcxproj.filters +26 -0
  128. package/libusb/msvc/{getopt_2012.vcxproj → getopt_2019.vcxproj} +25 -6
  129. package/libusb/msvc/getopt_2019.vcxproj.filters +26 -0
  130. package/libusb/msvc/hotplugtest_2013.vcxproj +6 -3
  131. package/libusb/msvc/hotplugtest_2013.vcxproj.filters +23 -0
  132. package/libusb/msvc/hotplugtest_2015.vcxproj +6 -3
  133. package/libusb/msvc/hotplugtest_2015.vcxproj.filters +23 -0
  134. package/libusb/msvc/hotplugtest_2017.vcxproj +6 -7
  135. package/libusb/msvc/hotplugtest_2017.vcxproj.filters +23 -0
  136. package/libusb/msvc/hotplugtest_2019.vcxproj +105 -0
  137. package/libusb/msvc/hotplugtest_2019.vcxproj.filters +23 -0
  138. package/libusb/msvc/libusb_2013.sln +50 -20
  139. package/libusb/msvc/libusb_2015.sln +51 -21
  140. package/libusb/msvc/libusb_2017.sln +90 -36
  141. package/libusb/msvc/libusb_2019.sln +240 -0
  142. package/libusb/msvc/libusb_dll_2013.vcxproj +6 -9
  143. package/libusb/msvc/libusb_dll_2013.vcxproj.filters +94 -0
  144. package/libusb/msvc/libusb_dll_2015.vcxproj +6 -8
  145. package/libusb/msvc/libusb_dll_2015.vcxproj.filters +94 -0
  146. package/libusb/msvc/libusb_dll_2017.vcxproj +6 -16
  147. package/libusb/msvc/libusb_dll_2017.vcxproj.filters +94 -0
  148. package/libusb/msvc/{libusb_dll_2010.vcxproj → libusb_dll_2019.vcxproj} +27 -9
  149. package/libusb/msvc/libusb_dll_2019.vcxproj.filters +94 -0
  150. package/libusb/msvc/libusb_static_2013.vcxproj +5 -9
  151. package/libusb/msvc/libusb_static_2013.vcxproj.filters +80 -0
  152. package/libusb/msvc/libusb_static_2015.vcxproj +5 -8
  153. package/libusb/msvc/libusb_static_2015.vcxproj.filters +80 -0
  154. package/libusb/msvc/libusb_static_2017.vcxproj +5 -8
  155. package/libusb/msvc/libusb_static_2017.vcxproj.filters +80 -0
  156. package/libusb/msvc/{libusb_static_2010.vcxproj → libusb_static_2019.vcxproj} +26 -9
  157. package/libusb/msvc/libusb_static_2019.vcxproj.filters +80 -0
  158. package/libusb/msvc/listdevs_2013.vcxproj +6 -3
  159. package/libusb/msvc/listdevs_2013.vcxproj.filters +23 -0
  160. package/libusb/msvc/listdevs_2015.vcxproj +6 -3
  161. package/libusb/msvc/listdevs_2015.vcxproj.filters +23 -0
  162. package/libusb/msvc/listdevs_2017.vcxproj +6 -7
  163. package/libusb/msvc/listdevs_2017.vcxproj.filters +23 -0
  164. package/libusb/msvc/listdevs_2019.vcxproj +105 -0
  165. package/libusb/msvc/listdevs_2019.vcxproj.filters +23 -0
  166. package/libusb/msvc/{listdevs_2012.vcxproj → sam3u_benchmark_2013.vcxproj} +13 -9
  167. package/libusb/msvc/sam3u_benchmark_2013.vcxproj.filters +26 -0
  168. package/libusb/msvc/{hotplugtest_2010.vcxproj → sam3u_benchmark_2015.vcxproj} +13 -8
  169. package/libusb/msvc/sam3u_benchmark_2015.vcxproj.filters +26 -0
  170. package/libusb/msvc/sam3u_benchmark_2017.vcxproj +106 -0
  171. package/libusb/msvc/sam3u_benchmark_2017.vcxproj.filters +26 -0
  172. package/libusb/msvc/sam3u_benchmark_2019.vcxproj +106 -0
  173. package/libusb/msvc/sam3u_benchmark_2019.vcxproj.filters +26 -0
  174. package/libusb/msvc/stress_2013.vcxproj +4 -2
  175. package/libusb/msvc/stress_2013.vcxproj.filters +32 -0
  176. package/libusb/msvc/stress_2015.vcxproj +4 -2
  177. package/libusb/msvc/stress_2015.vcxproj.filters +32 -0
  178. package/libusb/msvc/stress_2017.vcxproj +4 -6
  179. package/libusb/msvc/stress_2017.vcxproj.filters +32 -0
  180. package/libusb/msvc/{stress_2010.vcxproj → stress_2019.vcxproj} +26 -4
  181. package/libusb/msvc/stress_2019.vcxproj.filters +32 -0
  182. package/libusb/msvc/testlibusb_2013.vcxproj +6 -3
  183. package/libusb/msvc/testlibusb_2013.vcxproj.filters +23 -0
  184. package/libusb/msvc/testlibusb_2015.vcxproj +6 -3
  185. package/libusb/msvc/testlibusb_2015.vcxproj.filters +23 -0
  186. package/libusb/msvc/testlibusb_2017.vcxproj +6 -7
  187. package/libusb/msvc/testlibusb_2017.vcxproj.filters +23 -0
  188. package/libusb/msvc/{testlibusb_2010.vcxproj → testlibusb_2019.vcxproj} +28 -5
  189. package/libusb/msvc/testlibusb_2019.vcxproj.filters +23 -0
  190. package/libusb/msvc/xusb_2013.vcxproj +6 -3
  191. package/libusb/msvc/xusb_2013.vcxproj.filters +23 -0
  192. package/libusb/msvc/xusb_2015.vcxproj +6 -3
  193. package/libusb/msvc/xusb_2015.vcxproj.filters +23 -0
  194. package/libusb/msvc/xusb_2017.vcxproj +6 -7
  195. package/libusb/msvc/xusb_2017.vcxproj.filters +23 -0
  196. package/libusb/msvc/{xusb_2010.vcxproj → xusb_2019.vcxproj} +28 -5
  197. package/libusb/msvc/xusb_2019.vcxproj.filters +23 -0
  198. package/libusb/tests/Makefile.am +1 -0
  199. package/libusb/tests/libusb_testlib.h +12 -43
  200. package/libusb/tests/stress.c +59 -50
  201. package/libusb/tests/testlib.c +78 -171
  202. package/libusb.gypi +10 -11
  203. package/package.json +1 -1
  204. package/prebuilds/android-arm/node.napi.armv7.node +0 -0
  205. package/prebuilds/android-arm64/node.napi.armv8.node +0 -0
  206. package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
  207. package/prebuilds/linux-arm/node.napi.armv6.node +0 -0
  208. package/prebuilds/linux-arm/node.napi.armv7.node +0 -0
  209. package/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
  210. package/prebuilds/linux-ia32/node.napi.node +0 -0
  211. package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  212. package/prebuilds/linux-x64/node.napi.musl.node +0 -0
  213. package/prebuilds/win32-ia32/node.napi.node +0 -0
  214. package/prebuilds/win32-x64/node.napi.node +0 -0
  215. package/src/device.cc +12 -7
  216. package/src/node_usb.cc +10 -0
  217. package/test/usb.coffee +6 -0
  218. package/tsc/index.ts +2 -0
  219. package/tsc/usb/bindings.ts +5 -0
  220. package/tsc/usb/device.ts +6 -0
  221. package/libusb/.private/bd.cmd +0 -89
  222. package/libusb/.private/bwince.cmd +0 -57
  223. package/libusb/.private/wbs_wince.txt +0 -42
  224. package/libusb/Brewfile +0 -4
  225. package/libusb/appveyor_cygwin.bat +0 -11
  226. package/libusb/appveyor_minGW.bat +0 -19
  227. package/libusb/doc/Makefile.am +0 -9
  228. package/libusb/examples/dpfp_threaded.c +0 -557
  229. package/libusb/libusb/hotplug.h +0 -99
  230. package/libusb/libusb/os/poll_posix.c +0 -84
  231. package/libusb/libusb/os/poll_posix.h +0 -14
  232. package/libusb/libusb/os/poll_windows.c +0 -447
  233. package/libusb/libusb/os/poll_windows.h +0 -98
  234. package/libusb/libusb/os/wince_usb.c +0 -888
  235. package/libusb/libusb/os/wince_usb.h +0 -126
  236. package/libusb/libusb/os/windows_nt_common.c +0 -1010
  237. package/libusb/libusb/os/windows_nt_common.h +0 -110
  238. package/libusb/libusb/os/windows_nt_shared_types.h +0 -147
  239. package/libusb/msvc/appveyor.bat +0 -27
  240. package/libusb/msvc/ddk_build.cmd +0 -219
  241. package/libusb/msvc/errno.h +0 -102
  242. package/libusb/msvc/fxload_sources +0 -23
  243. package/libusb/msvc/getopt_2005.vcproj +0 -288
  244. package/libusb/msvc/getopt_2010.vcxproj +0 -72
  245. package/libusb/msvc/getopt_sources +0 -24
  246. package/libusb/msvc/hotplugtest_sources +0 -20
  247. package/libusb/msvc/inttypes.h +0 -295
  248. package/libusb/msvc/libusb.dsw +0 -71
  249. package/libusb/msvc/libusb_2005.sln +0 -95
  250. package/libusb/msvc/libusb_2010.sln +0 -105
  251. package/libusb/msvc/libusb_2012.sln +0 -105
  252. package/libusb/msvc/libusb_dll.dsp +0 -194
  253. package/libusb/msvc/libusb_dll_2005.vcproj +0 -464
  254. package/libusb/msvc/libusb_dll_2012.vcxproj +0 -107
  255. package/libusb/msvc/libusb_dll_wince.vcproj +0 -1251
  256. package/libusb/msvc/libusb_sources +0 -43
  257. package/libusb/msvc/libusb_static.dsp +0 -174
  258. package/libusb/msvc/libusb_static_2005.vcproj +0 -390
  259. package/libusb/msvc/libusb_static_2012.vcxproj +0 -98
  260. package/libusb/msvc/libusb_static_wince.vcproj +0 -1179
  261. package/libusb/msvc/libusb_wince.sln +0 -246
  262. package/libusb/msvc/listdevs.dsp +0 -103
  263. package/libusb/msvc/listdevs_2005.vcproj +0 -360
  264. package/libusb/msvc/listdevs_sources +0 -20
  265. package/libusb/msvc/listdevs_wince.vcproj +0 -1120
  266. package/libusb/msvc/missing.c +0 -80
  267. package/libusb/msvc/stdint.h +0 -256
  268. package/libusb/msvc/stress_2005.vcproj +0 -390
  269. package/libusb/msvc/stress_2012.vcxproj +0 -87
  270. package/libusb/msvc/stress_sources +0 -21
  271. package/libusb/msvc/stress_wince.vcproj +0 -1128
  272. package/libusb/msvc/testlibusb_2012.vcxproj +0 -83
  273. package/libusb/msvc/testlibusb_sources +0 -20
  274. package/libusb/msvc/xusb.dsp +0 -102
  275. package/libusb/msvc/xusb_2005.vcproj +0 -344
  276. package/libusb/msvc/xusb_2012.vcxproj +0 -83
  277. package/libusb/msvc/xusb_sources +0 -20
  278. package/libusb/msvc/xusb_wince.vcproj +0 -1120
  279. package/libusb/travis-autogen.sh +0 -39
@@ -4,6 +4,7 @@
4
4
  * Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
5
5
  * Copyright © 2012 Pete Batard <pete@akeo.ie>
6
6
  * Copyright © 2012-2018 Nathan Hjelm <hjelmn@cs.unm.edu>
7
+ * Copyright © 2014-2020 Chris Dickens <christopher.a.dickens@gmail.com>
7
8
  * For more information, please visit: http://libusb.info
8
9
  *
9
10
  * This library is free software; you can redistribute it and/or
@@ -24,55 +25,39 @@
24
25
  #ifndef LIBUSB_H
25
26
  #define LIBUSB_H
26
27
 
27
- #ifdef _MSC_VER
28
+ #if defined(_MSC_VER)
28
29
  /* on MS environments, the inline keyword is available in C++ only */
29
30
  #if !defined(__cplusplus)
30
31
  #define inline __inline
31
32
  #endif
32
- /* ssize_t is also not available (copy/paste from MinGW) */
33
+ /* ssize_t is also not available */
33
34
  #ifndef _SSIZE_T_DEFINED
34
35
  #define _SSIZE_T_DEFINED
35
- #undef ssize_t
36
- #ifdef _WIN64
37
- typedef __int64 ssize_t;
38
- #else
39
- typedef int ssize_t;
40
- #endif /* _WIN64 */
36
+ #include <basetsd.h>
37
+ typedef SSIZE_T ssize_t;
41
38
  #endif /* _SSIZE_T_DEFINED */
42
39
  #endif /* _MSC_VER */
43
40
 
44
- /* stdint.h is not available on older MSVC */
45
- #if defined(_MSC_VER) && (_MSC_VER < 1600) && (!defined(_STDINT)) && (!defined(_STDINT_H))
46
- typedef unsigned __int8 uint8_t;
47
- typedef unsigned __int16 uint16_t;
48
- typedef unsigned __int32 uint32_t;
49
- #else
41
+ #include <limits.h>
50
42
  #include <stdint.h>
51
- #endif
52
-
53
- #if !defined(_WIN32_WCE)
54
43
  #include <sys/types.h>
55
- #endif
56
-
57
- #if defined(__linux__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__HAIKU__)
44
+ #if !defined(_MSC_VER)
58
45
  #include <sys/time.h>
59
46
  #endif
60
-
61
47
  #include <time.h>
62
- #include <limits.h>
63
48
 
64
49
  #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
65
50
  #define ZERO_SIZED_ARRAY /* [] - valid C99 code */
66
51
  #else
67
52
  #define ZERO_SIZED_ARRAY 0 /* [0] - non-standard, but usually working code */
68
- #endif
53
+ #endif /* __STDC_VERSION__ */
69
54
 
70
55
  /* 'interface' might be defined as a macro on Windows, so we need to
71
56
  * undefine it so as not to break the current libusb API, because
72
57
  * libusb_config_descriptor has an 'interface' member
73
58
  * As this can be problematic if you include windows.h after libusb.h
74
59
  * in your sources, we force windows.h to be included first. */
75
- #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
60
+ #if defined(_WIN32) || defined(__CYGWIN__)
76
61
  #include <windows.h>
77
62
  #if defined(interface)
78
63
  #undef interface
@@ -80,17 +65,22 @@ typedef unsigned __int32 uint32_t;
80
65
  #if !defined(__CYGWIN__)
81
66
  #include <winsock.h>
82
67
  #endif
83
- #endif
68
+ #endif /* _WIN32 || __CYGWIN__ */
84
69
 
85
- #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
86
- #define LIBUSB_DEPRECATED_FOR(f) \
87
- __attribute__((deprecated("Use " #f " instead")))
88
- #elif __GNUC__ >= 3
89
- #define LIBUSB_DEPRECATED_FOR(f) __attribute__((deprecated))
70
+ #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
71
+ #define LIBUSB_DEPRECATED_FOR(f) __attribute__ ((deprecated ("Use " #f " instead")))
72
+ #elif defined(__GNUC__) && (__GNUC__ >= 3)
73
+ #define LIBUSB_DEPRECATED_FOR(f) __attribute__ ((deprecated))
90
74
  #else
91
75
  #define LIBUSB_DEPRECATED_FOR(f)
92
76
  #endif /* __GNUC__ */
93
77
 
78
+ #if defined(__GNUC__)
79
+ #define LIBUSB_PACKED __attribute__ ((packed))
80
+ #else
81
+ #define LIBUSB_PACKED
82
+ #endif /* __GNUC__ */
83
+
94
84
  /** \def LIBUSB_CALL
95
85
  * \ingroup libusb_misc
96
86
  * libusb's Windows calling convention.
@@ -123,11 +113,11 @@ typedef unsigned __int32 uint32_t;
123
113
  * return type, before the function name. See internal documentation for
124
114
  * API_EXPORTED.
125
115
  */
126
- #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
116
+ #if defined(_WIN32) || defined(__CYGWIN__)
127
117
  #define LIBUSB_CALL WINAPI
128
118
  #else
129
119
  #define LIBUSB_CALL
130
- #endif
120
+ #endif /* _WIN32 || __CYGWIN__ */
131
121
 
132
122
  /** \def LIBUSB_API_VERSION
133
123
  * \ingroup libusb_misc
@@ -149,12 +139,12 @@ typedef unsigned __int32 uint32_t;
149
139
  * Internally, LIBUSB_API_VERSION is defined as follows:
150
140
  * (libusb major << 24) | (libusb minor << 16) | (16 bit incremental)
151
141
  */
152
- #define LIBUSB_API_VERSION 0x01000107
142
+ #define LIBUSB_API_VERSION 0x01000109
153
143
 
154
144
  /* The following is kept for compatibility, but will be deprecated in the future */
155
145
  #define LIBUSBX_API_VERSION LIBUSB_API_VERSION
156
146
 
157
- #ifdef __cplusplus
147
+ #if defined(__cplusplus)
158
148
  extern "C" {
159
149
  #endif
160
150
 
@@ -196,35 +186,35 @@ enum libusb_class_code {
196
186
  * this bDeviceClass value indicates that each interface specifies its
197
187
  * own class information and all interfaces operate independently.
198
188
  */
199
- LIBUSB_CLASS_PER_INTERFACE = 0,
189
+ LIBUSB_CLASS_PER_INTERFACE = 0x00,
200
190
 
201
191
  /** Audio class */
202
- LIBUSB_CLASS_AUDIO = 1,
192
+ LIBUSB_CLASS_AUDIO = 0x01,
203
193
 
204
194
  /** Communications class */
205
- LIBUSB_CLASS_COMM = 2,
195
+ LIBUSB_CLASS_COMM = 0x02,
206
196
 
207
197
  /** Human Interface Device class */
208
- LIBUSB_CLASS_HID = 3,
198
+ LIBUSB_CLASS_HID = 0x03,
209
199
 
210
200
  /** Physical */
211
- LIBUSB_CLASS_PHYSICAL = 5,
212
-
213
- /** Printer class */
214
- LIBUSB_CLASS_PRINTER = 7,
201
+ LIBUSB_CLASS_PHYSICAL = 0x05,
215
202
 
216
203
  /** Image class */
217
- LIBUSB_CLASS_PTP = 6, /* legacy name from libusb-0.1 usb.h */
218
- LIBUSB_CLASS_IMAGE = 6,
204
+ LIBUSB_CLASS_IMAGE = 0x06,
205
+ LIBUSB_CLASS_PTP = 0x06, /* legacy name from libusb-0.1 usb.h */
206
+
207
+ /** Printer class */
208
+ LIBUSB_CLASS_PRINTER = 0x07,
219
209
 
220
210
  /** Mass storage class */
221
- LIBUSB_CLASS_MASS_STORAGE = 8,
211
+ LIBUSB_CLASS_MASS_STORAGE = 0x08,
222
212
 
223
213
  /** Hub class */
224
- LIBUSB_CLASS_HUB = 9,
214
+ LIBUSB_CLASS_HUB = 0x09,
225
215
 
226
216
  /** Data class */
227
- LIBUSB_CLASS_DATA = 10,
217
+ LIBUSB_CLASS_DATA = 0x0a,
228
218
 
229
219
  /** Smart Card */
230
220
  LIBUSB_CLASS_SMART_CARD = 0x0b,
@@ -244,6 +234,9 @@ enum libusb_class_code {
244
234
  /** Wireless class */
245
235
  LIBUSB_CLASS_WIRELESS = 0xe0,
246
236
 
237
+ /** Miscellaneous class */
238
+ LIBUSB_CLASS_MISCELLANEOUS = 0xef,
239
+
247
240
  /** Application class */
248
241
  LIBUSB_CLASS_APPLICATION = 0xfe,
249
242
 
@@ -311,12 +304,13 @@ enum libusb_descriptor_type {
311
304
  #define LIBUSB_BT_CONTAINER_ID_SIZE 20
312
305
 
313
306
  /* We unwrap the BOS => define its max size */
314
- #define LIBUSB_DT_BOS_MAX_SIZE ((LIBUSB_DT_BOS_SIZE) +\
315
- (LIBUSB_BT_USB_2_0_EXTENSION_SIZE) +\
316
- (LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE) +\
317
- (LIBUSB_BT_CONTAINER_ID_SIZE))
307
+ #define LIBUSB_DT_BOS_MAX_SIZE \
308
+ (LIBUSB_DT_BOS_SIZE + \
309
+ LIBUSB_BT_USB_2_0_EXTENSION_SIZE + \
310
+ LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE + \
311
+ LIBUSB_BT_CONTAINER_ID_SIZE)
318
312
 
319
- #define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */
313
+ #define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */
320
314
  #define LIBUSB_ENDPOINT_DIR_MASK 0x80
321
315
 
322
316
  /** \ingroup libusb_desc
@@ -324,34 +318,31 @@ enum libusb_descriptor_type {
324
318
  * \ref libusb_endpoint_descriptor::bEndpointAddress "endpoint address" scheme.
325
319
  */
326
320
  enum libusb_endpoint_direction {
327
- /** In: device-to-host */
328
- LIBUSB_ENDPOINT_IN = 0x80,
329
-
330
321
  /** Out: host-to-device */
331
- LIBUSB_ENDPOINT_OUT = 0x00
322
+ LIBUSB_ENDPOINT_OUT = 0x00,
323
+
324
+ /** In: device-to-host */
325
+ LIBUSB_ENDPOINT_IN = 0x80
332
326
  };
333
327
 
334
- #define LIBUSB_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */
328
+ #define LIBUSB_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */
335
329
 
336
330
  /** \ingroup libusb_desc
337
331
  * Endpoint transfer type. Values for bits 0:1 of the
338
332
  * \ref libusb_endpoint_descriptor::bmAttributes "endpoint attributes" field.
339
333
  */
340
- enum libusb_transfer_type {
334
+ enum libusb_endpoint_transfer_type {
341
335
  /** Control endpoint */
342
- LIBUSB_TRANSFER_TYPE_CONTROL = 0,
336
+ LIBUSB_ENDPOINT_TRANSFER_TYPE_CONTROL = 0x0,
343
337
 
344
338
  /** Isochronous endpoint */
345
- LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1,
339
+ LIBUSB_ENDPOINT_TRANSFER_TYPE_ISOCHRONOUS = 0x1,
346
340
 
347
341
  /** Bulk endpoint */
348
- LIBUSB_TRANSFER_TYPE_BULK = 2,
342
+ LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK = 0x2,
349
343
 
350
344
  /** Interrupt endpoint */
351
- LIBUSB_TRANSFER_TYPE_INTERRUPT = 3,
352
-
353
- /** Stream endpoint */
354
- LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4,
345
+ LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT = 0x3
355
346
  };
356
347
 
357
348
  /** \ingroup libusb_misc
@@ -386,20 +377,20 @@ enum libusb_standard_request {
386
377
  LIBUSB_REQUEST_SET_CONFIGURATION = 0x09,
387
378
 
388
379
  /** Return the selected alternate setting for the specified interface */
389
- LIBUSB_REQUEST_GET_INTERFACE = 0x0A,
380
+ LIBUSB_REQUEST_GET_INTERFACE = 0x0a,
390
381
 
391
382
  /** Select an alternate interface for the specified interface */
392
- LIBUSB_REQUEST_SET_INTERFACE = 0x0B,
383
+ LIBUSB_REQUEST_SET_INTERFACE = 0x0b,
393
384
 
394
385
  /** Set then report an endpoint's synchronization frame */
395
- LIBUSB_REQUEST_SYNCH_FRAME = 0x0C,
386
+ LIBUSB_REQUEST_SYNCH_FRAME = 0x0c,
396
387
 
397
388
  /** Sets both the U1 and U2 Exit Latency */
398
389
  LIBUSB_REQUEST_SET_SEL = 0x30,
399
390
 
400
391
  /** Delay from the time a host transmits a packet to the time it is
401
392
  * received by the device. */
402
- LIBUSB_SET_ISOCH_DELAY = 0x31,
393
+ LIBUSB_SET_ISOCH_DELAY = 0x31
403
394
  };
404
395
 
405
396
  /** \ingroup libusb_misc
@@ -435,10 +426,10 @@ enum libusb_request_recipient {
435
426
  LIBUSB_RECIPIENT_ENDPOINT = 0x02,
436
427
 
437
428
  /** Other */
438
- LIBUSB_RECIPIENT_OTHER = 0x03,
429
+ LIBUSB_RECIPIENT_OTHER = 0x03
439
430
  };
440
431
 
441
- #define LIBUSB_ISO_SYNC_TYPE_MASK 0x0C
432
+ #define LIBUSB_ISO_SYNC_TYPE_MASK 0x0c
442
433
 
443
434
  /** \ingroup libusb_desc
444
435
  * Synchronization type for isochronous endpoints. Values for bits 2:3 of the
@@ -447,19 +438,19 @@ enum libusb_request_recipient {
447
438
  */
448
439
  enum libusb_iso_sync_type {
449
440
  /** No synchronization */
450
- LIBUSB_ISO_SYNC_TYPE_NONE = 0,
441
+ LIBUSB_ISO_SYNC_TYPE_NONE = 0x0,
451
442
 
452
443
  /** Asynchronous */
453
- LIBUSB_ISO_SYNC_TYPE_ASYNC = 1,
444
+ LIBUSB_ISO_SYNC_TYPE_ASYNC = 0x1,
454
445
 
455
446
  /** Adaptive */
456
- LIBUSB_ISO_SYNC_TYPE_ADAPTIVE = 2,
447
+ LIBUSB_ISO_SYNC_TYPE_ADAPTIVE = 0x2,
457
448
 
458
449
  /** Synchronous */
459
- LIBUSB_ISO_SYNC_TYPE_SYNC = 3
450
+ LIBUSB_ISO_SYNC_TYPE_SYNC = 0x3
460
451
  };
461
452
 
462
- #define LIBUSB_ISO_USAGE_TYPE_MASK 0x30
453
+ #define LIBUSB_ISO_USAGE_TYPE_MASK 0x30
463
454
 
464
455
  /** \ingroup libusb_desc
465
456
  * Usage type for isochronous endpoints. Values for bits 4:5 of the
@@ -468,13 +459,68 @@ enum libusb_iso_sync_type {
468
459
  */
469
460
  enum libusb_iso_usage_type {
470
461
  /** Data endpoint */
471
- LIBUSB_ISO_USAGE_TYPE_DATA = 0,
462
+ LIBUSB_ISO_USAGE_TYPE_DATA = 0x0,
472
463
 
473
464
  /** Feedback endpoint */
474
- LIBUSB_ISO_USAGE_TYPE_FEEDBACK = 1,
465
+ LIBUSB_ISO_USAGE_TYPE_FEEDBACK = 0x1,
475
466
 
476
467
  /** Implicit feedback Data endpoint */
477
- LIBUSB_ISO_USAGE_TYPE_IMPLICIT = 2,
468
+ LIBUSB_ISO_USAGE_TYPE_IMPLICIT = 0x2
469
+ };
470
+
471
+ /** \ingroup libusb_desc
472
+ * Supported speeds (wSpeedSupported) bitfield. Indicates what
473
+ * speeds the device supports.
474
+ */
475
+ enum libusb_supported_speed {
476
+ /** Low speed operation supported (1.5MBit/s). */
477
+ LIBUSB_LOW_SPEED_OPERATION = (1 << 0),
478
+
479
+ /** Full speed operation supported (12MBit/s). */
480
+ LIBUSB_FULL_SPEED_OPERATION = (1 << 1),
481
+
482
+ /** High speed operation supported (480MBit/s). */
483
+ LIBUSB_HIGH_SPEED_OPERATION = (1 << 2),
484
+
485
+ /** Superspeed operation supported (5000MBit/s). */
486
+ LIBUSB_SUPER_SPEED_OPERATION = (1 << 3)
487
+ };
488
+
489
+ /** \ingroup libusb_desc
490
+ * Masks for the bits of the
491
+ * \ref libusb_usb_2_0_extension_descriptor::bmAttributes "bmAttributes" field
492
+ * of the USB 2.0 Extension descriptor.
493
+ */
494
+ enum libusb_usb_2_0_extension_attributes {
495
+ /** Supports Link Power Management (LPM) */
496
+ LIBUSB_BM_LPM_SUPPORT = (1 << 1)
497
+ };
498
+
499
+ /** \ingroup libusb_desc
500
+ * Masks for the bits of the
501
+ * \ref libusb_ss_usb_device_capability_descriptor::bmAttributes "bmAttributes" field
502
+ * field of the SuperSpeed USB Device Capability descriptor.
503
+ */
504
+ enum libusb_ss_usb_device_capability_attributes {
505
+ /** Supports Latency Tolerance Messages (LTM) */
506
+ LIBUSB_BM_LTM_SUPPORT = (1 << 1)
507
+ };
508
+
509
+ /** \ingroup libusb_desc
510
+ * USB capability types
511
+ */
512
+ enum libusb_bos_type {
513
+ /** Wireless USB device capability */
514
+ LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 0x01,
515
+
516
+ /** USB 2.0 extensions */
517
+ LIBUSB_BT_USB_2_0_EXTENSION = 0x02,
518
+
519
+ /** SuperSpeed USB device capability */
520
+ LIBUSB_BT_SS_USB_DEVICE_CAPABILITY = 0x03,
521
+
522
+ /** Container ID type */
523
+ LIBUSB_BT_CONTAINER_ID = 0x04
478
524
  };
479
525
 
480
526
  /** \ingroup libusb_desc
@@ -547,17 +593,15 @@ struct libusb_endpoint_descriptor {
547
593
 
548
594
  /** The address of the endpoint described by this descriptor. Bits 0:3 are
549
595
  * the endpoint number. Bits 4:6 are reserved. Bit 7 indicates direction,
550
- * see \ref libusb_endpoint_direction.
551
- */
596
+ * see \ref libusb_endpoint_direction. */
552
597
  uint8_t bEndpointAddress;
553
598
 
554
599
  /** Attributes which apply to the endpoint when it is configured using
555
600
  * the bConfigurationValue. Bits 0:1 determine the transfer type and
556
- * correspond to \ref libusb_transfer_type. Bits 2:3 are only used for
557
- * isochronous endpoints and correspond to \ref libusb_iso_sync_type.
601
+ * correspond to \ref libusb_endpoint_transfer_type. Bits 2:3 are only used
602
+ * for isochronous endpoints and correspond to \ref libusb_iso_sync_type.
558
603
  * Bits 4:5 are also only used for isochronous endpoints and correspond to
559
- * \ref libusb_iso_usage_type. Bits 6:7 are reserved.
560
- */
604
+ * \ref libusb_iso_usage_type. Bits 6:7 are reserved. */
561
605
  uint8_t bmAttributes;
562
606
 
563
607
  /** Maximum packet size this endpoint is capable of sending/receiving. */
@@ -698,7 +742,6 @@ struct libusb_config_descriptor {
698
742
  * host-endian format.
699
743
  */
700
744
  struct libusb_ss_endpoint_companion_descriptor {
701
-
702
745
  /** Size of this descriptor (in bytes) */
703
746
  uint8_t bLength;
704
747
 
@@ -707,19 +750,18 @@ struct libusb_ss_endpoint_companion_descriptor {
707
750
  * this context. */
708
751
  uint8_t bDescriptorType;
709
752
 
710
-
711
753
  /** The maximum number of packets the endpoint can send or
712
754
  * receive as part of a burst. */
713
755
  uint8_t bMaxBurst;
714
756
 
715
- /** In bulk EP: bits 4:0 represents the maximum number of
716
- * streams the EP supports. In isochronous EP: bits 1:0
717
- * represents the Mult - a zero based value that determines
718
- * the maximum number of packets within a service interval */
757
+ /** In bulk EP: bits 4:0 represents the maximum number of
758
+ * streams the EP supports. In isochronous EP: bits 1:0
759
+ * represents the Mult - a zero based value that determines
760
+ * the maximum number of packets within a service interval */
719
761
  uint8_t bmAttributes;
720
762
 
721
- /** The total number of bytes this EP will transfer every
722
- * service interval. valid only for periodic EPs. */
763
+ /** The total number of bytes this EP will transfer every
764
+ * service interval. Valid only for periodic EPs. */
723
765
  uint16_t wBytesPerInterval;
724
766
  };
725
767
 
@@ -730,15 +772,18 @@ struct libusb_ss_endpoint_companion_descriptor {
730
772
  */
731
773
  struct libusb_bos_dev_capability_descriptor {
732
774
  /** Size of this descriptor (in bytes) */
733
- uint8_t bLength;
775
+ uint8_t bLength;
776
+
734
777
  /** Descriptor type. Will have value
735
778
  * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY
736
779
  * LIBUSB_DT_DEVICE_CAPABILITY in this context. */
737
- uint8_t bDescriptorType;
780
+ uint8_t bDescriptorType;
781
+
738
782
  /** Device Capability type */
739
- uint8_t bDevCapabilityType;
783
+ uint8_t bDevCapabilityType;
784
+
740
785
  /** Device Capability data (bLength - 3 bytes) */
741
- uint8_t dev_capability_data[ZERO_SIZED_ARRAY];
786
+ uint8_t dev_capability_data[ZERO_SIZED_ARRAY];
742
787
  };
743
788
 
744
789
  /** \ingroup libusb_desc
@@ -789,7 +834,7 @@ struct libusb_usb_2_0_extension_descriptor {
789
834
  * A value of one in a bit location indicates a feature is
790
835
  * supported; a value of zero indicates it is not supported.
791
836
  * See \ref libusb_usb_2_0_extension_attributes. */
792
- uint32_t bmAttributes;
837
+ uint32_t bmAttributes;
793
838
  };
794
839
 
795
840
  /** \ingroup libusb_desc
@@ -854,7 +899,7 @@ struct libusb_container_id_descriptor {
854
899
  uint8_t bDevCapabilityType;
855
900
 
856
901
  /** Reserved field */
857
- uint8_t bReserved;
902
+ uint8_t bReserved;
858
903
 
859
904
  /** 128 bit UUID */
860
905
  uint8_t ContainerID[16];
@@ -862,6 +907,9 @@ struct libusb_container_id_descriptor {
862
907
 
863
908
  /** \ingroup libusb_asyncio
864
909
  * Setup packet for control transfers. */
910
+ #if defined(_MSC_VER) || defined(__WATCOMC__)
911
+ #pragma pack(push, 1)
912
+ #endif
865
913
  struct libusb_control_setup {
866
914
  /** Request type. Bits 0:4 determine recipient, see
867
915
  * \ref libusb_request_recipient. Bits 5:6 determine type, see
@@ -886,7 +934,10 @@ struct libusb_control_setup {
886
934
 
887
935
  /** Number of bytes to transfer */
888
936
  uint16_t wLength;
889
- };
937
+ } LIBUSB_PACKED;
938
+ #if defined(_MSC_VER) || defined(__WATCOMC__)
939
+ #pragma pack(pop)
940
+ #endif
890
941
 
891
942
  #define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup))
892
943
 
@@ -916,7 +967,7 @@ struct libusb_version {
916
967
  const char *rc;
917
968
 
918
969
  /** For ABI compatibility only. */
919
- const char* describe;
970
+ const char *describe;
920
971
  };
921
972
 
922
973
  /** \ingroup libusb_lib
@@ -931,8 +982,9 @@ struct libusb_version {
931
982
  * Sessions are created by libusb_init() and destroyed through libusb_exit().
932
983
  * If your application is guaranteed to only ever include a single libusb
933
984
  * user (i.e. you), you do not have to worry about contexts: pass NULL in
934
- * every function call where a context is required. The default context
935
- * will be used.
985
+ * every function call where a context is required, and the default context
986
+ * will be used. Note that libusb_set_option(NULL, ...) is special, and adds
987
+ * an option to a list of default options for new contexts.
936
988
  *
937
989
  * For more information, see \ref libusb_contexts.
938
990
  */
@@ -941,7 +993,7 @@ typedef struct libusb_context libusb_context;
941
993
  /** \ingroup libusb_dev
942
994
  * Structure representing a USB device detected on the system. This is an
943
995
  * opaque type for which you are only ever provided with a pointer, usually
944
- * originating from libusb_get_device_list().
996
+ * originating from libusb_get_device_list() or libusb_hotplug_register_callback().
945
997
  *
946
998
  * Certain operations can be performed on a device, but in order to do any
947
999
  * I/O you will have to first obtain a device handle using libusb_open().
@@ -986,62 +1038,7 @@ enum libusb_speed {
986
1038
  LIBUSB_SPEED_SUPER = 4,
987
1039
 
988
1040
  /** The device is operating at super speed plus (10000MBit/s). */
989
- LIBUSB_SPEED_SUPER_PLUS = 5,
990
- };
991
-
992
- /** \ingroup libusb_dev
993
- * Supported speeds (wSpeedSupported) bitfield. Indicates what
994
- * speeds the device supports.
995
- */
996
- enum libusb_supported_speed {
997
- /** Low speed operation supported (1.5MBit/s). */
998
- LIBUSB_LOW_SPEED_OPERATION = 1,
999
-
1000
- /** Full speed operation supported (12MBit/s). */
1001
- LIBUSB_FULL_SPEED_OPERATION = 2,
1002
-
1003
- /** High speed operation supported (480MBit/s). */
1004
- LIBUSB_HIGH_SPEED_OPERATION = 4,
1005
-
1006
- /** Superspeed operation supported (5000MBit/s). */
1007
- LIBUSB_SUPER_SPEED_OPERATION = 8,
1008
- };
1009
-
1010
- /** \ingroup libusb_dev
1011
- * Masks for the bits of the
1012
- * \ref libusb_usb_2_0_extension_descriptor::bmAttributes "bmAttributes" field
1013
- * of the USB 2.0 Extension descriptor.
1014
- */
1015
- enum libusb_usb_2_0_extension_attributes {
1016
- /** Supports Link Power Management (LPM) */
1017
- LIBUSB_BM_LPM_SUPPORT = 2,
1018
- };
1019
-
1020
- /** \ingroup libusb_dev
1021
- * Masks for the bits of the
1022
- * \ref libusb_ss_usb_device_capability_descriptor::bmAttributes "bmAttributes" field
1023
- * field of the SuperSpeed USB Device Capability descriptor.
1024
- */
1025
- enum libusb_ss_usb_device_capability_attributes {
1026
- /** Supports Latency Tolerance Messages (LTM) */
1027
- LIBUSB_BM_LTM_SUPPORT = 2,
1028
- };
1029
-
1030
- /** \ingroup libusb_dev
1031
- * USB capability types
1032
- */
1033
- enum libusb_bos_type {
1034
- /** Wireless USB device capability */
1035
- LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 1,
1036
-
1037
- /** USB 2.0 extensions */
1038
- LIBUSB_BT_USB_2_0_EXTENSION = 2,
1039
-
1040
- /** SuperSpeed USB device capability */
1041
- LIBUSB_BT_SS_USB_DEVICE_CAPABILITY = 3,
1042
-
1043
- /** Container ID type */
1044
- LIBUSB_BT_CONTAINER_ID = 4,
1041
+ LIBUSB_SPEED_SUPER_PLUS = 5
1045
1042
  };
1046
1043
 
1047
1044
  /** \ingroup libusb_misc
@@ -1095,12 +1092,31 @@ enum libusb_error {
1095
1092
  message strings in strerror.c when adding new error codes here. */
1096
1093
 
1097
1094
  /** Other error */
1098
- LIBUSB_ERROR_OTHER = -99,
1095
+ LIBUSB_ERROR_OTHER = -99
1099
1096
  };
1100
1097
 
1101
1098
  /* Total number of error codes in enum libusb_error */
1102
1099
  #define LIBUSB_ERROR_COUNT 14
1103
1100
 
1101
+ /** \ingroup libusb_asyncio
1102
+ * Transfer type */
1103
+ enum libusb_transfer_type {
1104
+ /** Control transfer */
1105
+ LIBUSB_TRANSFER_TYPE_CONTROL = 0U,
1106
+
1107
+ /** Isochronous transfer */
1108
+ LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1U,
1109
+
1110
+ /** Bulk transfer */
1111
+ LIBUSB_TRANSFER_TYPE_BULK = 2U,
1112
+
1113
+ /** Interrupt transfer */
1114
+ LIBUSB_TRANSFER_TYPE_INTERRUPT = 3U,
1115
+
1116
+ /** Bulk stream transfer */
1117
+ LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4U
1118
+ };
1119
+
1104
1120
  /** \ingroup libusb_asyncio
1105
1121
  * Transfer status codes */
1106
1122
  enum libusb_transfer_status {
@@ -1125,7 +1141,7 @@ enum libusb_transfer_status {
1125
1141
  LIBUSB_TRANSFER_NO_DEVICE,
1126
1142
 
1127
1143
  /** Device sent more data than requested */
1128
- LIBUSB_TRANSFER_OVERFLOW,
1144
+ LIBUSB_TRANSFER_OVERFLOW
1129
1145
 
1130
1146
  /* NB! Remember to update libusb_error_name()
1131
1147
  when adding new status codes here. */
@@ -1135,19 +1151,19 @@ enum libusb_transfer_status {
1135
1151
  * libusb_transfer.flags values */
1136
1152
  enum libusb_transfer_flags {
1137
1153
  /** Report short frames as errors */
1138
- LIBUSB_TRANSFER_SHORT_NOT_OK = 1U << 0,
1154
+ LIBUSB_TRANSFER_SHORT_NOT_OK = (1U << 0),
1139
1155
 
1140
1156
  /** Automatically free() transfer buffer during libusb_free_transfer().
1141
1157
  * Note that buffers allocated with libusb_dev_mem_alloc() should not
1142
1158
  * be attempted freed in this way, since free() is not an appropriate
1143
1159
  * way to release such memory. */
1144
- LIBUSB_TRANSFER_FREE_BUFFER = 1U << 1,
1160
+ LIBUSB_TRANSFER_FREE_BUFFER = (1U << 1),
1145
1161
 
1146
1162
  /** Automatically call libusb_free_transfer() after callback returns.
1147
1163
  * If this flag is set, it is illegal to call libusb_free_transfer()
1148
1164
  * from your transfer callback, as this will result in a double-free
1149
1165
  * when this flag is acted upon. */
1150
- LIBUSB_TRANSFER_FREE_TRANSFER = 1U << 2,
1166
+ LIBUSB_TRANSFER_FREE_TRANSFER = (1U << 2),
1151
1167
 
1152
1168
  /** Terminate transfers that are a multiple of the endpoint's
1153
1169
  * wMaxPacketSize with an extra zero length packet. This is useful
@@ -1172,7 +1188,7 @@ enum libusb_transfer_flags {
1172
1188
  *
1173
1189
  * Available since libusb-1.0.9.
1174
1190
  */
1175
- LIBUSB_TRANSFER_ADD_ZERO_PACKET = 1U << 3,
1191
+ LIBUSB_TRANSFER_ADD_ZERO_PACKET = (1U << 3)
1176
1192
  };
1177
1193
 
1178
1194
  /** \ingroup libusb_asyncio
@@ -1217,7 +1233,7 @@ struct libusb_transfer {
1217
1233
  /** Address of the endpoint where this transfer will be sent. */
1218
1234
  unsigned char endpoint;
1219
1235
 
1220
- /** Type of the endpoint from \ref libusb_transfer_type */
1236
+ /** Type of the transfer from \ref libusb_transfer_type */
1221
1237
  unsigned char type;
1222
1238
 
1223
1239
  /** Timeout for this transfer in milliseconds. A value of 0 indicates no
@@ -1245,7 +1261,16 @@ struct libusb_transfer {
1245
1261
  * fails, or is cancelled. */
1246
1262
  libusb_transfer_cb_fn callback;
1247
1263
 
1248
- /** User context data to pass to the callback function. */
1264
+ /** User context data. Useful for associating specific data to a transfer
1265
+ * that can be accessed from within the callback function.
1266
+ *
1267
+ * This field may be set manually or is taken as the `user_data` parameter
1268
+ * of the following functions:
1269
+ * - libusb_fill_bulk_transfer()
1270
+ * - libusb_fill_bulk_stream_transfer()
1271
+ * - libusb_fill_control_transfer()
1272
+ * - libusb_fill_interrupt_transfer()
1273
+ * - libusb_fill_iso_transfer() */
1249
1274
  void *user_data;
1250
1275
 
1251
1276
  /** Data buffer */
@@ -1266,46 +1291,55 @@ struct libusb_transfer {
1266
1291
  */
1267
1292
  enum libusb_capability {
1268
1293
  /** The libusb_has_capability() API is available. */
1269
- LIBUSB_CAP_HAS_CAPABILITY = 0x0000,
1294
+ LIBUSB_CAP_HAS_CAPABILITY = 0x0000U,
1295
+
1270
1296
  /** Hotplug support is available on this platform. */
1271
- LIBUSB_CAP_HAS_HOTPLUG = 0x0001,
1297
+ LIBUSB_CAP_HAS_HOTPLUG = 0x0001U,
1298
+
1272
1299
  /** The library can access HID devices without requiring user intervention.
1273
1300
  * Note that before being able to actually access an HID device, you may
1274
1301
  * still have to call additional libusb functions such as
1275
1302
  * \ref libusb_detach_kernel_driver(). */
1276
- LIBUSB_CAP_HAS_HID_ACCESS = 0x0100,
1277
- /** The library supports detaching of the default USB driver, using
1303
+ LIBUSB_CAP_HAS_HID_ACCESS = 0x0100U,
1304
+
1305
+ /** The library supports detaching of the default USB driver, using
1278
1306
  * \ref libusb_detach_kernel_driver(), if one is set by the OS kernel */
1279
- LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101
1307
+ LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101U
1280
1308
  };
1281
1309
 
1282
1310
  /** \ingroup libusb_lib
1283
1311
  * Log message levels.
1284
- * - LIBUSB_LOG_LEVEL_NONE (0) : no messages ever printed by the library (default)
1285
- * - LIBUSB_LOG_LEVEL_ERROR (1) : error messages are printed to stderr
1286
- * - LIBUSB_LOG_LEVEL_WARNING (2) : warning and error messages are printed to stderr
1287
- * - LIBUSB_LOG_LEVEL_INFO (3) : informational messages are printed to stderr
1288
- * - LIBUSB_LOG_LEVEL_DEBUG (4) : debug and informational messages are printed to stderr
1289
1312
  */
1290
1313
  enum libusb_log_level {
1314
+ /** (0) : No messages ever emitted by the library (default) */
1291
1315
  LIBUSB_LOG_LEVEL_NONE = 0,
1316
+
1317
+ /** (1) : Error messages are emitted */
1292
1318
  LIBUSB_LOG_LEVEL_ERROR = 1,
1319
+
1320
+ /** (2) : Warning and error messages are emitted */
1293
1321
  LIBUSB_LOG_LEVEL_WARNING = 2,
1322
+
1323
+ /** (3) : Informational, warning and error messages are emitted */
1294
1324
  LIBUSB_LOG_LEVEL_INFO = 3,
1295
- LIBUSB_LOG_LEVEL_DEBUG = 4,
1325
+
1326
+ /** (4) : All messages are emitted */
1327
+ LIBUSB_LOG_LEVEL_DEBUG = 4
1296
1328
  };
1297
1329
 
1298
1330
  /** \ingroup libusb_lib
1299
1331
  * Log callback mode.
1332
+ *
1333
+ * Since version 1.0.23, \ref LIBUSB_API_VERSION >= 0x01000107
1334
+ *
1300
1335
  * \see libusb_set_log_cb()
1301
1336
  */
1302
1337
  enum libusb_log_cb_mode {
1338
+ /** Callback function handling all log messages. */
1339
+ LIBUSB_LOG_CB_GLOBAL = (1 << 0),
1303
1340
 
1304
- /** Callback function handling all log mesages. */
1305
- LIBUSB_LOG_CB_GLOBAL = 1 << 0,
1306
-
1307
- /** Callback function handling context related log mesages. */
1308
- LIBUSB_LOG_CB_CONTEXT = 1 << 1
1341
+ /** Callback function handling context related log messages. */
1342
+ LIBUSB_LOG_CB_CONTEXT = (1 << 1)
1309
1343
  };
1310
1344
 
1311
1345
  /** \ingroup libusb_lib
@@ -1314,6 +1348,9 @@ enum libusb_log_cb_mode {
1314
1348
  * is a global log message
1315
1349
  * \param level the log level, see \ref libusb_log_level for a description
1316
1350
  * \param str the log message
1351
+ *
1352
+ * Since version 1.0.23, \ref LIBUSB_API_VERSION >= 0x01000107
1353
+ *
1317
1354
  * \see libusb_set_log_cb()
1318
1355
  */
1319
1356
  typedef void (LIBUSB_CALL *libusb_log_cb)(libusb_context *ctx,
@@ -1328,7 +1365,7 @@ const struct libusb_version * LIBUSB_CALL libusb_get_version(void);
1328
1365
  int LIBUSB_CALL libusb_has_capability(uint32_t capability);
1329
1366
  const char * LIBUSB_CALL libusb_error_name(int errcode);
1330
1367
  int LIBUSB_CALL libusb_setlocale(const char *locale);
1331
- const char * LIBUSB_CALL libusb_strerror(enum libusb_error errcode);
1368
+ const char * LIBUSB_CALL libusb_strerror(int errcode);
1332
1369
 
1333
1370
  ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx,
1334
1371
  libusb_device ***list);
@@ -1350,7 +1387,7 @@ int LIBUSB_CALL libusb_get_config_descriptor_by_value(libusb_device *dev,
1350
1387
  void LIBUSB_CALL libusb_free_config_descriptor(
1351
1388
  struct libusb_config_descriptor *config);
1352
1389
  int LIBUSB_CALL libusb_get_ss_endpoint_companion_descriptor(
1353
- struct libusb_context *ctx,
1390
+ libusb_context *ctx,
1354
1391
  const struct libusb_endpoint_descriptor *endpoint,
1355
1392
  struct libusb_ss_endpoint_companion_descriptor **ep_comp);
1356
1393
  void LIBUSB_CALL libusb_free_ss_endpoint_companion_descriptor(
@@ -1359,27 +1396,27 @@ int LIBUSB_CALL libusb_get_bos_descriptor(libusb_device_handle *dev_handle,
1359
1396
  struct libusb_bos_descriptor **bos);
1360
1397
  void LIBUSB_CALL libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos);
1361
1398
  int LIBUSB_CALL libusb_get_usb_2_0_extension_descriptor(
1362
- struct libusb_context *ctx,
1399
+ libusb_context *ctx,
1363
1400
  struct libusb_bos_dev_capability_descriptor *dev_cap,
1364
1401
  struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension);
1365
1402
  void LIBUSB_CALL libusb_free_usb_2_0_extension_descriptor(
1366
1403
  struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension);
1367
1404
  int LIBUSB_CALL libusb_get_ss_usb_device_capability_descriptor(
1368
- struct libusb_context *ctx,
1405
+ libusb_context *ctx,
1369
1406
  struct libusb_bos_dev_capability_descriptor *dev_cap,
1370
1407
  struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap);
1371
1408
  void LIBUSB_CALL libusb_free_ss_usb_device_capability_descriptor(
1372
1409
  struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap);
1373
- int LIBUSB_CALL libusb_get_container_id_descriptor(struct libusb_context *ctx,
1410
+ int LIBUSB_CALL libusb_get_container_id_descriptor(libusb_context *ctx,
1374
1411
  struct libusb_bos_dev_capability_descriptor *dev_cap,
1375
1412
  struct libusb_container_id_descriptor **container_id);
1376
1413
  void LIBUSB_CALL libusb_free_container_id_descriptor(
1377
1414
  struct libusb_container_id_descriptor *container_id);
1378
1415
  uint8_t LIBUSB_CALL libusb_get_bus_number(libusb_device *dev);
1379
1416
  uint8_t LIBUSB_CALL libusb_get_port_number(libusb_device *dev);
1380
- int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t* port_numbers, int port_numbers_len);
1417
+ int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t *port_numbers, int port_numbers_len);
1381
1418
  LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers)
1382
- int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t* path, uint8_t path_length);
1419
+ int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *path, uint8_t path_length);
1383
1420
  libusb_device * LIBUSB_CALL libusb_get_parent(libusb_device *dev);
1384
1421
  uint8_t LIBUSB_CALL libusb_get_device_address(libusb_device *dev);
1385
1422
  int LIBUSB_CALL libusb_get_device_speed(libusb_device *dev);
@@ -1463,7 +1500,7 @@ static inline unsigned char *libusb_control_transfer_get_data(
1463
1500
  static inline struct libusb_control_setup *libusb_control_transfer_get_setup(
1464
1501
  struct libusb_transfer *transfer)
1465
1502
  {
1466
- return (struct libusb_control_setup *)(void *) transfer->buffer;
1503
+ return (struct libusb_control_setup *)(void *)transfer->buffer;
1467
1504
  }
1468
1505
 
1469
1506
  /** \ingroup libusb_asyncio
@@ -1493,7 +1530,7 @@ static inline void libusb_fill_control_setup(unsigned char *buffer,
1493
1530
  uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
1494
1531
  uint16_t wLength)
1495
1532
  {
1496
- struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *) buffer;
1533
+ struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)buffer;
1497
1534
  setup->bmRequestType = bmRequestType;
1498
1535
  setup->bRequest = bRequest;
1499
1536
  setup->wValue = libusb_cpu_to_le16(wValue);
@@ -1543,7 +1580,7 @@ static inline void libusb_fill_control_transfer(
1543
1580
  unsigned char *buffer, libusb_transfer_cb_fn callback, void *user_data,
1544
1581
  unsigned int timeout)
1545
1582
  {
1546
- struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *) buffer;
1583
+ struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)buffer;
1547
1584
  transfer->dev_handle = dev_handle;
1548
1585
  transfer->endpoint = 0;
1549
1586
  transfer->type = LIBUSB_TRANSFER_TYPE_CONTROL;
@@ -1682,6 +1719,7 @@ static inline void libusb_set_iso_packet_lengths(
1682
1719
  struct libusb_transfer *transfer, unsigned int length)
1683
1720
  {
1684
1721
  int i;
1722
+
1685
1723
  for (i = 0; i < transfer->num_iso_packets; i++)
1686
1724
  transfer->iso_packet_desc[i].length = length;
1687
1725
  }
@@ -1896,7 +1934,7 @@ void LIBUSB_CALL libusb_set_pollfd_notifiers(libusb_context *ctx,
1896
1934
  * Callbacks handles are generated by libusb_hotplug_register_callback()
1897
1935
  * and can be used to deregister callbacks. Callback handles are unique
1898
1936
  * per libusb_context and it is safe to call libusb_hotplug_deregister_callback()
1899
- * on an already deregisted callback.
1937
+ * on an already deregistered callback.
1900
1938
  *
1901
1939
  * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
1902
1940
  *
@@ -1908,29 +1946,30 @@ typedef int libusb_hotplug_callback_handle;
1908
1946
  *
1909
1947
  * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
1910
1948
  *
1911
- * Flags for hotplug events */
1949
+ * Hotplug events */
1912
1950
  typedef enum {
1913
- /** Default value when not using any flags. */
1914
- LIBUSB_HOTPLUG_NO_FLAGS = 0U,
1951
+ /** A device has been plugged in and is ready to use */
1952
+ LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = (1 << 0),
1915
1953
 
1916
- /** Arm the callback and fire it for all matching currently attached devices. */
1917
- LIBUSB_HOTPLUG_ENUMERATE = 1U << 0,
1918
- } libusb_hotplug_flag;
1954
+ /** A device has left and is no longer available.
1955
+ * It is the user's responsibility to call libusb_close on any handle associated with a disconnected device.
1956
+ * It is safe to call libusb_get_device_descriptor on a device that has left */
1957
+ LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = (1 << 1)
1958
+ } libusb_hotplug_event;
1919
1959
 
1920
1960
  /** \ingroup libusb_hotplug
1921
1961
  *
1922
1962
  * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
1923
1963
  *
1924
- * Hotplug events */
1964
+ * Hotplug flags */
1925
1965
  typedef enum {
1926
- /** A device has been plugged in and is ready to use */
1927
- LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = 0x01U,
1966
+ /** Arm the callback and fire it for all matching currently attached devices. */
1967
+ LIBUSB_HOTPLUG_ENUMERATE = (1 << 0)
1968
+ } libusb_hotplug_flag;
1928
1969
 
1929
- /** A device has left and is no longer available.
1930
- * It is the user's responsibility to call libusb_close on any handle associated with a disconnected device.
1931
- * It is safe to call libusb_get_device_descriptor on a device that has left */
1932
- LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = 0x02U,
1933
- } libusb_hotplug_event;
1970
+ /** \ingroup libusb_hotplug
1971
+ * Convenience macro when not using any flags */
1972
+ #define LIBUSB_HOTPLUG_NO_FLAGS 0
1934
1973
 
1935
1974
  /** \ingroup libusb_hotplug
1936
1975
  * Wildcard matching for hotplug events */
@@ -1959,9 +1998,7 @@ typedef enum {
1959
1998
  * returning 1 will cause this callback to be deregistered
1960
1999
  */
1961
2000
  typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx,
1962
- libusb_device *device,
1963
- libusb_hotplug_event event,
1964
- void *user_data);
2001
+ libusb_device *device, libusb_hotplug_event event, void *user_data);
1965
2002
 
1966
2003
  /** \ingroup libusb_hotplug
1967
2004
  * Register a hotplug callback function
@@ -1986,9 +2023,10 @@ typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx,
1986
2023
  * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102
1987
2024
  *
1988
2025
  * \param[in] ctx context to register this callback with
1989
- * \param[in] events bitwise or of events that will trigger this callback. See \ref
1990
- * libusb_hotplug_event
1991
- * \param[in] flags hotplug callback flags. See \ref libusb_hotplug_flag
2026
+ * \param[in] events bitwise or of hotplug events that will trigger this callback.
2027
+ * See \ref libusb_hotplug_event
2028
+ * \param[in] flags bitwise or of hotplug flags that affect registration.
2029
+ * See \ref libusb_hotplug_flag
1992
2030
  * \param[in] vendor_id the vendor id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY
1993
2031
  * \param[in] product_id the product id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY
1994
2032
  * \param[in] dev_class the device class to match or \ref LIBUSB_HOTPLUG_MATCH_ANY
@@ -1998,13 +2036,10 @@ typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx,
1998
2036
  * \returns LIBUSB_SUCCESS on success LIBUSB_ERROR code on failure
1999
2037
  */
2000
2038
  int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx,
2001
- libusb_hotplug_event events,
2002
- libusb_hotplug_flag flags,
2003
- int vendor_id, int product_id,
2004
- int dev_class,
2005
- libusb_hotplug_callback_fn cb_fn,
2006
- void *user_data,
2007
- libusb_hotplug_callback_handle *callback_handle);
2039
+ int events, int flags,
2040
+ int vendor_id, int product_id, int dev_class,
2041
+ libusb_hotplug_callback_fn cb_fn, void *user_data,
2042
+ libusb_hotplug_callback_handle *callback_handle);
2008
2043
 
2009
2044
  /** \ingroup libusb_hotplug
2010
2045
  * Deregisters a hotplug callback.
@@ -2018,7 +2053,18 @@ int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx,
2018
2053
  * \param[in] callback_handle the handle of the callback to deregister
2019
2054
  */
2020
2055
  void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx,
2021
- libusb_hotplug_callback_handle callback_handle);
2056
+ libusb_hotplug_callback_handle callback_handle);
2057
+
2058
+ /** \ingroup libusb_hotplug
2059
+ * Gets the user_data associated with a hotplug callback.
2060
+ *
2061
+ * Since version v1.0.24 \ref LIBUSB_API_VERSION >= 0x01000108
2062
+ *
2063
+ * \param[in] ctx context this callback is registered with
2064
+ * \param[in] callback_handle the handle of the callback to get the user_data of
2065
+ */
2066
+ void * LIBUSB_CALL libusb_hotplug_get_user_data(libusb_context *ctx,
2067
+ libusb_hotplug_callback_handle callback_handle);
2022
2068
 
2023
2069
  /** \ingroup libusb_lib
2024
2070
  * Available option values for libusb_set_option().
@@ -2045,7 +2091,7 @@ enum libusb_option {
2045
2091
  * If libusb was compiled with verbose debug message logging, this function
2046
2092
  * does nothing: you'll always get messages from all levels.
2047
2093
  */
2048
- LIBUSB_OPTION_LOG_LEVEL,
2094
+ LIBUSB_OPTION_LOG_LEVEL = 0,
2049
2095
 
2050
2096
  /** Use the UsbDk backend for a specific context, if available.
2051
2097
  *
@@ -2054,12 +2100,35 @@ enum libusb_option {
2054
2100
  *
2055
2101
  * Only valid on Windows.
2056
2102
  */
2057
- LIBUSB_OPTION_USE_USBDK,
2103
+ LIBUSB_OPTION_USE_USBDK = 1,
2104
+
2105
+ /** Do not scan for devices
2106
+ *
2107
+ * With this option set, libusb will skip scanning devices in
2108
+ * libusb_init(). Must be set before calling libusb_init().
2109
+ *
2110
+ * Hotplug functionality will also be deactivated.
2111
+ *
2112
+ * The option is useful in combination with libusb_wrap_sys_device(),
2113
+ * which can access a device directly without prior device scanning.
2114
+ *
2115
+ * This is typically needed on Android, where access to USB devices
2116
+ * is limited.
2117
+ *
2118
+ * For LIBUSB_API_VERSION 0x01000108 it was called LIBUSB_OPTION_WEAK_AUTHORITY
2119
+ *
2120
+ * Only valid on Linux.
2121
+ */
2122
+ LIBUSB_OPTION_NO_DEVICE_DISCOVERY = 2,
2123
+
2124
+ #define LIBUSB_OPTION_WEAK_AUTHORITY LIBUSB_OPTION_NO_DEVICE_DISCOVERY
2125
+
2126
+ LIBUSB_OPTION_MAX = 3
2058
2127
  };
2059
2128
 
2060
2129
  int LIBUSB_CALL libusb_set_option(libusb_context *ctx, enum libusb_option option, ...);
2061
2130
 
2062
- #ifdef __cplusplus
2131
+ #if defined(__cplusplus)
2063
2132
  }
2064
2133
  #endif
2065
2134