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.
Files changed (288) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +20 -2
  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/dist/usb/index.js +7 -16
  10. package/dist/usb/index.js.map +1 -1
  11. package/dist/webusb/webusb-device.d.ts +2 -1
  12. package/dist/webusb/webusb-device.js +21 -14
  13. package/dist/webusb/webusb-device.js.map +1 -1
  14. package/libusb/.gitattributes +2 -6
  15. package/libusb/.private/appveyor_build.sh +22 -0
  16. package/libusb/.private/bm.sh +1 -1
  17. package/libusb/.private/ci-build.sh +67 -0
  18. package/libusb/.private/ci-container-build.sh +70 -0
  19. package/libusb/.private/post-rewrite.sh +5 -1
  20. package/libusb/.private/pre-commit.sh +5 -1
  21. package/libusb/.private/wbs.txt +4 -19
  22. package/libusb/.travis.yml +32 -23
  23. package/libusb/AUTHORS +86 -3
  24. package/libusb/ChangeLog +54 -3
  25. package/libusb/INSTALL_WIN.txt +22 -44
  26. package/libusb/Makefile.am +32 -10
  27. package/libusb/{README.md → README} +2 -2
  28. package/libusb/README.git +3 -3
  29. package/libusb/Xcode/common.xcconfig +23 -19
  30. package/libusb/Xcode/config.h +25 -13
  31. package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +511 -109
  32. package/libusb/android/README +90 -54
  33. package/libusb/android/config.h +23 -43
  34. package/libusb/android/examples/unrooted_android.c +300 -0
  35. package/libusb/android/examples/unrooted_android.h +36 -0
  36. package/libusb/android/jni/Android.mk +1 -1
  37. package/libusb/android/jni/Application.mk +16 -0
  38. package/libusb/android/jni/examples.mk +63 -29
  39. package/libusb/android/jni/libusb.mk +14 -8
  40. package/libusb/android/jni/tests.mk +13 -24
  41. package/libusb/appveyor.yml +73 -30
  42. package/libusb/autogen.sh +5 -3
  43. package/libusb/bootstrap.sh +6 -2
  44. package/libusb/configure.ac +314 -227
  45. package/libusb/doc/Makefile.in +22 -0
  46. package/libusb/doc/doxygen.cfg.in +460 -223
  47. package/libusb/examples/Makefile.am +6 -13
  48. package/libusb/examples/dpfp.c +276 -73
  49. package/libusb/examples/ezusb.c +18 -8
  50. package/libusb/examples/ezusb.h +6 -17
  51. package/libusb/examples/fxload.c +4 -5
  52. package/libusb/examples/hotplugtest.c +1 -1
  53. package/libusb/examples/sam3u_benchmark.c +59 -24
  54. package/libusb/examples/testlibusb.c +138 -104
  55. package/libusb/examples/xusb.c +26 -22
  56. package/libusb/libusb/Makefile.am +57 -70
  57. package/libusb/libusb/Makefile.am.extra +26 -0
  58. package/libusb/libusb/core.c +432 -423
  59. package/libusb/libusb/descriptor.c +365 -419
  60. package/libusb/libusb/hotplug.c +200 -104
  61. package/libusb/libusb/io.c +522 -535
  62. package/libusb/libusb/libusb-1.0.def +7 -3
  63. package/libusb/libusb/libusb-1.0.rc +1 -9
  64. package/libusb/libusb/libusb.h +302 -226
  65. package/libusb/libusb/libusbi.h +607 -316
  66. package/libusb/libusb/os/darwin_usb.c +703 -329
  67. package/libusb/libusb/os/darwin_usb.h +39 -15
  68. package/libusb/libusb/os/events_posix.c +300 -0
  69. package/libusb/libusb/os/events_posix.h +59 -0
  70. package/libusb/libusb/os/events_windows.c +214 -0
  71. package/libusb/{msvc/missing.h → libusb/os/events_windows.h} +25 -11
  72. package/libusb/libusb/os/haiku_pollfs.cpp +14 -9
  73. package/libusb/libusb/os/haiku_usb.h +12 -12
  74. package/libusb/libusb/os/haiku_usb_backend.cpp +36 -37
  75. package/libusb/libusb/os/haiku_usb_raw.cpp +80 -116
  76. package/libusb/libusb/os/linux_netlink.c +55 -63
  77. package/libusb/libusb/os/linux_udev.c +61 -69
  78. package/libusb/libusb/os/linux_usbfs.c +926 -1015
  79. package/libusb/libusb/os/linux_usbfs.h +74 -57
  80. package/libusb/libusb/os/netbsd_usb.c +103 -168
  81. package/libusb/libusb/os/null_usb.c +111 -0
  82. package/libusb/libusb/os/openbsd_usb.c +71 -120
  83. package/libusb/libusb/os/sunos_usb.c +289 -375
  84. package/libusb/libusb/os/sunos_usb.h +0 -1
  85. package/libusb/libusb/os/threads_posix.c +81 -32
  86. package/libusb/libusb/os/threads_posix.h +19 -23
  87. package/libusb/libusb/os/threads_windows.c +9 -95
  88. package/libusb/libusb/os/threads_windows.h +33 -31
  89. package/libusb/libusb/os/windows_common.c +915 -0
  90. package/libusb/libusb/os/windows_common.h +330 -42
  91. package/libusb/libusb/os/windows_usbdk.c +161 -267
  92. package/libusb/libusb/os/windows_usbdk.h +5 -2
  93. package/libusb/libusb/os/windows_winusb.c +1355 -1192
  94. package/libusb/libusb/os/windows_winusb.h +167 -167
  95. package/libusb/libusb/strerror.c +20 -30
  96. package/libusb/libusb/sync.c +20 -21
  97. package/libusb/libusb/version.h +1 -1
  98. package/libusb/libusb/version_nano.h +1 -1
  99. package/libusb/msvc/.gitattributes +3 -0
  100. package/libusb/msvc/config.h +27 -20
  101. package/libusb/msvc/{hotplugtest_2012.vcxproj → dpfp_2013.vcxproj} +14 -10
  102. package/libusb/msvc/dpfp_2013.vcxproj.filters +26 -0
  103. package/libusb/msvc/{listdevs_2010.vcxproj → dpfp_2015.vcxproj} +14 -9
  104. package/libusb/msvc/dpfp_2015.vcxproj.filters +26 -0
  105. package/libusb/msvc/dpfp_2017.vcxproj +106 -0
  106. package/libusb/msvc/dpfp_2017.vcxproj.filters +26 -0
  107. package/libusb/msvc/dpfp_2019.vcxproj +106 -0
  108. package/libusb/msvc/dpfp_2019.vcxproj.filters +26 -0
  109. package/libusb/msvc/dpfp_threaded_2013.vcxproj +87 -0
  110. package/libusb/msvc/dpfp_threaded_2013.vcxproj.filters +26 -0
  111. package/libusb/msvc/dpfp_threaded_2015.vcxproj +87 -0
  112. package/libusb/msvc/dpfp_threaded_2015.vcxproj.filters +26 -0
  113. package/libusb/msvc/dpfp_threaded_2017.vcxproj +106 -0
  114. package/libusb/msvc/dpfp_threaded_2017.vcxproj.filters +26 -0
  115. package/libusb/msvc/{fxload_2012.vcxproj → dpfp_threaded_2019.vcxproj} +32 -17
  116. package/libusb/msvc/dpfp_threaded_2019.vcxproj.filters +26 -0
  117. package/libusb/msvc/fxload_2013.vcxproj +6 -3
  118. package/libusb/msvc/fxload_2013.vcxproj.filters +35 -0
  119. package/libusb/msvc/fxload_2015.vcxproj +6 -3
  120. package/libusb/msvc/fxload_2015.vcxproj.filters +35 -0
  121. package/libusb/msvc/fxload_2017.vcxproj +6 -7
  122. package/libusb/msvc/fxload_2017.vcxproj.filters +35 -0
  123. package/libusb/msvc/{fxload_2010.vcxproj → fxload_2019.vcxproj} +29 -6
  124. package/libusb/msvc/fxload_2019.vcxproj.filters +35 -0
  125. package/libusb/{examples → msvc}/getopt/getopt.c +0 -0
  126. package/libusb/{examples → msvc}/getopt/getopt.h +0 -0
  127. package/libusb/{examples → msvc}/getopt/getopt1.c +0 -0
  128. package/libusb/msvc/getopt_2013.vcxproj +4 -5
  129. package/libusb/msvc/getopt_2013.vcxproj.filters +26 -0
  130. package/libusb/msvc/getopt_2015.vcxproj +4 -4
  131. package/libusb/msvc/getopt_2015.vcxproj.filters +26 -0
  132. package/libusb/msvc/getopt_2017.vcxproj +4 -10
  133. package/libusb/msvc/getopt_2017.vcxproj.filters +26 -0
  134. package/libusb/msvc/{getopt_2012.vcxproj → getopt_2019.vcxproj} +25 -6
  135. package/libusb/msvc/getopt_2019.vcxproj.filters +26 -0
  136. package/libusb/msvc/hotplugtest_2013.vcxproj +6 -3
  137. package/libusb/msvc/hotplugtest_2013.vcxproj.filters +23 -0
  138. package/libusb/msvc/hotplugtest_2015.vcxproj +6 -3
  139. package/libusb/msvc/hotplugtest_2015.vcxproj.filters +23 -0
  140. package/libusb/msvc/hotplugtest_2017.vcxproj +6 -7
  141. package/libusb/msvc/hotplugtest_2017.vcxproj.filters +23 -0
  142. package/libusb/msvc/hotplugtest_2019.vcxproj +105 -0
  143. package/libusb/msvc/hotplugtest_2019.vcxproj.filters +23 -0
  144. package/libusb/msvc/libusb_2013.sln +50 -20
  145. package/libusb/msvc/libusb_2015.sln +51 -21
  146. package/libusb/msvc/libusb_2017.sln +90 -36
  147. package/libusb/msvc/libusb_2019.sln +240 -0
  148. package/libusb/msvc/libusb_dll_2013.vcxproj +6 -9
  149. package/libusb/msvc/libusb_dll_2013.vcxproj.filters +94 -0
  150. package/libusb/msvc/libusb_dll_2015.vcxproj +6 -8
  151. package/libusb/msvc/libusb_dll_2015.vcxproj.filters +94 -0
  152. package/libusb/msvc/libusb_dll_2017.vcxproj +6 -16
  153. package/libusb/msvc/libusb_dll_2017.vcxproj.filters +94 -0
  154. package/libusb/msvc/{libusb_dll_2010.vcxproj → libusb_dll_2019.vcxproj} +27 -9
  155. package/libusb/msvc/libusb_dll_2019.vcxproj.filters +94 -0
  156. package/libusb/msvc/libusb_static_2013.vcxproj +5 -9
  157. package/libusb/msvc/libusb_static_2013.vcxproj.filters +80 -0
  158. package/libusb/msvc/libusb_static_2015.vcxproj +5 -8
  159. package/libusb/msvc/libusb_static_2015.vcxproj.filters +80 -0
  160. package/libusb/msvc/libusb_static_2017.vcxproj +5 -8
  161. package/libusb/msvc/libusb_static_2017.vcxproj.filters +80 -0
  162. package/libusb/msvc/{libusb_static_2010.vcxproj → libusb_static_2019.vcxproj} +26 -9
  163. package/libusb/msvc/libusb_static_2019.vcxproj.filters +80 -0
  164. package/libusb/msvc/listdevs_2013.vcxproj +6 -3
  165. package/libusb/msvc/listdevs_2013.vcxproj.filters +23 -0
  166. package/libusb/msvc/listdevs_2015.vcxproj +6 -3
  167. package/libusb/msvc/listdevs_2015.vcxproj.filters +23 -0
  168. package/libusb/msvc/listdevs_2017.vcxproj +6 -7
  169. package/libusb/msvc/listdevs_2017.vcxproj.filters +23 -0
  170. package/libusb/msvc/listdevs_2019.vcxproj +105 -0
  171. package/libusb/msvc/listdevs_2019.vcxproj.filters +23 -0
  172. package/libusb/msvc/{listdevs_2012.vcxproj → sam3u_benchmark_2013.vcxproj} +13 -9
  173. package/libusb/msvc/sam3u_benchmark_2013.vcxproj.filters +26 -0
  174. package/libusb/msvc/{hotplugtest_2010.vcxproj → sam3u_benchmark_2015.vcxproj} +13 -8
  175. package/libusb/msvc/sam3u_benchmark_2015.vcxproj.filters +26 -0
  176. package/libusb/msvc/sam3u_benchmark_2017.vcxproj +106 -0
  177. package/libusb/msvc/sam3u_benchmark_2017.vcxproj.filters +26 -0
  178. package/libusb/msvc/sam3u_benchmark_2019.vcxproj +106 -0
  179. package/libusb/msvc/sam3u_benchmark_2019.vcxproj.filters +26 -0
  180. package/libusb/msvc/stress_2013.vcxproj +4 -2
  181. package/libusb/msvc/stress_2013.vcxproj.filters +32 -0
  182. package/libusb/msvc/stress_2015.vcxproj +4 -2
  183. package/libusb/msvc/stress_2015.vcxproj.filters +32 -0
  184. package/libusb/msvc/stress_2017.vcxproj +4 -6
  185. package/libusb/msvc/stress_2017.vcxproj.filters +32 -0
  186. package/libusb/msvc/{stress_2010.vcxproj → stress_2019.vcxproj} +26 -4
  187. package/libusb/msvc/stress_2019.vcxproj.filters +32 -0
  188. package/libusb/msvc/testlibusb_2013.vcxproj +6 -3
  189. package/libusb/msvc/testlibusb_2013.vcxproj.filters +23 -0
  190. package/libusb/msvc/testlibusb_2015.vcxproj +6 -3
  191. package/libusb/msvc/testlibusb_2015.vcxproj.filters +23 -0
  192. package/libusb/msvc/testlibusb_2017.vcxproj +6 -7
  193. package/libusb/msvc/testlibusb_2017.vcxproj.filters +23 -0
  194. package/libusb/msvc/{testlibusb_2010.vcxproj → testlibusb_2019.vcxproj} +28 -5
  195. package/libusb/msvc/testlibusb_2019.vcxproj.filters +23 -0
  196. package/libusb/msvc/xusb_2013.vcxproj +6 -3
  197. package/libusb/msvc/xusb_2013.vcxproj.filters +23 -0
  198. package/libusb/msvc/xusb_2015.vcxproj +6 -3
  199. package/libusb/msvc/xusb_2015.vcxproj.filters +23 -0
  200. package/libusb/msvc/xusb_2017.vcxproj +6 -7
  201. package/libusb/msvc/xusb_2017.vcxproj.filters +23 -0
  202. package/libusb/msvc/{xusb_2010.vcxproj → xusb_2019.vcxproj} +28 -5
  203. package/libusb/msvc/xusb_2019.vcxproj.filters +23 -0
  204. package/libusb/tests/Makefile.am +13 -1
  205. package/libusb/tests/libusb_testlib.h +12 -43
  206. package/libusb/tests/stress.c +59 -50
  207. package/libusb/tests/testlib.c +78 -171
  208. package/libusb/tests/umockdev.c +1175 -0
  209. package/libusb.gypi +10 -11
  210. package/package.json +2 -2
  211. package/prebuilds/android-arm/node.napi.armv7.node +0 -0
  212. package/prebuilds/android-arm64/node.napi.armv8.node +0 -0
  213. package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
  214. package/prebuilds/linux-arm/node.napi.armv6.node +0 -0
  215. package/prebuilds/linux-arm/node.napi.armv7.node +0 -0
  216. package/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
  217. package/prebuilds/linux-ia32/node.napi.node +0 -0
  218. package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  219. package/prebuilds/linux-x64/node.napi.musl.node +0 -0
  220. package/prebuilds/win32-ia32/node.napi.node +0 -0
  221. package/prebuilds/win32-x64/node.napi.node +0 -0
  222. package/src/device.cc +12 -7
  223. package/src/node_usb.cc +10 -0
  224. package/test/usb.coffee +6 -0
  225. package/tsc/index.ts +2 -0
  226. package/tsc/usb/bindings.ts +5 -0
  227. package/tsc/usb/device.ts +6 -0
  228. package/tsc/usb/index.ts +5 -8
  229. package/tsc/webusb/webusb-device.ts +12 -8
  230. package/libusb/.private/bd.cmd +0 -89
  231. package/libusb/.private/bwince.cmd +0 -57
  232. package/libusb/.private/wbs_wince.txt +0 -42
  233. package/libusb/Brewfile +0 -4
  234. package/libusb/appveyor_cygwin.bat +0 -11
  235. package/libusb/appveyor_minGW.bat +0 -19
  236. package/libusb/doc/Makefile.am +0 -9
  237. package/libusb/examples/dpfp_threaded.c +0 -557
  238. package/libusb/libusb/hotplug.h +0 -99
  239. package/libusb/libusb/os/poll_posix.c +0 -84
  240. package/libusb/libusb/os/poll_posix.h +0 -14
  241. package/libusb/libusb/os/poll_windows.c +0 -447
  242. package/libusb/libusb/os/poll_windows.h +0 -98
  243. package/libusb/libusb/os/wince_usb.c +0 -888
  244. package/libusb/libusb/os/wince_usb.h +0 -126
  245. package/libusb/libusb/os/windows_nt_common.c +0 -1010
  246. package/libusb/libusb/os/windows_nt_common.h +0 -110
  247. package/libusb/libusb/os/windows_nt_shared_types.h +0 -147
  248. package/libusb/msvc/appveyor.bat +0 -27
  249. package/libusb/msvc/ddk_build.cmd +0 -219
  250. package/libusb/msvc/errno.h +0 -102
  251. package/libusb/msvc/fxload_sources +0 -23
  252. package/libusb/msvc/getopt_2005.vcproj +0 -288
  253. package/libusb/msvc/getopt_2010.vcxproj +0 -72
  254. package/libusb/msvc/getopt_sources +0 -24
  255. package/libusb/msvc/hotplugtest_sources +0 -20
  256. package/libusb/msvc/inttypes.h +0 -295
  257. package/libusb/msvc/libusb.dsw +0 -71
  258. package/libusb/msvc/libusb_2005.sln +0 -95
  259. package/libusb/msvc/libusb_2010.sln +0 -105
  260. package/libusb/msvc/libusb_2012.sln +0 -105
  261. package/libusb/msvc/libusb_dll.dsp +0 -194
  262. package/libusb/msvc/libusb_dll_2005.vcproj +0 -464
  263. package/libusb/msvc/libusb_dll_2012.vcxproj +0 -107
  264. package/libusb/msvc/libusb_dll_wince.vcproj +0 -1251
  265. package/libusb/msvc/libusb_sources +0 -43
  266. package/libusb/msvc/libusb_static.dsp +0 -174
  267. package/libusb/msvc/libusb_static_2005.vcproj +0 -390
  268. package/libusb/msvc/libusb_static_2012.vcxproj +0 -98
  269. package/libusb/msvc/libusb_static_wince.vcproj +0 -1179
  270. package/libusb/msvc/libusb_wince.sln +0 -246
  271. package/libusb/msvc/listdevs.dsp +0 -103
  272. package/libusb/msvc/listdevs_2005.vcproj +0 -360
  273. package/libusb/msvc/listdevs_sources +0 -20
  274. package/libusb/msvc/listdevs_wince.vcproj +0 -1120
  275. package/libusb/msvc/missing.c +0 -80
  276. package/libusb/msvc/stdint.h +0 -256
  277. package/libusb/msvc/stress_2005.vcproj +0 -390
  278. package/libusb/msvc/stress_2012.vcxproj +0 -87
  279. package/libusb/msvc/stress_sources +0 -21
  280. package/libusb/msvc/stress_wince.vcproj +0 -1128
  281. package/libusb/msvc/testlibusb_2012.vcxproj +0 -83
  282. package/libusb/msvc/testlibusb_sources +0 -20
  283. package/libusb/msvc/xusb.dsp +0 -102
  284. package/libusb/msvc/xusb_2005.vcproj +0 -344
  285. package/libusb/msvc/xusb_2012.vcxproj +0 -83
  286. package/libusb/msvc/xusb_sources +0 -20
  287. package/libusb/msvc/xusb_wince.vcproj +0 -1120
  288. package/libusb/travis-autogen.sh +0 -39
@@ -36,8 +36,7 @@ struct device_priv {
36
36
  char devnode[16];
37
37
  int fd;
38
38
 
39
- unsigned char *cdesc; /* active config descriptor */
40
- usb_device_descriptor_t ddesc; /* usb device descriptor */
39
+ usb_config_descriptor_t *cdesc; /* active config descriptor */
41
40
  };
42
41
 
43
42
  struct handle_priv {
@@ -52,30 +51,25 @@ static int netbsd_get_device_list(struct libusb_context *,
52
51
  static int netbsd_open(struct libusb_device_handle *);
53
52
  static void netbsd_close(struct libusb_device_handle *);
54
53
 
55
- static int netbsd_get_device_descriptor(struct libusb_device *, unsigned char *,
56
- int *);
57
54
  static int netbsd_get_active_config_descriptor(struct libusb_device *,
58
- unsigned char *, size_t, int *);
55
+ void *, size_t);
59
56
  static int netbsd_get_config_descriptor(struct libusb_device *, uint8_t,
60
- unsigned char *, size_t, int *);
57
+ void *, size_t);
61
58
 
62
- static int netbsd_get_configuration(struct libusb_device_handle *, int *);
59
+ static int netbsd_get_configuration(struct libusb_device_handle *, uint8_t *);
63
60
  static int netbsd_set_configuration(struct libusb_device_handle *, int);
64
61
 
65
- static int netbsd_claim_interface(struct libusb_device_handle *, int);
66
- static int netbsd_release_interface(struct libusb_device_handle *, int);
62
+ static int netbsd_claim_interface(struct libusb_device_handle *, uint8_t);
63
+ static int netbsd_release_interface(struct libusb_device_handle *, uint8_t);
67
64
 
68
- static int netbsd_set_interface_altsetting(struct libusb_device_handle *, int,
69
- int);
65
+ static int netbsd_set_interface_altsetting(struct libusb_device_handle *,
66
+ uint8_t, uint8_t);
70
67
  static int netbsd_clear_halt(struct libusb_device_handle *, unsigned char);
71
- static int netbsd_reset_device(struct libusb_device_handle *);
72
68
  static void netbsd_destroy_device(struct libusb_device *);
73
69
 
74
70
  static int netbsd_submit_transfer(struct usbi_transfer *);
75
71
  static int netbsd_cancel_transfer(struct usbi_transfer *);
76
- static void netbsd_clear_transfer_priv(struct usbi_transfer *);
77
72
  static int netbsd_handle_transfer_completion(struct usbi_transfer *);
78
- static int netbsd_clock_gettime(int, struct timespec *);
79
73
 
80
74
  /*
81
75
  * Private functions
@@ -87,55 +81,33 @@ static int _sync_gen_transfer(struct usbi_transfer *);
87
81
  static int _access_endpoint(struct libusb_transfer *);
88
82
 
89
83
  const struct usbi_os_backend usbi_backend = {
90
- "Synchronous NetBSD backend",
91
- 0,
92
- NULL, /* init() */
93
- NULL, /* exit() */
94
- NULL, /* set_option() */
95
- netbsd_get_device_list,
96
- NULL, /* hotplug_poll */
97
- netbsd_open,
98
- netbsd_close,
99
-
100
- netbsd_get_device_descriptor,
101
- netbsd_get_active_config_descriptor,
102
- netbsd_get_config_descriptor,
103
- NULL, /* get_config_descriptor_by_value() */
104
-
105
- netbsd_get_configuration,
106
- netbsd_set_configuration,
107
-
108
- netbsd_claim_interface,
109
- netbsd_release_interface,
110
-
111
- netbsd_set_interface_altsetting,
112
- netbsd_clear_halt,
113
- netbsd_reset_device,
114
-
115
- NULL, /* alloc_streams */
116
- NULL, /* free_streams */
117
-
118
- NULL, /* dev_mem_alloc() */
119
- NULL, /* dev_mem_free() */
120
-
121
- NULL, /* kernel_driver_active() */
122
- NULL, /* detach_kernel_driver() */
123
- NULL, /* attach_kernel_driver() */
124
-
125
- netbsd_destroy_device,
126
-
127
- netbsd_submit_transfer,
128
- netbsd_cancel_transfer,
129
- netbsd_clear_transfer_priv,
130
-
131
- NULL, /* handle_events() */
132
- netbsd_handle_transfer_completion,
133
-
134
- netbsd_clock_gettime,
135
- 0, /* context_priv_size */
136
- sizeof(struct device_priv),
137
- sizeof(struct handle_priv),
138
- 0, /* transfer_priv_size */
84
+ .name = "Synchronous NetBSD backend",
85
+ .caps = 0,
86
+ .get_device_list = netbsd_get_device_list,
87
+ .open = netbsd_open,
88
+ .close = netbsd_close,
89
+
90
+ .get_active_config_descriptor = netbsd_get_active_config_descriptor,
91
+ .get_config_descriptor = netbsd_get_config_descriptor,
92
+
93
+ .get_configuration = netbsd_get_configuration,
94
+ .set_configuration = netbsd_set_configuration,
95
+
96
+ .claim_interface = netbsd_claim_interface,
97
+ .release_interface = netbsd_release_interface,
98
+
99
+ .set_interface_altsetting = netbsd_set_interface_altsetting,
100
+ .clear_halt = netbsd_clear_halt,
101
+
102
+ .destroy_device = netbsd_destroy_device,
103
+
104
+ .submit_transfer = netbsd_submit_transfer,
105
+ .cancel_transfer = netbsd_cancel_transfer,
106
+
107
+ .handle_transfer_completion = netbsd_handle_transfer_completion,
108
+
109
+ .device_priv_size = sizeof(struct device_priv),
110
+ .device_handle_priv_size = sizeof(struct handle_priv),
139
111
  };
140
112
 
141
113
  int
@@ -145,11 +117,12 @@ netbsd_get_device_list(struct libusb_context * ctx,
145
117
  struct libusb_device *dev;
146
118
  struct device_priv *dpriv;
147
119
  struct usb_device_info di;
120
+ usb_device_descriptor_t ddesc;
148
121
  unsigned long session_id;
149
122
  char devnode[16];
150
123
  int fd, err, i;
151
124
 
152
- usbi_dbg("");
125
+ usbi_dbg(ctx, " ");
153
126
 
154
127
  /* Only ugen(4) is supported */
155
128
  for (i = 0; i < USB_MAX_DEVICES; i++) {
@@ -177,16 +150,20 @@ netbsd_get_device_list(struct libusb_context * ctx,
177
150
  dev->device_address = di.udi_addr;
178
151
  dev->speed = di.udi_speed;
179
152
 
180
- dpriv = (struct device_priv *)dev->os_priv;
153
+ dpriv = usbi_get_device_priv(dev);
181
154
  strlcpy(dpriv->devnode, devnode, sizeof(devnode));
182
155
  dpriv->fd = -1;
183
156
 
184
- if (ioctl(fd, USB_GET_DEVICE_DESC, &dpriv->ddesc) < 0) {
157
+ if (ioctl(fd, USB_GET_DEVICE_DESC, &ddesc) < 0) {
185
158
  err = errno;
186
159
  goto error;
187
160
  }
188
161
 
189
- dpriv->cdesc = NULL;
162
+ static_assert(sizeof(dev->device_descriptor) == sizeof(ddesc),
163
+ "mismatch between libusb and OS device descriptor sizes");
164
+ memcpy(&dev->device_descriptor, &ddesc, LIBUSB_DT_DEVICE_SIZE);
165
+ usbi_localize_device_descriptor(&dev->device_descriptor);
166
+
190
167
  if (_cache_active_config_descriptor(dev, fd)) {
191
168
  err = errno;
192
169
  goto error;
@@ -214,8 +191,8 @@ error:
214
191
  int
215
192
  netbsd_open(struct libusb_device_handle *handle)
216
193
  {
217
- struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
218
- struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
194
+ struct device_priv *dpriv = usbi_get_device_priv(handle->dev);
195
+ struct handle_priv *hpriv = usbi_get_device_handle_priv(handle);
219
196
  int i;
220
197
 
221
198
  dpriv->fd = open(dpriv->devnode, O_RDWR);
@@ -228,7 +205,7 @@ netbsd_open(struct libusb_device_handle *handle)
228
205
  for (i = 0; i < USB_MAX_ENDPOINTS; i++)
229
206
  hpriv->endpoints[i] = -1;
230
207
 
231
- usbi_dbg("open %s: fd %d", dpriv->devnode, dpriv->fd);
208
+ usbi_dbg(HANDLE_CTX(handle), "open %s: fd %d", dpriv->devnode, dpriv->fd);
232
209
 
233
210
  return (LIBUSB_SUCCESS);
234
211
  }
@@ -236,57 +213,38 @@ netbsd_open(struct libusb_device_handle *handle)
236
213
  void
237
214
  netbsd_close(struct libusb_device_handle *handle)
238
215
  {
239
- struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
216
+ struct device_priv *dpriv = usbi_get_device_priv(handle->dev);
240
217
 
241
- usbi_dbg("close: fd %d", dpriv->fd);
218
+ usbi_dbg(HANDLE_CTX(handle), "close: fd %d", dpriv->fd);
242
219
 
243
220
  close(dpriv->fd);
244
221
  dpriv->fd = -1;
245
222
  }
246
223
 
247
- int
248
- netbsd_get_device_descriptor(struct libusb_device *dev, unsigned char *buf,
249
- int *host_endian)
250
- {
251
- struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
252
-
253
- usbi_dbg("");
254
-
255
- memcpy(buf, &dpriv->ddesc, DEVICE_DESC_LENGTH);
256
-
257
- *host_endian = 0;
258
-
259
- return (LIBUSB_SUCCESS);
260
- }
261
-
262
224
  int
263
225
  netbsd_get_active_config_descriptor(struct libusb_device *dev,
264
- unsigned char *buf, size_t len, int *host_endian)
226
+ void *buf, size_t len)
265
227
  {
266
- struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
267
- usb_config_descriptor_t *ucd;
228
+ struct device_priv *dpriv = usbi_get_device_priv(dev);
268
229
 
269
- ucd = (usb_config_descriptor_t *) dpriv->cdesc;
270
- len = MIN(len, UGETW(ucd->wTotalLength));
230
+ len = MIN(len, (size_t)UGETW(dpriv->cdesc->wTotalLength));
271
231
 
272
- usbi_dbg("len %d", len);
232
+ usbi_dbg(DEVICE_CTX(dev), "len %zu", len);
273
233
 
274
234
  memcpy(buf, dpriv->cdesc, len);
275
235
 
276
- *host_endian = 0;
277
-
278
- return len;
236
+ return (int)len;
279
237
  }
280
238
 
281
239
  int
282
240
  netbsd_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
283
- unsigned char *buf, size_t len, int *host_endian)
241
+ void *buf, size_t len)
284
242
  {
285
- struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
243
+ struct device_priv *dpriv = usbi_get_device_priv(dev);
286
244
  struct usb_full_desc ufd;
287
245
  int fd, err;
288
246
 
289
- usbi_dbg("index %d, len %d", idx, len);
247
+ usbi_dbg(DEVICE_CTX(dev), "index %u, len %zu", idx, len);
290
248
 
291
249
  /* A config descriptor may be requested before opening the device */
292
250
  if (dpriv->fd >= 0) {
@@ -311,22 +269,22 @@ netbsd_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
311
269
  if (dpriv->fd < 0)
312
270
  close(fd);
313
271
 
314
- *host_endian = 0;
315
-
316
- return len;
272
+ return (int)len;
317
273
  }
318
274
 
319
275
  int
320
- netbsd_get_configuration(struct libusb_device_handle *handle, int *config)
276
+ netbsd_get_configuration(struct libusb_device_handle *handle, uint8_t *config)
321
277
  {
322
- struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
278
+ struct device_priv *dpriv = usbi_get_device_priv(handle->dev);
279
+ int tmp;
323
280
 
324
- usbi_dbg("");
281
+ usbi_dbg(HANDLE_CTX(handle), " ");
325
282
 
326
- if (ioctl(dpriv->fd, USB_GET_CONFIG, config) < 0)
283
+ if (ioctl(dpriv->fd, USB_GET_CONFIG, &tmp) < 0)
327
284
  return _errno_to_libusb(errno);
328
285
 
329
- usbi_dbg("configuration %d", *config);
286
+ usbi_dbg(HANDLE_CTX(handle), "configuration %d", tmp);
287
+ *config = (uint8_t)tmp;
330
288
 
331
289
  return (LIBUSB_SUCCESS);
332
290
  }
@@ -334,9 +292,9 @@ netbsd_get_configuration(struct libusb_device_handle *handle, int *config)
334
292
  int
335
293
  netbsd_set_configuration(struct libusb_device_handle *handle, int config)
336
294
  {
337
- struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
295
+ struct device_priv *dpriv = usbi_get_device_priv(handle->dev);
338
296
 
339
- usbi_dbg("configuration %d", config);
297
+ usbi_dbg(HANDLE_CTX(handle), "configuration %d", config);
340
298
 
341
299
  if (ioctl(dpriv->fd, USB_SET_CONFIG, &config) < 0)
342
300
  return _errno_to_libusb(errno);
@@ -345,11 +303,13 @@ netbsd_set_configuration(struct libusb_device_handle *handle, int config)
345
303
  }
346
304
 
347
305
  int
348
- netbsd_claim_interface(struct libusb_device_handle *handle, int iface)
306
+ netbsd_claim_interface(struct libusb_device_handle *handle, uint8_t iface)
349
307
  {
350
- struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
308
+ struct handle_priv *hpriv = usbi_get_device_handle_priv(handle);
351
309
  int i;
352
310
 
311
+ UNUSED(iface);
312
+
353
313
  for (i = 0; i < USB_MAX_ENDPOINTS; i++)
354
314
  hpriv->endpoints[i] = -1;
355
315
 
@@ -357,11 +317,13 @@ netbsd_claim_interface(struct libusb_device_handle *handle, int iface)
357
317
  }
358
318
 
359
319
  int
360
- netbsd_release_interface(struct libusb_device_handle *handle, int iface)
320
+ netbsd_release_interface(struct libusb_device_handle *handle, uint8_t iface)
361
321
  {
362
- struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
322
+ struct handle_priv *hpriv = usbi_get_device_handle_priv(handle);
363
323
  int i;
364
324
 
325
+ UNUSED(iface);
326
+
365
327
  for (i = 0; i < USB_MAX_ENDPOINTS; i++)
366
328
  if (hpriv->endpoints[i] >= 0)
367
329
  close(hpriv->endpoints[i]);
@@ -370,13 +332,13 @@ netbsd_release_interface(struct libusb_device_handle *handle, int iface)
370
332
  }
371
333
 
372
334
  int
373
- netbsd_set_interface_altsetting(struct libusb_device_handle *handle, int iface,
374
- int altsetting)
335
+ netbsd_set_interface_altsetting(struct libusb_device_handle *handle, uint8_t iface,
336
+ uint8_t altsetting)
375
337
  {
376
- struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
338
+ struct device_priv *dpriv = usbi_get_device_priv(handle->dev);
377
339
  struct usb_alt_interface intf;
378
340
 
379
- usbi_dbg("iface %d, setting %d", iface, altsetting);
341
+ usbi_dbg(HANDLE_CTX(handle), "iface %u, setting %u", iface, altsetting);
380
342
 
381
343
  memset(&intf, 0, sizeof(intf));
382
344
 
@@ -392,10 +354,10 @@ netbsd_set_interface_altsetting(struct libusb_device_handle *handle, int iface,
392
354
  int
393
355
  netbsd_clear_halt(struct libusb_device_handle *handle, unsigned char endpoint)
394
356
  {
395
- struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
357
+ struct device_priv *dpriv = usbi_get_device_priv(handle->dev);
396
358
  struct usb_ctl_request req;
397
359
 
398
- usbi_dbg("");
360
+ usbi_dbg(HANDLE_CTX(handle), " ");
399
361
 
400
362
  req.ucr_request.bmRequestType = UT_WRITE_ENDPOINT;
401
363
  req.ucr_request.bRequest = UR_CLEAR_FEATURE;
@@ -409,20 +371,12 @@ netbsd_clear_halt(struct libusb_device_handle *handle, unsigned char endpoint)
409
371
  return (LIBUSB_SUCCESS);
410
372
  }
411
373
 
412
- int
413
- netbsd_reset_device(struct libusb_device_handle *handle)
414
- {
415
- usbi_dbg("");
416
-
417
- return (LIBUSB_ERROR_NOT_SUPPORTED);
418
- }
419
-
420
374
  void
421
375
  netbsd_destroy_device(struct libusb_device *dev)
422
376
  {
423
- struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
377
+ struct device_priv *dpriv = usbi_get_device_priv(dev);
424
378
 
425
- usbi_dbg("");
379
+ usbi_dbg(DEVICE_CTX(dev), " ");
426
380
 
427
381
  free(dpriv->cdesc);
428
382
  }
@@ -431,13 +385,11 @@ int
431
385
  netbsd_submit_transfer(struct usbi_transfer *itransfer)
432
386
  {
433
387
  struct libusb_transfer *transfer;
434
- struct handle_priv *hpriv;
435
388
  int err = 0;
436
389
 
437
- usbi_dbg("");
390
+ usbi_dbg(ITRANSFER_CTX(itransfer), " ");
438
391
 
439
392
  transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
440
- hpriv = (struct handle_priv *)transfer->dev_handle->os_priv;
441
393
 
442
394
  switch (transfer->type) {
443
395
  case LIBUSB_TRANSFER_TYPE_CONTROL:
@@ -476,17 +428,11 @@ netbsd_submit_transfer(struct usbi_transfer *itransfer)
476
428
  int
477
429
  netbsd_cancel_transfer(struct usbi_transfer *itransfer)
478
430
  {
479
- usbi_dbg("");
431
+ UNUSED(itransfer);
480
432
 
481
- return (LIBUSB_ERROR_NOT_SUPPORTED);
482
- }
433
+ usbi_dbg(ITRANSFER_CTX(itransfer), " ");
483
434
 
484
- void
485
- netbsd_clear_transfer_priv(struct usbi_transfer *itransfer)
486
- {
487
- usbi_dbg("");
488
-
489
- /* Nothing to do */
435
+ return (LIBUSB_ERROR_NOT_SUPPORTED);
490
436
  }
491
437
 
492
438
  int
@@ -495,20 +441,6 @@ netbsd_handle_transfer_completion(struct usbi_transfer *itransfer)
495
441
  return usbi_handle_transfer_completion(itransfer, LIBUSB_TRANSFER_COMPLETED);
496
442
  }
497
443
 
498
- int
499
- netbsd_clock_gettime(int clkid, struct timespec *tp)
500
- {
501
- usbi_dbg("clock %d", clkid);
502
-
503
- if (clkid == USBI_CLOCK_REALTIME)
504
- return clock_gettime(CLOCK_REALTIME, tp);
505
-
506
- if (clkid == USBI_CLOCK_MONOTONIC)
507
- return clock_gettime(CLOCK_MONOTONIC, tp);
508
-
509
- return (LIBUSB_ERROR_INVALID_PARAM);
510
- }
511
-
512
444
  int
513
445
  _errno_to_libusb(int err)
514
446
  {
@@ -521,9 +453,12 @@ _errno_to_libusb(int err)
521
453
  return (LIBUSB_ERROR_NO_DEVICE);
522
454
  case ENOMEM:
523
455
  return (LIBUSB_ERROR_NO_MEM);
456
+ case EWOULDBLOCK:
457
+ case ETIMEDOUT:
458
+ return (LIBUSB_ERROR_TIMEOUT);
524
459
  }
525
460
 
526
- usbi_dbg("error: %s", strerror(err));
461
+ usbi_dbg(NULL, "error: %s", strerror(err));
527
462
 
528
463
  return (LIBUSB_ERROR_OTHER);
529
464
  }
@@ -531,23 +466,23 @@ _errno_to_libusb(int err)
531
466
  int
532
467
  _cache_active_config_descriptor(struct libusb_device *dev, int fd)
533
468
  {
534
- struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
469
+ struct device_priv *dpriv = usbi_get_device_priv(dev);
535
470
  struct usb_config_desc ucd;
536
471
  struct usb_full_desc ufd;
537
- unsigned char* buf;
472
+ void *buf;
538
473
  int len;
539
474
 
540
- usbi_dbg("fd %d", fd);
475
+ usbi_dbg(DEVICE_CTX(dev), "fd %d", fd);
541
476
 
542
477
  ucd.ucd_config_index = USB_CURRENT_CONFIG_INDEX;
543
478
 
544
479
  if ((ioctl(fd, USB_GET_CONFIG_DESC, &ucd)) < 0)
545
480
  return _errno_to_libusb(errno);
546
481
 
547
- usbi_dbg("active bLength %d", ucd.ucd_desc.bLength);
482
+ usbi_dbg(DEVICE_CTX(dev), "active bLength %d", ucd.ucd_desc.bLength);
548
483
 
549
484
  len = UGETW(ucd.ucd_desc.wTotalLength);
550
- buf = malloc(len);
485
+ buf = malloc((size_t)len);
551
486
  if (buf == NULL)
552
487
  return (LIBUSB_ERROR_NO_MEM);
553
488
 
@@ -555,7 +490,7 @@ _cache_active_config_descriptor(struct libusb_device *dev, int fd)
555
490
  ufd.ufd_size = len;
556
491
  ufd.ufd_data = buf;
557
492
 
558
- usbi_dbg("index %d, len %d", ufd.ufd_config_index, len);
493
+ usbi_dbg(DEVICE_CTX(dev), "index %d, len %d", ufd.ufd_config_index, len);
559
494
 
560
495
  if ((ioctl(fd, USB_GET_FULL_DESC, &ufd)) < 0) {
561
496
  free(buf);
@@ -578,10 +513,10 @@ _sync_control_transfer(struct usbi_transfer *itransfer)
578
513
  struct usb_ctl_request req;
579
514
 
580
515
  transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
581
- dpriv = (struct device_priv *)transfer->dev_handle->dev->os_priv;
516
+ dpriv = usbi_get_device_priv(transfer->dev_handle->dev);
582
517
  setup = (struct libusb_control_setup *)transfer->buffer;
583
518
 
584
- usbi_dbg("type %d request %d value %d index %d length %d timeout %d",
519
+ usbi_dbg(ITRANSFER_CTX(itransfer), "type %d request %d value %d index %d length %d timeout %d",
585
520
  setup->bmRequestType, setup->bRequest,
586
521
  libusb_le16_to_cpu(setup->wValue),
587
522
  libusb_le16_to_cpu(setup->wIndex),
@@ -606,7 +541,7 @@ _sync_control_transfer(struct usbi_transfer *itransfer)
606
541
 
607
542
  itransfer->transferred = req.ucr_actlen;
608
543
 
609
- usbi_dbg("transferred %d", itransfer->transferred);
544
+ usbi_dbg(ITRANSFER_CTX(itransfer), "transferred %d", itransfer->transferred);
610
545
 
611
546
  return (0);
612
547
  }
@@ -620,13 +555,13 @@ _access_endpoint(struct libusb_transfer *transfer)
620
555
  int fd, endpt;
621
556
  mode_t mode;
622
557
 
623
- hpriv = (struct handle_priv *)transfer->dev_handle->os_priv;
624
- dpriv = (struct device_priv *)transfer->dev_handle->dev->os_priv;
558
+ hpriv = usbi_get_device_handle_priv(transfer->dev_handle);
559
+ dpriv = usbi_get_device_priv(transfer->dev_handle->dev);
625
560
 
626
561
  endpt = UE_GET_ADDR(transfer->endpoint);
627
562
  mode = IS_XFERIN(transfer) ? O_RDONLY : O_WRONLY;
628
563
 
629
- usbi_dbg("endpoint %d mode %d", endpt, mode);
564
+ usbi_dbg(TRANSFER_CTX(transfer), "endpoint %d mode %d", endpt, mode);
630
565
 
631
566
  if (hpriv->endpoints[endpt] < 0) {
632
567
  /* Pick the right node given the control one */
@@ -0,0 +1,111 @@
1
+ /*
2
+ * Copyright © 2019 Pino Toscano <toscano.pino@tiscali.it>
3
+ *
4
+ * This library is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * This library is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with this library; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #include "libusbi.h"
20
+
21
+ static int
22
+ null_get_device_list(struct libusb_context * ctx,
23
+ struct discovered_devs **discdevs)
24
+ {
25
+ return LIBUSB_SUCCESS;
26
+ }
27
+
28
+ static int
29
+ null_open(struct libusb_device_handle *handle)
30
+ {
31
+ return LIBUSB_ERROR_NOT_SUPPORTED;
32
+ }
33
+
34
+ static void
35
+ null_close(struct libusb_device_handle *handle)
36
+ {
37
+ }
38
+
39
+ static int
40
+ null_get_active_config_descriptor(struct libusb_device *dev,
41
+ void *buf, size_t len)
42
+ {
43
+ return LIBUSB_ERROR_NOT_SUPPORTED;
44
+ }
45
+
46
+ static int
47
+ null_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
48
+ void *buf, size_t len)
49
+ {
50
+ return LIBUSB_ERROR_NOT_SUPPORTED;
51
+ }
52
+
53
+ static int
54
+ null_set_configuration(struct libusb_device_handle *handle, int config)
55
+ {
56
+ return LIBUSB_ERROR_NOT_SUPPORTED;
57
+ }
58
+
59
+ static int
60
+ null_claim_interface(struct libusb_device_handle *handle, uint8_t iface)
61
+ {
62
+ return LIBUSB_ERROR_NOT_SUPPORTED;
63
+ }
64
+
65
+ static int
66
+ null_release_interface(struct libusb_device_handle *handle, uint8_t iface)
67
+ {
68
+ return LIBUSB_ERROR_NOT_SUPPORTED;
69
+ }
70
+
71
+ static int
72
+ null_set_interface_altsetting(struct libusb_device_handle *handle, uint8_t iface,
73
+ uint8_t altsetting)
74
+ {
75
+ return LIBUSB_ERROR_NOT_SUPPORTED;
76
+ }
77
+
78
+ static int
79
+ null_clear_halt(struct libusb_device_handle *handle, unsigned char endpoint)
80
+ {
81
+ return LIBUSB_ERROR_NOT_SUPPORTED;
82
+ }
83
+
84
+ static int
85
+ null_submit_transfer(struct usbi_transfer *itransfer)
86
+ {
87
+ return LIBUSB_ERROR_NOT_SUPPORTED;
88
+ }
89
+
90
+ static int
91
+ null_cancel_transfer(struct usbi_transfer *itransfer)
92
+ {
93
+ return LIBUSB_ERROR_NOT_SUPPORTED;
94
+ }
95
+
96
+ const struct usbi_os_backend usbi_backend = {
97
+ .name = "Null backend",
98
+ .caps = 0,
99
+ .get_device_list = null_get_device_list,
100
+ .open = null_open,
101
+ .close = null_close,
102
+ .get_active_config_descriptor = null_get_active_config_descriptor,
103
+ .get_config_descriptor = null_get_config_descriptor,
104
+ .set_configuration = null_set_configuration,
105
+ .claim_interface = null_claim_interface,
106
+ .release_interface = null_release_interface,
107
+ .set_interface_altsetting = null_set_interface_altsetting,
108
+ .clear_halt = null_clear_halt,
109
+ .submit_transfer = null_submit_transfer,
110
+ .cancel_transfer = null_cancel_transfer,
111
+ };