usb 2.0.0-alpha.2 → 2.1.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 (258) hide show
  1. package/.gitmodules +1 -1
  2. package/CHANGELOG.md +100 -0
  3. package/README.md +573 -0
  4. package/binding.gyp +12 -2
  5. package/dist/index.d.ts +4 -4
  6. package/dist/index.js +14 -8
  7. package/dist/index.js.map +1 -1
  8. package/dist/usb/bindings.d.ts +13 -0
  9. package/dist/usb/bindings.js +2 -1
  10. package/dist/usb/bindings.js.map +1 -1
  11. package/dist/usb/index.js +86 -2
  12. package/dist/usb/index.js.map +1 -1
  13. package/dist/usb/interface.js.map +1 -1
  14. package/dist/webusb/index.d.ts +32 -19
  15. package/dist/webusb/index.js +163 -67
  16. package/dist/webusb/index.js.map +1 -1
  17. package/dist/webusb/webusb-device.d.ts +1 -1
  18. package/dist/webusb/webusb-device.js +27 -15
  19. package/dist/webusb/webusb-device.js.map +1 -1
  20. package/libusb/.private/pre-commit.sh +7 -1
  21. package/libusb/.travis.yml +49 -0
  22. package/libusb/AUTHORS +44 -3
  23. package/libusb/Brewfile +4 -0
  24. package/libusb/ChangeLog +74 -2
  25. package/libusb/README.md +32 -0
  26. package/libusb/TODO +1 -1
  27. package/libusb/Xcode/common.xcconfig +12 -0
  28. package/libusb/Xcode/config.h +25 -0
  29. package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +959 -1
  30. package/libusb/android/README +4 -2
  31. package/libusb/android/config.h +75 -0
  32. package/libusb/appveyor.yml +41 -0
  33. package/libusb/appveyor_cygwin.bat +11 -0
  34. package/libusb/appveyor_minGW.bat +19 -0
  35. package/libusb/autogen.sh +1 -1
  36. package/libusb/bootstrap.sh +3 -16
  37. package/libusb/configure.ac +108 -80
  38. package/libusb/doc/doxygen.cfg.in +1785 -739
  39. package/libusb/examples/Makefile.am +1 -1
  40. package/libusb/examples/dpfp.c +3 -1
  41. package/libusb/examples/dpfp_threaded.c +23 -10
  42. package/libusb/examples/ezusb.c +3 -3
  43. package/libusb/examples/ezusb.h +2 -2
  44. package/libusb/examples/fxload.c +31 -9
  45. package/libusb/examples/hotplugtest.c +35 -7
  46. package/libusb/examples/listdevs.c +3 -1
  47. package/libusb/examples/sam3u_benchmark.c +3 -3
  48. package/libusb/examples/testlibusb.c +277 -0
  49. package/libusb/examples/xusb.c +40 -34
  50. package/libusb/libusb/Makefile.am +49 -23
  51. package/libusb/libusb/core.c +855 -457
  52. package/libusb/libusb/descriptor.c +72 -78
  53. package/libusb/libusb/hotplug.c +122 -76
  54. package/libusb/libusb/hotplug.h +42 -25
  55. package/libusb/libusb/io.c +625 -390
  56. package/libusb/libusb/libusb-1.0.def +12 -0
  57. package/libusb/libusb/libusb.h +218 -150
  58. package/libusb/libusb/libusbi.h +346 -176
  59. package/libusb/libusb/os/darwin_usb.c +604 -319
  60. package/libusb/libusb/os/darwin_usb.h +61 -20
  61. package/libusb/libusb/os/haiku_pollfs.cpp +367 -0
  62. package/libusb/libusb/os/haiku_usb.h +113 -0
  63. package/libusb/libusb/os/haiku_usb_backend.cpp +533 -0
  64. package/libusb/libusb/os/haiku_usb_raw.cpp +267 -0
  65. package/libusb/libusb/os/haiku_usb_raw.h +188 -0
  66. package/libusb/libusb/os/linux_netlink.c +186 -146
  67. package/libusb/libusb/os/linux_udev.c +36 -14
  68. package/libusb/libusb/os/linux_usbfs.c +426 -225
  69. package/libusb/libusb/os/linux_usbfs.h +5 -3
  70. package/libusb/libusb/os/netbsd_usb.c +21 -77
  71. package/libusb/libusb/os/openbsd_usb.c +32 -115
  72. package/libusb/libusb/os/poll_posix.c +38 -5
  73. package/libusb/libusb/os/poll_posix.h +3 -0
  74. package/libusb/libusb/os/poll_windows.c +277 -626
  75. package/libusb/libusb/os/poll_windows.h +11 -44
  76. package/libusb/libusb/os/sunos_usb.c +1695 -0
  77. package/libusb/libusb/os/sunos_usb.h +80 -0
  78. package/libusb/libusb/os/threads_posix.c +24 -26
  79. package/libusb/libusb/os/threads_posix.h +73 -21
  80. package/libusb/libusb/os/threads_windows.c +71 -157
  81. package/libusb/libusb/os/threads_windows.h +68 -44
  82. package/libusb/libusb/os/wince_usb.c +276 -420
  83. package/libusb/libusb/os/wince_usb.h +23 -28
  84. package/libusb/libusb/os/windows_common.h +78 -58
  85. package/libusb/libusb/os/windows_nt_common.c +1010 -0
  86. package/libusb/libusb/os/windows_nt_common.h +110 -0
  87. package/libusb/libusb/os/windows_nt_shared_types.h +147 -0
  88. package/libusb/libusb/os/windows_usbdk.c +830 -0
  89. package/libusb/libusb/os/windows_usbdk.h +103 -0
  90. package/libusb/libusb/os/windows_winusb.c +4391 -0
  91. package/libusb/libusb/os/windows_winusb.h +783 -0
  92. package/libusb/libusb/strerror.c +41 -7
  93. package/libusb/libusb/sync.c +41 -13
  94. package/libusb/libusb/version.h +1 -1
  95. package/libusb/libusb/version_nano.h +1 -1
  96. package/libusb/libusb-1.0.pc.in +1 -1
  97. package/libusb/msvc/appveyor.bat +27 -0
  98. package/libusb/msvc/config.h +5 -4
  99. package/libusb/msvc/ddk_build.cmd +87 -43
  100. package/libusb/msvc/fxload_2010.vcxproj +24 -104
  101. package/libusb/msvc/fxload_2012.vcxproj +24 -107
  102. package/libusb/msvc/fxload_2013.vcxproj +24 -107
  103. package/libusb/msvc/fxload_2015.vcxproj +91 -0
  104. package/libusb/msvc/fxload_2017.vcxproj +114 -0
  105. package/libusb/msvc/fxload_sources +1 -1
  106. package/libusb/msvc/getopt_2010.vcxproj +16 -75
  107. package/libusb/msvc/getopt_2012.vcxproj +16 -79
  108. package/libusb/msvc/getopt_2013.vcxproj +16 -79
  109. package/libusb/msvc/getopt_2015.vcxproj +73 -0
  110. package/libusb/msvc/getopt_2017.vcxproj +98 -0
  111. package/libusb/msvc/getopt_sources +6 -2
  112. package/libusb/msvc/hotplugtest_2010.vcxproj +18 -99
  113. package/libusb/msvc/hotplugtest_2012.vcxproj +18 -102
  114. package/libusb/msvc/hotplugtest_2013.vcxproj +18 -102
  115. package/libusb/msvc/hotplugtest_2015.vcxproj +83 -0
  116. package/libusb/msvc/hotplugtest_2017.vcxproj +106 -0
  117. package/libusb/msvc/hotplugtest_sources +1 -1
  118. package/libusb/msvc/libusb_2005.sln +20 -20
  119. package/libusb/msvc/libusb_2010.sln +57 -46
  120. package/libusb/msvc/libusb_2012.sln +57 -46
  121. package/libusb/msvc/libusb_2013.sln +57 -50
  122. package/libusb/msvc/libusb_2015.sln +59 -52
  123. package/libusb/msvc/libusb_2017.sln +186 -0
  124. package/libusb/msvc/libusb_dll.dsp +2 -2
  125. package/libusb/msvc/libusb_dll_2005.vcproj +30 -2
  126. package/libusb/msvc/libusb_dll_2010.vcxproj +26 -90
  127. package/libusb/msvc/libusb_dll_2012.vcxproj +28 -96
  128. package/libusb/msvc/libusb_dll_2013.vcxproj +28 -96
  129. package/libusb/msvc/libusb_dll_2015.vcxproj +107 -0
  130. package/libusb/msvc/libusb_dll_2017.vcxproj +134 -0
  131. package/libusb/msvc/libusb_dll_wince.vcproj +9 -1
  132. package/libusb/msvc/libusb_sources +10 -5
  133. package/libusb/msvc/libusb_static.dsp +2 -2
  134. package/libusb/msvc/libusb_static_2005.vcproj +32 -4
  135. package/libusb/msvc/libusb_static_2010.vcxproj +24 -83
  136. package/libusb/msvc/libusb_static_2012.vcxproj +25 -87
  137. package/libusb/msvc/libusb_static_2013.vcxproj +25 -87
  138. package/libusb/msvc/libusb_static_2015.vcxproj +98 -0
  139. package/libusb/msvc/libusb_static_2017.vcxproj +117 -0
  140. package/libusb/msvc/libusb_static_wince.vcproj +20 -26
  141. package/libusb/msvc/libusb_wince.sln +88 -88
  142. package/libusb/msvc/listdevs_2010.vcxproj +16 -99
  143. package/libusb/msvc/listdevs_2012.vcxproj +16 -102
  144. package/libusb/msvc/listdevs_2013.vcxproj +16 -102
  145. package/libusb/msvc/listdevs_2015.vcxproj +83 -0
  146. package/libusb/msvc/listdevs_2017.vcxproj +106 -0
  147. package/libusb/msvc/listdevs_sources +2 -1
  148. package/libusb/msvc/stress_2010.vcxproj +20 -101
  149. package/libusb/msvc/stress_2012.vcxproj +20 -104
  150. package/libusb/msvc/stress_2013.vcxproj +20 -104
  151. package/libusb/msvc/stress_2015.vcxproj +87 -0
  152. package/libusb/msvc/stress_2017.vcxproj +110 -0
  153. package/libusb/msvc/stress_sources +21 -0
  154. package/libusb/msvc/testlibusb_2010.vcxproj +82 -0
  155. package/libusb/msvc/testlibusb_2012.vcxproj +83 -0
  156. package/libusb/msvc/testlibusb_2013.vcxproj +83 -0
  157. package/libusb/msvc/testlibusb_2015.vcxproj +83 -0
  158. package/libusb/msvc/testlibusb_2017.vcxproj +106 -0
  159. package/libusb/msvc/testlibusb_sources +20 -0
  160. package/libusb/msvc/xusb_2010.vcxproj +17 -98
  161. package/libusb/msvc/xusb_2012.vcxproj +17 -101
  162. package/libusb/msvc/xusb_2013.vcxproj +17 -101
  163. package/libusb/msvc/xusb_2015.vcxproj +83 -0
  164. package/libusb/msvc/xusb_2017.vcxproj +106 -0
  165. package/libusb/msvc/xusb_sources +1 -1
  166. package/libusb/tests/stress.c +2 -2
  167. package/libusb/tests/testlib.c +0 -4
  168. package/libusb/travis-autogen.sh +39 -0
  169. package/libusb.gypi +21 -2
  170. package/package.json +18 -13
  171. package/prebuilds/android-arm/node.napi.node +0 -0
  172. package/prebuilds/android-arm64/node.napi.node +0 -0
  173. package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
  174. package/prebuilds/linux-arm/node.napi.node +0 -0
  175. package/prebuilds/linux-arm64/node.napi.node +0 -0
  176. package/prebuilds/linux-ia32/node.napi.node +0 -0
  177. package/prebuilds/linux-x64/node.napi.node +0 -0
  178. package/prebuilds/win32-ia32/node.napi.node +0 -0
  179. package/prebuilds/win32-x64/node.napi.node +0 -0
  180. package/src/device.cc +7 -7
  181. package/src/node_usb.cc +43 -1
  182. package/src/node_usb.h +1 -0
  183. package/src/uv_async_queue.h +33 -25
  184. package/test/usb.coffee +6 -0
  185. package/tsc/index.ts +13 -7
  186. package/tsc/usb/bindings.ts +19 -1
  187. package/tsc/usb/index.ts +67 -19
  188. package/tsc/usb/interface.ts +2 -2
  189. package/tsc/webusb/index.ts +197 -74
  190. package/tsc/webusb/webusb-device.ts +30 -17
  191. package/.github/workflows/prebuild.yml +0 -48
  192. package/Readme.md +0 -339
  193. package/dist/webusb/typed-event-target.d.ts +0 -11
  194. package/dist/webusb/typed-event-target.js +0 -21
  195. package/dist/webusb/typed-event-target.js.map +0 -1
  196. package/docs/assets/css/main.css +0 -2660
  197. package/docs/assets/images/icons.png +0 -0
  198. package/docs/assets/images/icons@2x.png +0 -0
  199. package/docs/assets/images/widgets.png +0 -0
  200. package/docs/assets/images/widgets@2x.png +0 -0
  201. package/docs/assets/js/main.js +0 -248
  202. package/docs/assets/js/search.js +0 -1
  203. package/docs/classes/usb_bindings.device.html +0 -1338
  204. package/docs/classes/usb_bindings.libusbexception.html +0 -234
  205. package/docs/classes/usb_bindings.transfer.html +0 -344
  206. package/docs/classes/usb_capability.capability.html +0 -297
  207. package/docs/classes/usb_device.extendeddevice.html +0 -766
  208. package/docs/classes/usb_endpoint.endpoint.html +0 -472
  209. package/docs/classes/usb_endpoint.inendpoint.html +0 -766
  210. package/docs/classes/usb_endpoint.outendpoint.html +0 -582
  211. package/docs/classes/usb_interface.interface.html +0 -648
  212. package/docs/classes/webusb.webusb-1.html +0 -615
  213. package/docs/classes/webusb_mutex.mutex.html +0 -270
  214. package/docs/classes/webusb_typed_event_target.typedeventtarget.html +0 -443
  215. package/docs/classes/webusb_webusb_device.webusbdevice.html +0 -904
  216. package/docs/index.html +0 -500
  217. package/docs/interfaces/usb.deviceevents.html +0 -242
  218. package/docs/interfaces/usb_descriptors.bosdescriptor.html +0 -293
  219. package/docs/interfaces/usb_descriptors.capabilitydescriptor.html +0 -274
  220. package/docs/interfaces/usb_descriptors.configdescriptor.html +0 -388
  221. package/docs/interfaces/usb_descriptors.devicedescriptor.html +0 -464
  222. package/docs/interfaces/usb_descriptors.endpointdescriptor.html +0 -370
  223. package/docs/interfaces/usb_descriptors.interfacedescriptor.html +0 -407
  224. package/docs/interfaces/webusb.usboptions.html +0 -226
  225. package/docs/modules/index.html +0 -304
  226. package/docs/modules/usb.html +0 -173
  227. package/docs/modules/usb_bindings.html +0 -2248
  228. package/docs/modules/usb_capability.html +0 -156
  229. package/docs/modules/usb_descriptors.html +0 -176
  230. package/docs/modules/usb_device.html +0 -156
  231. package/docs/modules/usb_endpoint.html +0 -164
  232. package/docs/modules/usb_interface.html +0 -156
  233. package/docs/modules/webusb.html +0 -165
  234. package/docs/modules/webusb_mutex.html +0 -156
  235. package/docs/modules/webusb_typed_event_target.html +0 -156
  236. package/docs/modules/webusb_webusb_device.html +0 -156
  237. package/docs/modules.html +0 -156
  238. package/libusb/INSTALL +0 -234
  239. package/libusb/README +0 -28
  240. package/libusb/libusb/os/windows_usb.c +0 -5347
  241. package/libusb/libusb/os/windows_usb.h +0 -971
  242. package/libusb/msvc/fxload_2010.vcxproj.filters +0 -25
  243. package/libusb/msvc/fxload_2012.vcxproj.filters +0 -25
  244. package/libusb/msvc/getopt_2010.vcxproj.filters +0 -26
  245. package/libusb/msvc/getopt_2012.vcxproj.filters +0 -26
  246. package/libusb/msvc/hotplugtest_2010.vcxproj.filters +0 -14
  247. package/libusb/msvc/hotplugtest_2012.vcxproj.filters +0 -14
  248. package/libusb/msvc/libusb_dll_2010.vcxproj.filters +0 -81
  249. package/libusb/msvc/libusb_dll_2012.vcxproj.filters +0 -84
  250. package/libusb/msvc/libusb_static_2010.vcxproj.filters +0 -74
  251. package/libusb/msvc/libusb_static_2012.vcxproj.filters +0 -74
  252. package/libusb/msvc/listdevs_2010.vcxproj.filters +0 -14
  253. package/libusb/msvc/listdevs_2012.vcxproj.filters +0 -14
  254. package/libusb/msvc/stress_2010.vcxproj.filters +0 -25
  255. package/libusb/msvc/stress_2012.vcxproj.filters +0 -25
  256. package/libusb/msvc/xusb_2010.vcxproj.filters +0 -14
  257. package/libusb/msvc/xusb_2012.vcxproj.filters +0 -14
  258. package/tsc/webusb/typed-event-target.ts +0 -23
@@ -0,0 +1,110 @@
1
+ /*
2
+ * Windows backend common header for libusb 1.0
3
+ *
4
+ * This file brings together header code common between
5
+ * the desktop Windows backends.
6
+ * Copyright © 2012-2013 RealVNC Ltd.
7
+ * Copyright © 2009-2012 Pete Batard <pete@akeo.ie>
8
+ * With contributions from Michael Plante, Orin Eman et al.
9
+ * Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
10
+ * Major code testing contribution by Xiaofan Chen
11
+ *
12
+ * This library is free software; you can redistribute it and/or
13
+ * modify it under the terms of the GNU Lesser General Public
14
+ * License as published by the Free Software Foundation; either
15
+ * version 2.1 of the License, or (at your option) any later version.
16
+ *
17
+ * This library is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
+ * Lesser General Public License for more details.
21
+ *
22
+ * You should have received a copy of the GNU Lesser General Public
23
+ * License along with this library; if not, write to the Free Software
24
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25
+ */
26
+
27
+ #pragma once
28
+
29
+ #include "windows_nt_shared_types.h"
30
+
31
+ /* Windows versions */
32
+ enum windows_version {
33
+ WINDOWS_UNDEFINED,
34
+ WINDOWS_2000,
35
+ WINDOWS_XP,
36
+ WINDOWS_2003, // Also XP x64
37
+ WINDOWS_VISTA,
38
+ WINDOWS_7,
39
+ WINDOWS_8,
40
+ WINDOWS_8_1,
41
+ WINDOWS_10,
42
+ WINDOWS_11_OR_LATER
43
+ };
44
+
45
+ extern enum windows_version windows_version;
46
+
47
+ /* This call is only available from Vista */
48
+ extern BOOL (WINAPI *pCancelIoEx)(HANDLE, LPOVERLAPPED);
49
+
50
+ struct windows_backend {
51
+ int (*init)(struct libusb_context *ctx);
52
+ void (*exit)(struct libusb_context *ctx);
53
+ int (*get_device_list)(struct libusb_context *ctx,
54
+ struct discovered_devs **discdevs);
55
+ int (*open)(struct libusb_device_handle *dev_handle);
56
+ void (*close)(struct libusb_device_handle *dev_handle);
57
+ int (*get_device_descriptor)(struct libusb_device *device, unsigned char *buffer);
58
+ int (*get_active_config_descriptor)(struct libusb_device *device,
59
+ unsigned char *buffer, size_t len);
60
+ int (*get_config_descriptor)(struct libusb_device *device,
61
+ uint8_t config_index, unsigned char *buffer, size_t len);
62
+ int (*get_config_descriptor_by_value)(struct libusb_device *device,
63
+ uint8_t bConfigurationValue, unsigned char **buffer);
64
+ int (*get_configuration)(struct libusb_device_handle *dev_handle, int *config);
65
+ int (*set_configuration)(struct libusb_device_handle *dev_handle, int config);
66
+ int (*claim_interface)(struct libusb_device_handle *dev_handle, int interface_number);
67
+ int (*release_interface)(struct libusb_device_handle *dev_handle, int interface_number);
68
+ int (*set_interface_altsetting)(struct libusb_device_handle *dev_handle,
69
+ int interface_number, int altsetting);
70
+ int (*clear_halt)(struct libusb_device_handle *dev_handle,
71
+ unsigned char endpoint);
72
+ int (*reset_device)(struct libusb_device_handle *dev_handle);
73
+ void (*destroy_device)(struct libusb_device *dev);
74
+ int (*submit_transfer)(struct usbi_transfer *itransfer);
75
+ int (*cancel_transfer)(struct usbi_transfer *itransfer);
76
+ void (*clear_transfer_priv)(struct usbi_transfer *itransfer);
77
+ int (*copy_transfer_data)(struct usbi_transfer *itransfer, uint32_t io_size);
78
+ int (*get_transfer_fd)(struct usbi_transfer *itransfer);
79
+ void (*get_overlapped_result)(struct usbi_transfer *itransfer,
80
+ DWORD *io_result, DWORD *io_size);
81
+ };
82
+
83
+ struct windows_context_priv {
84
+ const struct windows_backend *backend;
85
+ };
86
+
87
+ union windows_device_priv {
88
+ struct usbdk_device_priv usbdk_priv;
89
+ struct winusb_device_priv winusb_priv;
90
+ };
91
+
92
+ union windows_device_handle_priv {
93
+ struct usbdk_device_handle_priv usbdk_priv;
94
+ struct winusb_device_handle_priv winusb_priv;
95
+ };
96
+
97
+ union windows_transfer_priv {
98
+ struct usbdk_transfer_priv usbdk_priv;
99
+ struct winusb_transfer_priv winusb_priv;
100
+ };
101
+
102
+ extern const struct windows_backend usbdk_backend;
103
+ extern const struct windows_backend winusb_backend;
104
+
105
+ unsigned long htab_hash(const char *str);
106
+ void windows_force_sync_completion(OVERLAPPED *overlapped, ULONG size);
107
+
108
+ #if defined(ENABLE_LOGGING)
109
+ const char *windows_error_str(DWORD error_code);
110
+ #endif
@@ -0,0 +1,147 @@
1
+ #pragma once
2
+
3
+ #include "windows_common.h"
4
+
5
+ #include <pshpack1.h>
6
+
7
+ typedef struct USB_DEVICE_DESCRIPTOR {
8
+ UCHAR bLength;
9
+ UCHAR bDescriptorType;
10
+ USHORT bcdUSB;
11
+ UCHAR bDeviceClass;
12
+ UCHAR bDeviceSubClass;
13
+ UCHAR bDeviceProtocol;
14
+ UCHAR bMaxPacketSize0;
15
+ USHORT idVendor;
16
+ USHORT idProduct;
17
+ USHORT bcdDevice;
18
+ UCHAR iManufacturer;
19
+ UCHAR iProduct;
20
+ UCHAR iSerialNumber;
21
+ UCHAR bNumConfigurations;
22
+ } USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR;
23
+
24
+ typedef struct USB_CONFIGURATION_DESCRIPTOR {
25
+ UCHAR bLength;
26
+ UCHAR bDescriptorType;
27
+ USHORT wTotalLength;
28
+ UCHAR bNumInterfaces;
29
+ UCHAR bConfigurationValue;
30
+ UCHAR iConfiguration;
31
+ UCHAR bmAttributes;
32
+ UCHAR MaxPower;
33
+ } USB_CONFIGURATION_DESCRIPTOR, *PUSB_CONFIGURATION_DESCRIPTOR;
34
+
35
+ #include <poppack.h>
36
+
37
+ #define MAX_DEVICE_ID_LEN 200
38
+
39
+ typedef struct USB_DK_DEVICE_ID {
40
+ WCHAR DeviceID[MAX_DEVICE_ID_LEN];
41
+ WCHAR InstanceID[MAX_DEVICE_ID_LEN];
42
+ } USB_DK_DEVICE_ID, *PUSB_DK_DEVICE_ID;
43
+
44
+ typedef struct USB_DK_DEVICE_INFO {
45
+ USB_DK_DEVICE_ID ID;
46
+ ULONG64 FilterID;
47
+ ULONG64 Port;
48
+ ULONG64 Speed;
49
+ USB_DEVICE_DESCRIPTOR DeviceDescriptor;
50
+ } USB_DK_DEVICE_INFO, *PUSB_DK_DEVICE_INFO;
51
+
52
+ typedef struct USB_DK_ISO_TRANSFER_RESULT {
53
+ ULONG64 ActualLength;
54
+ ULONG64 TransferResult;
55
+ } USB_DK_ISO_TRANSFER_RESULT, *PUSB_DK_ISO_TRANSFER_RESULT;
56
+
57
+ typedef struct USB_DK_GEN_TRANSFER_RESULT {
58
+ ULONG64 BytesTransferred;
59
+ ULONG64 UsbdStatus; // USBD_STATUS code
60
+ } USB_DK_GEN_TRANSFER_RESULT, *PUSB_DK_GEN_TRANSFER_RESULT;
61
+
62
+ typedef struct USB_DK_TRANSFER_RESULT {
63
+ USB_DK_GEN_TRANSFER_RESULT GenResult;
64
+ PVOID64 IsochronousResultsArray; // array of USB_DK_ISO_TRANSFER_RESULT
65
+ } USB_DK_TRANSFER_RESULT, *PUSB_DK_TRANSFER_RESULT;
66
+
67
+ typedef struct USB_DK_TRANSFER_REQUEST {
68
+ ULONG64 EndpointAddress;
69
+ PVOID64 Buffer;
70
+ ULONG64 BufferLength;
71
+ ULONG64 TransferType;
72
+ ULONG64 IsochronousPacketsArraySize;
73
+ PVOID64 IsochronousPacketsArray;
74
+ USB_DK_TRANSFER_RESULT Result;
75
+ } USB_DK_TRANSFER_REQUEST, *PUSB_DK_TRANSFER_REQUEST;
76
+
77
+ struct usbdk_device_priv {
78
+ USB_DK_DEVICE_INFO info;
79
+ PUSB_CONFIGURATION_DESCRIPTOR *config_descriptors;
80
+ HANDLE redirector_handle;
81
+ HANDLE system_handle;
82
+ uint8_t active_configuration;
83
+ };
84
+
85
+ struct winusb_device_priv {
86
+ bool initialized;
87
+ bool root_hub;
88
+ uint8_t active_config;
89
+ uint8_t depth; // distance to HCD
90
+ const struct windows_usb_api_backend *apib;
91
+ char *dev_id;
92
+ char *path; // device interface path
93
+ int sub_api; // for WinUSB-like APIs
94
+ struct {
95
+ char *path; // each interface needs a device interface path,
96
+ const struct windows_usb_api_backend *apib; // an API backend (multiple drivers support),
97
+ int sub_api;
98
+ int8_t nb_endpoints; // and a set of endpoint addresses (USB_MAXENDPOINTS)
99
+ uint8_t *endpoint;
100
+ int current_altsetting;
101
+ bool restricted_functionality; // indicates if the interface functionality is restricted
102
+ // by Windows (eg. HID keyboards or mice cannot do R/W)
103
+ } usb_interface[USB_MAXINTERFACES];
104
+ struct hid_device_priv *hid;
105
+ USB_DEVICE_DESCRIPTOR dev_descriptor;
106
+ PUSB_CONFIGURATION_DESCRIPTOR *config_descriptor; // list of pointers to the cached config descriptors
107
+ };
108
+
109
+ struct usbdk_device_handle_priv {
110
+ // Not currently used
111
+ char dummy;
112
+ };
113
+
114
+ struct winusb_device_handle_priv {
115
+ int active_interface;
116
+ struct {
117
+ HANDLE dev_handle; // WinUSB needs an extra handle for the file
118
+ HANDLE api_handle; // used by the API to communicate with the device
119
+ } interface_handle[USB_MAXINTERFACES];
120
+ int autoclaim_count[USB_MAXINTERFACES]; // For auto-release
121
+ };
122
+
123
+ struct usbdk_transfer_priv {
124
+ USB_DK_TRANSFER_REQUEST request;
125
+ struct winfd pollable_fd;
126
+ HANDLE system_handle;
127
+ PULONG64 IsochronousPacketsArray;
128
+ PUSB_DK_ISO_TRANSFER_RESULT IsochronousResultsArray;
129
+ };
130
+
131
+ struct winusb_transfer_priv {
132
+ struct winfd pollable_fd;
133
+ HANDLE handle;
134
+ uint8_t interface_number;
135
+ uint8_t *hid_buffer; // 1 byte extended data buffer, required for HID
136
+ uint8_t *hid_dest; // transfer buffer destination, required for HID
137
+ size_t hid_expected_size;
138
+
139
+ // For isochronous transfers with LibUSBk driver:
140
+ void *iso_context;
141
+
142
+ // For isochronous transfers with Microsoft WinUSB driver:
143
+ void *isoch_buffer_handle; // The isoch_buffer_handle to free at the end of the transfer
144
+ BOOL iso_break_stream; // Whether the isoch. stream was to be continued in the last call of libusb_submit_transfer.
145
+ // As we this structure is zeroed out upon initialization, we need to use inverse logic here.
146
+ libusb_transfer_cb_fn iso_user_callback; // Original transfer callback of the user. Might be used for isochronous transfers.
147
+ };