usb 2.0.0-alpha.2 → 2.0.1

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 (256) hide show
  1. package/.gitmodules +1 -1
  2. package/CHANGELOG.md +81 -0
  3. package/README.md +570 -0
  4. package/binding.gyp +2 -2
  5. package/dist/usb/bindings.d.ts +13 -0
  6. package/dist/usb/bindings.js +2 -1
  7. package/dist/usb/bindings.js.map +1 -1
  8. package/dist/usb/index.js +86 -2
  9. package/dist/usb/index.js.map +1 -1
  10. package/dist/usb/interface.js.map +1 -1
  11. package/dist/webusb/index.d.ts +28 -19
  12. package/dist/webusb/index.js +152 -66
  13. package/dist/webusb/index.js.map +1 -1
  14. package/dist/webusb/webusb-device.d.ts +1 -1
  15. package/dist/webusb/webusb-device.js +9 -4
  16. package/dist/webusb/webusb-device.js.map +1 -1
  17. package/libusb/.private/pre-commit.sh +7 -1
  18. package/libusb/.travis.yml +49 -0
  19. package/libusb/AUTHORS +44 -3
  20. package/libusb/Brewfile +4 -0
  21. package/libusb/ChangeLog +74 -2
  22. package/libusb/README.md +32 -0
  23. package/libusb/TODO +1 -1
  24. package/libusb/Xcode/common.xcconfig +12 -0
  25. package/libusb/Xcode/config.h +25 -0
  26. package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +959 -1
  27. package/libusb/android/README +4 -2
  28. package/libusb/android/config.h +75 -0
  29. package/libusb/appveyor.yml +41 -0
  30. package/libusb/appveyor_cygwin.bat +11 -0
  31. package/libusb/appveyor_minGW.bat +19 -0
  32. package/libusb/autogen.sh +1 -1
  33. package/libusb/bootstrap.sh +3 -16
  34. package/libusb/configure.ac +108 -80
  35. package/libusb/doc/doxygen.cfg.in +1785 -739
  36. package/libusb/examples/Makefile.am +1 -1
  37. package/libusb/examples/dpfp.c +3 -1
  38. package/libusb/examples/dpfp_threaded.c +23 -10
  39. package/libusb/examples/ezusb.c +3 -3
  40. package/libusb/examples/ezusb.h +2 -2
  41. package/libusb/examples/fxload.c +31 -9
  42. package/libusb/examples/hotplugtest.c +35 -7
  43. package/libusb/examples/listdevs.c +3 -1
  44. package/libusb/examples/sam3u_benchmark.c +3 -3
  45. package/libusb/examples/testlibusb.c +277 -0
  46. package/libusb/examples/xusb.c +40 -34
  47. package/libusb/libusb/Makefile.am +49 -23
  48. package/libusb/libusb/core.c +855 -457
  49. package/libusb/libusb/descriptor.c +72 -78
  50. package/libusb/libusb/hotplug.c +122 -76
  51. package/libusb/libusb/hotplug.h +42 -25
  52. package/libusb/libusb/io.c +625 -390
  53. package/libusb/libusb/libusb-1.0.def +12 -0
  54. package/libusb/libusb/libusb.h +218 -150
  55. package/libusb/libusb/libusbi.h +346 -176
  56. package/libusb/libusb/os/darwin_usb.c +604 -319
  57. package/libusb/libusb/os/darwin_usb.h +61 -20
  58. package/libusb/libusb/os/haiku_pollfs.cpp +367 -0
  59. package/libusb/libusb/os/haiku_usb.h +113 -0
  60. package/libusb/libusb/os/haiku_usb_backend.cpp +533 -0
  61. package/libusb/libusb/os/haiku_usb_raw.cpp +267 -0
  62. package/libusb/libusb/os/haiku_usb_raw.h +188 -0
  63. package/libusb/libusb/os/linux_netlink.c +186 -146
  64. package/libusb/libusb/os/linux_udev.c +36 -14
  65. package/libusb/libusb/os/linux_usbfs.c +426 -225
  66. package/libusb/libusb/os/linux_usbfs.h +5 -3
  67. package/libusb/libusb/os/netbsd_usb.c +21 -77
  68. package/libusb/libusb/os/openbsd_usb.c +32 -115
  69. package/libusb/libusb/os/poll_posix.c +38 -5
  70. package/libusb/libusb/os/poll_posix.h +3 -0
  71. package/libusb/libusb/os/poll_windows.c +277 -626
  72. package/libusb/libusb/os/poll_windows.h +11 -44
  73. package/libusb/libusb/os/sunos_usb.c +1695 -0
  74. package/libusb/libusb/os/sunos_usb.h +80 -0
  75. package/libusb/libusb/os/threads_posix.c +24 -26
  76. package/libusb/libusb/os/threads_posix.h +73 -21
  77. package/libusb/libusb/os/threads_windows.c +71 -157
  78. package/libusb/libusb/os/threads_windows.h +68 -44
  79. package/libusb/libusb/os/wince_usb.c +276 -420
  80. package/libusb/libusb/os/wince_usb.h +23 -28
  81. package/libusb/libusb/os/windows_common.h +78 -58
  82. package/libusb/libusb/os/windows_nt_common.c +1010 -0
  83. package/libusb/libusb/os/windows_nt_common.h +110 -0
  84. package/libusb/libusb/os/windows_nt_shared_types.h +147 -0
  85. package/libusb/libusb/os/windows_usbdk.c +830 -0
  86. package/libusb/libusb/os/windows_usbdk.h +103 -0
  87. package/libusb/libusb/os/windows_winusb.c +4391 -0
  88. package/libusb/libusb/os/windows_winusb.h +783 -0
  89. package/libusb/libusb/strerror.c +41 -7
  90. package/libusb/libusb/sync.c +41 -13
  91. package/libusb/libusb/version.h +1 -1
  92. package/libusb/libusb/version_nano.h +1 -1
  93. package/libusb/libusb-1.0.pc.in +1 -1
  94. package/libusb/msvc/appveyor.bat +27 -0
  95. package/libusb/msvc/config.h +5 -4
  96. package/libusb/msvc/ddk_build.cmd +87 -43
  97. package/libusb/msvc/fxload_2010.vcxproj +24 -104
  98. package/libusb/msvc/fxload_2012.vcxproj +24 -107
  99. package/libusb/msvc/fxload_2013.vcxproj +24 -107
  100. package/libusb/msvc/fxload_2015.vcxproj +91 -0
  101. package/libusb/msvc/fxload_2017.vcxproj +114 -0
  102. package/libusb/msvc/fxload_sources +1 -1
  103. package/libusb/msvc/getopt_2010.vcxproj +16 -75
  104. package/libusb/msvc/getopt_2012.vcxproj +16 -79
  105. package/libusb/msvc/getopt_2013.vcxproj +16 -79
  106. package/libusb/msvc/getopt_2015.vcxproj +73 -0
  107. package/libusb/msvc/getopt_2017.vcxproj +98 -0
  108. package/libusb/msvc/getopt_sources +6 -2
  109. package/libusb/msvc/hotplugtest_2010.vcxproj +18 -99
  110. package/libusb/msvc/hotplugtest_2012.vcxproj +18 -102
  111. package/libusb/msvc/hotplugtest_2013.vcxproj +18 -102
  112. package/libusb/msvc/hotplugtest_2015.vcxproj +83 -0
  113. package/libusb/msvc/hotplugtest_2017.vcxproj +106 -0
  114. package/libusb/msvc/hotplugtest_sources +1 -1
  115. package/libusb/msvc/libusb_2005.sln +20 -20
  116. package/libusb/msvc/libusb_2010.sln +57 -46
  117. package/libusb/msvc/libusb_2012.sln +57 -46
  118. package/libusb/msvc/libusb_2013.sln +57 -50
  119. package/libusb/msvc/libusb_2015.sln +59 -52
  120. package/libusb/msvc/libusb_2017.sln +186 -0
  121. package/libusb/msvc/libusb_dll.dsp +2 -2
  122. package/libusb/msvc/libusb_dll_2005.vcproj +30 -2
  123. package/libusb/msvc/libusb_dll_2010.vcxproj +26 -90
  124. package/libusb/msvc/libusb_dll_2012.vcxproj +28 -96
  125. package/libusb/msvc/libusb_dll_2013.vcxproj +28 -96
  126. package/libusb/msvc/libusb_dll_2015.vcxproj +107 -0
  127. package/libusb/msvc/libusb_dll_2017.vcxproj +134 -0
  128. package/libusb/msvc/libusb_dll_wince.vcproj +9 -1
  129. package/libusb/msvc/libusb_sources +10 -5
  130. package/libusb/msvc/libusb_static.dsp +2 -2
  131. package/libusb/msvc/libusb_static_2005.vcproj +32 -4
  132. package/libusb/msvc/libusb_static_2010.vcxproj +24 -83
  133. package/libusb/msvc/libusb_static_2012.vcxproj +25 -87
  134. package/libusb/msvc/libusb_static_2013.vcxproj +25 -87
  135. package/libusb/msvc/libusb_static_2015.vcxproj +98 -0
  136. package/libusb/msvc/libusb_static_2017.vcxproj +117 -0
  137. package/libusb/msvc/libusb_static_wince.vcproj +20 -26
  138. package/libusb/msvc/libusb_wince.sln +88 -88
  139. package/libusb/msvc/listdevs_2010.vcxproj +16 -99
  140. package/libusb/msvc/listdevs_2012.vcxproj +16 -102
  141. package/libusb/msvc/listdevs_2013.vcxproj +16 -102
  142. package/libusb/msvc/listdevs_2015.vcxproj +83 -0
  143. package/libusb/msvc/listdevs_2017.vcxproj +106 -0
  144. package/libusb/msvc/listdevs_sources +2 -1
  145. package/libusb/msvc/stress_2010.vcxproj +20 -101
  146. package/libusb/msvc/stress_2012.vcxproj +20 -104
  147. package/libusb/msvc/stress_2013.vcxproj +20 -104
  148. package/libusb/msvc/stress_2015.vcxproj +87 -0
  149. package/libusb/msvc/stress_2017.vcxproj +110 -0
  150. package/libusb/msvc/stress_sources +21 -0
  151. package/libusb/msvc/testlibusb_2010.vcxproj +82 -0
  152. package/libusb/msvc/testlibusb_2012.vcxproj +83 -0
  153. package/libusb/msvc/testlibusb_2013.vcxproj +83 -0
  154. package/libusb/msvc/testlibusb_2015.vcxproj +83 -0
  155. package/libusb/msvc/testlibusb_2017.vcxproj +106 -0
  156. package/libusb/msvc/testlibusb_sources +20 -0
  157. package/libusb/msvc/xusb_2010.vcxproj +17 -98
  158. package/libusb/msvc/xusb_2012.vcxproj +17 -101
  159. package/libusb/msvc/xusb_2013.vcxproj +17 -101
  160. package/libusb/msvc/xusb_2015.vcxproj +83 -0
  161. package/libusb/msvc/xusb_2017.vcxproj +106 -0
  162. package/libusb/msvc/xusb_sources +1 -1
  163. package/libusb/tests/stress.c +2 -2
  164. package/libusb/tests/testlib.c +0 -4
  165. package/libusb/travis-autogen.sh +39 -0
  166. package/libusb.gypi +13 -2
  167. package/package.json +23 -13
  168. package/prebuilds/android-arm/node.napi.armv7.node +0 -0
  169. package/prebuilds/android-arm64/node.napi.armv8.node +0 -0
  170. package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
  171. package/prebuilds/linux-arm/node.napi.armv6.node +0 -0
  172. package/prebuilds/linux-arm/node.napi.armv7.node +0 -0
  173. package/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
  174. package/prebuilds/linux-ia32/node.napi.node +0 -0
  175. package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  176. package/prebuilds/linux-x64/node.napi.musl.node +0 -0
  177. package/prebuilds/win32-ia32/node.napi.node +0 -0
  178. package/prebuilds/win32-x64/node.napi.node +0 -0
  179. package/src/device.cc +7 -7
  180. package/src/node_usb.cc +43 -1
  181. package/src/uv_async_queue.h +33 -25
  182. package/test/usb.coffee +6 -0
  183. package/tsc/index.ts +1 -1
  184. package/tsc/usb/bindings.ts +19 -1
  185. package/tsc/usb/index.ts +67 -19
  186. package/tsc/usb/interface.ts +2 -2
  187. package/tsc/webusb/index.ts +187 -75
  188. package/tsc/webusb/webusb-device.ts +19 -15
  189. package/.github/workflows/prebuild.yml +0 -48
  190. package/Readme.md +0 -339
  191. package/dist/webusb/typed-event-target.d.ts +0 -11
  192. package/dist/webusb/typed-event-target.js +0 -21
  193. package/dist/webusb/typed-event-target.js.map +0 -1
  194. package/docs/assets/css/main.css +0 -2660
  195. package/docs/assets/images/icons.png +0 -0
  196. package/docs/assets/images/icons@2x.png +0 -0
  197. package/docs/assets/images/widgets.png +0 -0
  198. package/docs/assets/images/widgets@2x.png +0 -0
  199. package/docs/assets/js/main.js +0 -248
  200. package/docs/assets/js/search.js +0 -1
  201. package/docs/classes/usb_bindings.device.html +0 -1338
  202. package/docs/classes/usb_bindings.libusbexception.html +0 -234
  203. package/docs/classes/usb_bindings.transfer.html +0 -344
  204. package/docs/classes/usb_capability.capability.html +0 -297
  205. package/docs/classes/usb_device.extendeddevice.html +0 -766
  206. package/docs/classes/usb_endpoint.endpoint.html +0 -472
  207. package/docs/classes/usb_endpoint.inendpoint.html +0 -766
  208. package/docs/classes/usb_endpoint.outendpoint.html +0 -582
  209. package/docs/classes/usb_interface.interface.html +0 -648
  210. package/docs/classes/webusb.webusb-1.html +0 -615
  211. package/docs/classes/webusb_mutex.mutex.html +0 -270
  212. package/docs/classes/webusb_typed_event_target.typedeventtarget.html +0 -443
  213. package/docs/classes/webusb_webusb_device.webusbdevice.html +0 -904
  214. package/docs/index.html +0 -500
  215. package/docs/interfaces/usb.deviceevents.html +0 -242
  216. package/docs/interfaces/usb_descriptors.bosdescriptor.html +0 -293
  217. package/docs/interfaces/usb_descriptors.capabilitydescriptor.html +0 -274
  218. package/docs/interfaces/usb_descriptors.configdescriptor.html +0 -388
  219. package/docs/interfaces/usb_descriptors.devicedescriptor.html +0 -464
  220. package/docs/interfaces/usb_descriptors.endpointdescriptor.html +0 -370
  221. package/docs/interfaces/usb_descriptors.interfacedescriptor.html +0 -407
  222. package/docs/interfaces/webusb.usboptions.html +0 -226
  223. package/docs/modules/index.html +0 -304
  224. package/docs/modules/usb.html +0 -173
  225. package/docs/modules/usb_bindings.html +0 -2248
  226. package/docs/modules/usb_capability.html +0 -156
  227. package/docs/modules/usb_descriptors.html +0 -176
  228. package/docs/modules/usb_device.html +0 -156
  229. package/docs/modules/usb_endpoint.html +0 -164
  230. package/docs/modules/usb_interface.html +0 -156
  231. package/docs/modules/webusb.html +0 -165
  232. package/docs/modules/webusb_mutex.html +0 -156
  233. package/docs/modules/webusb_typed_event_target.html +0 -156
  234. package/docs/modules/webusb_webusb_device.html +0 -156
  235. package/docs/modules.html +0 -156
  236. package/libusb/INSTALL +0 -234
  237. package/libusb/README +0 -28
  238. package/libusb/libusb/os/windows_usb.c +0 -5347
  239. package/libusb/libusb/os/windows_usb.h +0 -971
  240. package/libusb/msvc/fxload_2010.vcxproj.filters +0 -25
  241. package/libusb/msvc/fxload_2012.vcxproj.filters +0 -25
  242. package/libusb/msvc/getopt_2010.vcxproj.filters +0 -26
  243. package/libusb/msvc/getopt_2012.vcxproj.filters +0 -26
  244. package/libusb/msvc/hotplugtest_2010.vcxproj.filters +0 -14
  245. package/libusb/msvc/hotplugtest_2012.vcxproj.filters +0 -14
  246. package/libusb/msvc/libusb_dll_2010.vcxproj.filters +0 -81
  247. package/libusb/msvc/libusb_dll_2012.vcxproj.filters +0 -84
  248. package/libusb/msvc/libusb_static_2010.vcxproj.filters +0 -74
  249. package/libusb/msvc/libusb_static_2012.vcxproj.filters +0 -74
  250. package/libusb/msvc/listdevs_2010.vcxproj.filters +0 -14
  251. package/libusb/msvc/listdevs_2012.vcxproj.filters +0 -14
  252. package/libusb/msvc/stress_2010.vcxproj.filters +0 -25
  253. package/libusb/msvc/stress_2012.vcxproj.filters +0 -25
  254. package/libusb/msvc/xusb_2010.vcxproj.filters +0 -14
  255. package/libusb/msvc/xusb_2012.vcxproj.filters +0 -14
  256. 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
+ };