usb 2.17.0 → 3.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/LICENSE +18 -4
  2. package/README.md +25 -516
  3. package/dist/index.d.ts +67 -13
  4. package/dist/index.js +333 -64
  5. package/index.d.ts +89 -0
  6. package/index.js +583 -0
  7. package/package.json +53 -33
  8. package/CHANGELOG.md +0 -294
  9. package/binding.gyp +0 -128
  10. package/dist/index.js.map +0 -1
  11. package/dist/usb/bindings.d.ts +0 -266
  12. package/dist/usb/bindings.js +0 -10
  13. package/dist/usb/bindings.js.map +0 -1
  14. package/dist/usb/capability.d.ts +0 -13
  15. package/dist/usb/capability.js +0 -17
  16. package/dist/usb/capability.js.map +0 -1
  17. package/dist/usb/descriptors.d.ts +0 -128
  18. package/dist/usb/descriptors.js +0 -3
  19. package/dist/usb/descriptors.js.map +0 -1
  20. package/dist/usb/device.d.ts +0 -100
  21. package/dist/usb/device.js +0 -297
  22. package/dist/usb/device.js.map +0 -1
  23. package/dist/usb/endpoint.d.ts +0 -94
  24. package/dist/usb/endpoint.js +0 -219
  25. package/dist/usb/endpoint.js.map +0 -1
  26. package/dist/usb/index.d.ts +0 -31
  27. package/dist/usb/index.js +0 -116
  28. package/dist/usb/index.js.map +0 -1
  29. package/dist/usb/interface.d.ts +0 -80
  30. package/dist/usb/interface.js +0 -133
  31. package/dist/usb/interface.js.map +0 -1
  32. package/dist/webusb/index.d.ts +0 -64
  33. package/dist/webusb/index.js +0 -295
  34. package/dist/webusb/index.js.map +0 -1
  35. package/dist/webusb/webusb-device.d.ts +0 -54
  36. package/dist/webusb/webusb-device.js +0 -434
  37. package/dist/webusb/webusb-device.js.map +0 -1
  38. package/libusb/.clang-tidy +0 -34
  39. package/libusb/.codespellrc +0 -3
  40. package/libusb/.private/README.txt +0 -5
  41. package/libusb/.private/appveyor_build.sh +0 -26
  42. package/libusb/.private/bm.sh +0 -54
  43. package/libusb/.private/ci-build.sh +0 -92
  44. package/libusb/.private/ci-container-build.sh +0 -67
  45. package/libusb/.private/post-rewrite.sh +0 -32
  46. package/libusb/.private/pre-commit.sh +0 -52
  47. package/libusb/.private/wbs.txt +0 -43
  48. package/libusb/.travis.yml +0 -58
  49. package/libusb/AUTHORS +0 -231
  50. package/libusb/COPYING +0 -504
  51. package/libusb/ChangeLog +0 -365
  52. package/libusb/HACKING +0 -25
  53. package/libusb/INSTALL_WIN.txt +0 -52
  54. package/libusb/KEYS +0 -123
  55. package/libusb/Makefile.am +0 -50
  56. package/libusb/NEWS +0 -2
  57. package/libusb/PORTING +0 -94
  58. package/libusb/README +0 -29
  59. package/libusb/README.git +0 -41
  60. package/libusb/TODO +0 -2
  61. package/libusb/Xcode/common.xcconfig +0 -92
  62. package/libusb/Xcode/config.h +0 -31
  63. package/libusb/Xcode/debug.xcconfig +0 -32
  64. package/libusb/Xcode/libusb.xcconfig +0 -21
  65. package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +0 -1391
  66. package/libusb/Xcode/libusb_debug.xcconfig +0 -21
  67. package/libusb/Xcode/libusb_release.xcconfig +0 -21
  68. package/libusb/Xcode/release.xcconfig +0 -30
  69. package/libusb/android/README +0 -152
  70. package/libusb/android/config.h +0 -55
  71. package/libusb/android/examples/unrooted_android.c +0 -301
  72. package/libusb/android/examples/unrooted_android.h +0 -36
  73. package/libusb/android/jni/Android.mk +0 -23
  74. package/libusb/android/jni/Application.mk +0 -40
  75. package/libusb/android/jni/examples.mk +0 -168
  76. package/libusb/android/jni/libusb.mk +0 -60
  77. package/libusb/android/jni/tests.mk +0 -45
  78. package/libusb/appveyor.yml +0 -108
  79. package/libusb/autogen.sh +0 -10
  80. package/libusb/bootstrap.sh +0 -10
  81. package/libusb/configure.ac +0 -450
  82. package/libusb/doc/Makefile.in +0 -22
  83. package/libusb/doc/doxygen.cfg.in +0 -2571
  84. package/libusb/doc/libusb.png +0 -0
  85. package/libusb/examples/Makefile.am +0 -12
  86. package/libusb/examples/dpfp.c +0 -711
  87. package/libusb/examples/ezusb.c +0 -846
  88. package/libusb/examples/ezusb.h +0 -109
  89. package/libusb/examples/fxload.c +0 -310
  90. package/libusb/examples/hotplugtest.c +0 -147
  91. package/libusb/examples/listdevs.c +0 -73
  92. package/libusb/examples/sam3u_benchmark.c +0 -228
  93. package/libusb/examples/testlibusb.c +0 -312
  94. package/libusb/examples/xusb.c +0 -1254
  95. package/libusb/libusb/Makefile.am +0 -98
  96. package/libusb/libusb/Makefile.am.extra +0 -26
  97. package/libusb/libusb/core.c +0 -2925
  98. package/libusb/libusb/descriptor.c +0 -1558
  99. package/libusb/libusb/hotplug.c +0 -489
  100. package/libusb/libusb/io.c +0 -2865
  101. package/libusb/libusb/libusb-1.0.def +0 -199
  102. package/libusb/libusb/libusb-1.0.rc +0 -53
  103. package/libusb/libusb/libusb.h +0 -2421
  104. package/libusb/libusb/libusbi.h +0 -1535
  105. package/libusb/libusb/os/darwin_usb.c +0 -2977
  106. package/libusb/libusb/os/darwin_usb.h +0 -156
  107. package/libusb/libusb/os/emscripten_webusb.cpp +0 -875
  108. package/libusb/libusb/os/events_posix.c +0 -340
  109. package/libusb/libusb/os/events_posix.h +0 -62
  110. package/libusb/libusb/os/events_windows.c +0 -214
  111. package/libusb/libusb/os/events_windows.h +0 -46
  112. package/libusb/libusb/os/haiku_pollfs.cpp +0 -372
  113. package/libusb/libusb/os/haiku_usb.h +0 -113
  114. package/libusb/libusb/os/haiku_usb_backend.cpp +0 -532
  115. package/libusb/libusb/os/haiku_usb_raw.cpp +0 -231
  116. package/libusb/libusb/os/haiku_usb_raw.h +0 -188
  117. package/libusb/libusb/os/linux_netlink.c +0 -401
  118. package/libusb/libusb/os/linux_udev.c +0 -321
  119. package/libusb/libusb/os/linux_usbfs.c +0 -2829
  120. package/libusb/libusb/os/linux_usbfs.h +0 -221
  121. package/libusb/libusb/os/netbsd_usb.c +0 -617
  122. package/libusb/libusb/os/null_usb.c +0 -111
  123. package/libusb/libusb/os/openbsd_usb.c +0 -700
  124. package/libusb/libusb/os/sunos_usb.c +0 -1619
  125. package/libusb/libusb/os/sunos_usb.h +0 -79
  126. package/libusb/libusb/os/threads_posix.c +0 -126
  127. package/libusb/libusb/os/threads_posix.h +0 -98
  128. package/libusb/libusb/os/threads_windows.c +0 -40
  129. package/libusb/libusb/os/threads_windows.h +0 -113
  130. package/libusb/libusb/os/windows_common.c +0 -923
  131. package/libusb/libusb/os/windows_common.h +0 -424
  132. package/libusb/libusb/os/windows_usbdk.c +0 -724
  133. package/libusb/libusb/os/windows_usbdk.h +0 -106
  134. package/libusb/libusb/os/windows_winusb.c +0 -4766
  135. package/libusb/libusb/os/windows_winusb.h +0 -787
  136. package/libusb/libusb/strerror.c +0 -223
  137. package/libusb/libusb/sync.c +0 -342
  138. package/libusb/libusb/version.h +0 -18
  139. package/libusb/libusb/version_nano.h +0 -1
  140. package/libusb/libusb-1.0.pc.in +0 -11
  141. package/libusb/msvc/Base.props +0 -60
  142. package/libusb/msvc/Configuration.Application.props +0 -7
  143. package/libusb/msvc/Configuration.Base.props +0 -47
  144. package/libusb/msvc/Configuration.DynamicLibrary.props +0 -21
  145. package/libusb/msvc/Configuration.StaticLibrary.props +0 -7
  146. package/libusb/msvc/ProjectConfigurations.Base.props +0 -69
  147. package/libusb/msvc/build_all.ps1 +0 -17
  148. package/libusb/msvc/config.h +0 -58
  149. package/libusb/msvc/dpfp.vcxproj +0 -33
  150. package/libusb/msvc/dpfp_threaded.vcxproj +0 -38
  151. package/libusb/msvc/fxload.vcxproj +0 -46
  152. package/libusb/msvc/getopt/getopt.c +0 -1060
  153. package/libusb/msvc/getopt/getopt.h +0 -180
  154. package/libusb/msvc/getopt/getopt1.c +0 -188
  155. package/libusb/msvc/getopt.vcxproj +0 -33
  156. package/libusb/msvc/hotplugtest.vcxproj +0 -32
  157. package/libusb/msvc/init_context.vcxproj +0 -35
  158. package/libusb/msvc/libusb.sln +0 -542
  159. package/libusb/msvc/libusb_dll.vcxproj +0 -61
  160. package/libusb/msvc/libusb_static.vcxproj +0 -49
  161. package/libusb/msvc/listdevs.vcxproj +0 -32
  162. package/libusb/msvc/sam3u_benchmark.vcxproj +0 -33
  163. package/libusb/msvc/set_option.vcxproj +0 -35
  164. package/libusb/msvc/stress.vcxproj +0 -35
  165. package/libusb/msvc/stress_mt.vcxproj +0 -33
  166. package/libusb/msvc/testlibusb.vcxproj +0 -32
  167. package/libusb/msvc/xusb.vcxproj +0 -38
  168. package/libusb/tests/Makefile.am +0 -40
  169. package/libusb/tests/init_context.c +0 -153
  170. package/libusb/tests/libusb_testlib.h +0 -76
  171. package/libusb/tests/macos.c +0 -130
  172. package/libusb/tests/set_option.c +0 -253
  173. package/libusb/tests/stress.c +0 -172
  174. package/libusb/tests/stress_mt.c +0 -267
  175. package/libusb/tests/testlib.c +0 -184
  176. package/libusb/tests/umockdev.c +0 -1175
  177. package/libusb/tests/webusb-test-shim/index.js +0 -12
  178. package/libusb/tests/webusb-test-shim/package-lock.json +0 -50
  179. package/libusb/tests/webusb-test-shim/package.json +0 -10
  180. package/libusb.gypi +0 -154
  181. package/libusb_config/config.h +0 -1
  182. package/prebuilds/android-arm/node.napi.armv7.node +0 -0
  183. package/prebuilds/android-arm64/node.napi.armv8.node +0 -0
  184. package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
  185. package/prebuilds/linux-arm/node.napi.armv6.node +0 -0
  186. package/prebuilds/linux-arm/node.napi.armv7.node +0 -0
  187. package/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
  188. package/prebuilds/linux-ia32/node.napi.node +0 -0
  189. package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  190. package/prebuilds/linux-x64/node.napi.musl.node +0 -0
  191. package/prebuilds/win32-arm64/node.napi.node +0 -0
  192. package/prebuilds/win32-ia32/node.napi.node +0 -0
  193. package/prebuilds/win32-x64/node.napi.node +0 -0
  194. package/src/device.cc +0 -439
  195. package/src/helpers.h +0 -64
  196. package/src/hotplug/hotplug.h +0 -22
  197. package/src/hotplug/libusb.cc +0 -90
  198. package/src/hotplug/windows.cc +0 -168
  199. package/src/node_usb.cc +0 -314
  200. package/src/node_usb.h +0 -131
  201. package/src/thread_name.cc +0 -79
  202. package/src/thread_name.h +0 -11
  203. package/src/transfer.cc +0 -143
  204. package/src/uv_async_queue.h +0 -41
  205. package/test/usb.coffee +0 -250
  206. package/test/webusb.coffee +0 -227
  207. package/test/worker.cjs +0 -13
@@ -1,266 +0,0 @@
1
- import type { DeviceDescriptor, ConfigDescriptor, BosDescriptor } from './descriptors';
2
- /**
3
- * Return a list of `Device` objects for the USB devices attached to the system.
4
- */
5
- export declare function getDeviceList(): Device[];
6
- /**
7
- * Force polling loop for hotplug events
8
- */
9
- export declare let pollHotplug: boolean;
10
- /**
11
- * Hotplug polling loop delay (ms)
12
- */
13
- export declare let pollHotplugDelay: number;
14
- export declare const INIT_ERROR: number;
15
- export declare class LibUSBException extends Error {
16
- errno: number;
17
- }
18
- /**
19
- * Set the libusb debug level (between 0 and 4)
20
- * @param level libusb debug level (between 0 and 4)
21
- */
22
- export declare function setDebugLevel(level: number): void;
23
- /**
24
- * Use USBDK Backend (Windows only)
25
- */
26
- export declare function useUsbDkBackend(): void;
27
- export declare function _supportedHotplugEvents(): number;
28
- export declare function _enableHotplugEvents(): void;
29
- export declare function _disableHotplugEvents(): void;
30
- export declare function _getLibusbCapability(capability: number): number;
31
- /**
32
- * Restore (re-reference) the hotplug events unreferenced by `unrefHotplugEvents()`
33
- */
34
- export declare function refHotplugEvents(): void;
35
- /**
36
- * Unreference the hotplug events from the event loop, allowing the process to exit even when listening for the `attach` and `detach` events
37
- */
38
- export declare function unrefHotplugEvents(): void;
39
- /** Represents a USB transfer */
40
- export declare class Transfer {
41
- constructor(device: Device, endpointAddr: number, type: number, timeout: number, callback: (error: LibUSBException, buf: Buffer, actual: number) => void);
42
- /**
43
- * (Re-)submit the transfer.
44
- *
45
- * @param buffer Buffer where data will be written (for IN transfers) or read from (for OUT transfers).
46
- */
47
- submit(buffer: Buffer, callback?: (error: LibUSBException | undefined, buffer: Buffer, actualLength: number) => void): Transfer;
48
- /**
49
- * Cancel the transfer.
50
- *
51
- * Returns `true` if the transfer was canceled, `false` if it wasn't in pending state.
52
- */
53
- cancel(): boolean;
54
- }
55
- /** Represents a USB device. */
56
- export declare class Device {
57
- /** Integer USB device number */
58
- busNumber: number;
59
- /** Integer USB device address */
60
- deviceAddress: number;
61
- /** Array containing the USB device port numbers, or `undefined` if not supported on this platform. */
62
- portNumbers: number[];
63
- /** Object with properties for the fields of the device descriptor. */
64
- deviceDescriptor: DeviceDescriptor;
65
- _bosDescriptor?: BosDescriptor;
66
- __open(): void;
67
- __close(): void;
68
- __getParent(): Device;
69
- __getConfigDescriptor(): ConfigDescriptor;
70
- __getAllConfigDescriptors(): ConfigDescriptor[];
71
- __setConfiguration(desired: number, callback: (error?: LibUSBException) => void): void;
72
- __clearHalt(addr: number, callback: (error?: LibUSBException) => void): void;
73
- __setInterface(addr: number, altSetting: number, callback: (error?: LibUSBException) => void): void;
74
- __claimInterface(addr: number): void;
75
- __releaseInterface(addr: number, callback: (error?: LibUSBException) => void): void;
76
- __detachKernelDriver(addr: number): void;
77
- __attachKernelDriver(addr: number): void;
78
- __isKernelDriverActive(addr: number): boolean;
79
- __setAutoDetachKernelDriver(enable: number): void;
80
- /**
81
- * Performs a reset of the device. Callback is called when complete.
82
- *
83
- * The device must be open to use this method.
84
- * @param callback
85
- */
86
- reset(callback: (error?: LibUSBException) => void): void;
87
- }
88
- /**
89
- * In the context of a \ref libusb_device_descriptor "device descriptor",
90
- * this bDeviceClass value indicates that each interface specifies its
91
- * own class information and all interfaces operate independently.
92
- */
93
- export declare const LIBUSB_CLASS_PER_INTERFACE: number;
94
- /** Audio class */
95
- export declare const LIBUSB_CLASS_AUDIO: number;
96
- /** Communications class */
97
- export declare const LIBUSB_CLASS_COMM: number;
98
- /** Human Interface Device class */
99
- export declare const LIBUSB_CLASS_HID: number;
100
- /** Printer class */
101
- export declare const LIBUSB_CLASS_PRINTER: number;
102
- /** Image class */
103
- export declare const LIBUSB_CLASS_PTP: number;
104
- /** Mass storage class */
105
- export declare const LIBUSB_CLASS_MASS_STORAGE: number;
106
- /** Hub class */
107
- export declare const LIBUSB_CLASS_HUB: number;
108
- /** Data class */
109
- export declare const LIBUSB_CLASS_DATA: number;
110
- /** Wireless class */
111
- export declare const LIBUSB_CLASS_WIRELESS: number;
112
- /** Application class */
113
- export declare const LIBUSB_CLASS_APPLICATION: number;
114
- /** Class is vendor-specific */
115
- export declare const LIBUSB_CLASS_VENDOR_SPEC: number;
116
- /** Request status of the specific recipient */
117
- export declare const LIBUSB_REQUEST_GET_STATUS: number;
118
- /** Clear or disable a specific feature */
119
- export declare const LIBUSB_REQUEST_CLEAR_FEATURE: number;
120
- /** Set or enable a specific feature */
121
- export declare const LIBUSB_REQUEST_SET_FEATURE: number;
122
- /** Set device address for all future accesses */
123
- export declare const LIBUSB_REQUEST_SET_ADDRESS: number;
124
- /** Get the specified descriptor */
125
- export declare const LIBUSB_REQUEST_GET_DESCRIPTOR: number;
126
- /** Used to update existing descriptors or add new descriptors */
127
- export declare const LIBUSB_REQUEST_SET_DESCRIPTOR: number;
128
- /** Get the current device configuration value */
129
- export declare const LIBUSB_REQUEST_GET_CONFIGURATION: number;
130
- /** Set device configuration */
131
- export declare const LIBUSB_REQUEST_SET_CONFIGURATION: number;
132
- /** Return the selected alternate setting for the specified interface */
133
- export declare const LIBUSB_REQUEST_GET_INTERFACE: number;
134
- /** Select an alternate interface for the specified interface */
135
- export declare const LIBUSB_REQUEST_SET_INTERFACE: number;
136
- /** Set then report an endpoint's synchronization frame */
137
- export declare const LIBUSB_REQUEST_SYNCH_FRAME: number;
138
- /** Device descriptor. See libusb_device_descriptor. */
139
- export declare const LIBUSB_DT_DEVICE: number;
140
- /** Configuration descriptor. See libusb_config_descriptor. */
141
- export declare const LIBUSB_DT_CONFIG: number;
142
- /** String descriptor */
143
- export declare const LIBUSB_DT_STRING: number;
144
- export declare const LIBUSB_DT_BOS: number;
145
- /** Interface descriptor. See libusb_interface_descriptor. */
146
- export declare const LIBUSB_DT_INTERFACE: number;
147
- /** Endpoint descriptor. See libusb_endpoint_descriptor. */
148
- export declare const LIBUSB_DT_ENDPOINT: number;
149
- /** HID descriptor */
150
- export declare const LIBUSB_DT_HID: number;
151
- /** HID report descriptor */
152
- export declare const LIBUSB_DT_REPORT: number;
153
- /** Physical descriptor */
154
- export declare const LIBUSB_DT_PHYSICAL: number;
155
- /** Hub descriptor */
156
- export declare const LIBUSB_DT_HUB: number;
157
- /** In: device-to-host */
158
- export declare const LIBUSB_ENDPOINT_IN: number;
159
- /** Out: host-to-device */
160
- export declare const LIBUSB_ENDPOINT_OUT: number;
161
- /** Control endpoint */
162
- export declare const LIBUSB_TRANSFER_TYPE_CONTROL: number;
163
- /** Isochronous endpoint */
164
- export declare const LIBUSB_TRANSFER_TYPE_ISOCHRONOUS: number;
165
- /** Bulk endpoint */
166
- export declare const LIBUSB_TRANSFER_TYPE_BULK: number;
167
- /** Interrupt endpoint */
168
- export declare const LIBUSB_TRANSFER_TYPE_INTERRUPT: number;
169
- /** No synchronization */
170
- export declare const LIBUSB_ISO_SYNC_TYPE_NONE: number;
171
- /** Asynchronous */
172
- export declare const LIBUSB_ISO_SYNC_TYPE_ASYNC: number;
173
- /** Adaptive */
174
- export declare const LIBUSB_ISO_SYNC_TYPE_ADAPTIVE: number;
175
- /** Synchronous */
176
- export declare const LIBUSB_ISO_SYNC_TYPE_SYNC: number;
177
- /** Data endpoint */
178
- export declare const LIBUSB_ISO_USAGE_TYPE_DATA: number;
179
- /** Feedback endpoint */
180
- export declare const LIBUSB_ISO_USAGE_TYPE_FEEDBACK: number;
181
- /** Implicit feedback Data endpoint */
182
- export declare const LIBUSB_ISO_USAGE_TYPE_IMPLICIT: number;
183
- /**
184
- * Transfer completed without error. Note that this does not indicate
185
- * that the entire amount of requested data was transferred.
186
- */
187
- export declare const LIBUSB_TRANSFER_COMPLETED: number;
188
- /** Transfer failed */
189
- export declare const LIBUSB_TRANSFER_ERROR: number;
190
- /** Transfer timed out */
191
- export declare const LIBUSB_TRANSFER_TIMED_OUT: number;
192
- /** Transfer was cancelled */
193
- export declare const LIBUSB_TRANSFER_CANCELLED: number;
194
- /**
195
- * For bulk/interrupt endpoints: halt condition detected (endpoint
196
- * stalled). For control endpoints: control request not supported.
197
- */
198
- export declare const LIBUSB_TRANSFER_STALL: number;
199
- /** Device was disconnected */
200
- export declare const LIBUSB_TRANSFER_NO_DEVICE: number;
201
- /** Device sent more data than requested */
202
- export declare const LIBUSB_TRANSFER_OVERFLOW: number;
203
- /** Report short frames as errors */
204
- export declare const LIBUSB_TRANSFER_SHORT_NOT_OK: number;
205
- /**
206
- * Automatically free() transfer buffer during libusb_free_transfer().
207
- * Note that buffers allocated with libusb_dev_mem_alloc() should not
208
- * be attempted freed in this way, since free() is not an appropriate
209
- * way to release such memory.
210
- */
211
- export declare const LIBUSB_TRANSFER_FREE_BUFFER: number;
212
- /**
213
- * Automatically call libusb_free_transfer() after callback returns.
214
- * If this flag is set, it is illegal to call libusb_free_transfer()
215
- * from your transfer callback, as this will result in a double-free
216
- * when this flag is acted upon.
217
- */
218
- export declare const LIBUSB_TRANSFER_FREE_TRANSFER: number;
219
- /** Standard */
220
- export declare const LIBUSB_REQUEST_TYPE_STANDARD: number;
221
- /** Class */
222
- export declare const LIBUSB_REQUEST_TYPE_CLASS: number;
223
- /** Vendor */
224
- export declare const LIBUSB_REQUEST_TYPE_VENDOR: number;
225
- /** Reserved */
226
- export declare const LIBUSB_REQUEST_TYPE_RESERVED: number;
227
- /** Device */
228
- export declare const LIBUSB_RECIPIENT_DEVICE: number;
229
- /** Interface */
230
- export declare const LIBUSB_RECIPIENT_INTERFACE: number;
231
- /** Endpoint */
232
- export declare const LIBUSB_RECIPIENT_ENDPOINT: number;
233
- /** Other */
234
- export declare const LIBUSB_RECIPIENT_OTHER: number;
235
- export declare const LIBUSB_CONTROL_SETUP_SIZE: number;
236
- export declare const LIBUSB_DT_BOS_SIZE: number;
237
- export declare const LIBUSB_CAP_HAS_CAPABILITY: number;
238
- export declare const LIBUSB_CAP_HAS_HOTPLUG: number;
239
- export declare const LIBUSB_CAP_HAS_HID_ACCESS: number;
240
- export declare const LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER: number;
241
- /** Input/output error */
242
- export declare const LIBUSB_ERROR_IO: number;
243
- /** Invalid parameter */
244
- export declare const LIBUSB_ERROR_INVALID_PARAM: number;
245
- /** Access denied (insufficient permissions) */
246
- export declare const LIBUSB_ERROR_ACCESS: number;
247
- /** No such device (it may have been disconnected) */
248
- export declare const LIBUSB_ERROR_NO_DEVICE: number;
249
- /** Entity not found */
250
- export declare const LIBUSB_ERROR_NOT_FOUND: number;
251
- /** Resource busy */
252
- export declare const LIBUSB_ERROR_BUSY: number;
253
- /** Operation timed out */
254
- export declare const LIBUSB_ERROR_TIMEOUT: number;
255
- /** Overflow */
256
- export declare const LIBUSB_ERROR_OVERFLOW: number;
257
- /** Pipe error */
258
- export declare const LIBUSB_ERROR_PIPE: number;
259
- /** System call interrupted (perhaps due to signal) */
260
- export declare const LIBUSB_ERROR_INTERRUPTED: number;
261
- /** Insufficient memory */
262
- export declare const LIBUSB_ERROR_NO_MEM: number;
263
- /** Operation not supported or unimplemented on this platform */
264
- export declare const LIBUSB_ERROR_NOT_SUPPORTED: number;
265
- /** Other error */
266
- export declare const LIBUSB_ERROR_OTHER: number;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- // Definitions from DefinitelyTyped, thanks to:
3
- // Eric Brody <https://github.com/underscorebrody>
4
- // Rob Moran <https://github.com/thegecko>
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const path_1 = require("path");
7
- /* eslint-disable @typescript-eslint/no-var-requires */
8
- const usb = require('node-gyp-build')(process.env.NODE_USB_PATH || (0, path_1.join)(__dirname, '..', '..'));
9
- module.exports = usb;
10
- //# sourceMappingURL=bindings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bindings.js","sourceRoot":"","sources":["../../tsc/usb/bindings.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,mDAAmD;AACnD,2CAA2C;;AAE3C,+BAA4B;AAG5B,uDAAuD;AACvD,MAAM,GAAG,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAChG,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC"}
@@ -1,13 +0,0 @@
1
- import type { Device } from './bindings';
2
- import { CapabilityDescriptor } from './descriptors';
3
- export declare class Capability {
4
- protected device: Device;
5
- protected id: number;
6
- /** Object with fields from the capability descriptor -- see libusb documentation or USB spec. */
7
- descriptor: CapabilityDescriptor;
8
- /** Integer capability type. */
9
- type: number;
10
- /** Buffer capability data. */
11
- data: Buffer;
12
- constructor(device: Device, id: number);
13
- }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Capability = void 0;
4
- class Capability {
5
- constructor(device, id) {
6
- this.device = device;
7
- this.id = id;
8
- if (!device._bosDescriptor) {
9
- throw new Error('bosDescriptor not found');
10
- }
11
- this.descriptor = device._bosDescriptor.capabilities[this.id];
12
- this.type = this.descriptor.bDevCapabilityType;
13
- this.data = this.descriptor.dev_capability_data;
14
- }
15
- }
16
- exports.Capability = Capability;
17
- //# sourceMappingURL=capability.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"capability.js","sourceRoot":"","sources":["../../tsc/usb/capability.ts"],"names":[],"mappings":";;;AAGA,MAAa,UAAU;IAUnB,YAAsB,MAAc,EAAY,EAAU;QAApC,WAAM,GAAN,MAAM,CAAQ;QAAY,OAAE,GAAF,EAAE,CAAQ;QACtD,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC;QAC/C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC;IACpD,CAAC;CACJ;AAlBD,gCAkBC"}
@@ -1,128 +0,0 @@
1
- /** A structure representing the standard USB device descriptor */
2
- export interface DeviceDescriptor {
3
- /** Size of this descriptor (in bytes) */
4
- bLength: number;
5
- /** Descriptor type. */
6
- bDescriptorType: number;
7
- /** USB specification release number in binary-coded decimal. */
8
- bcdUSB: number;
9
- /** USB-IF class code for the device. */
10
- bDeviceClass: number;
11
- /** USB-IF subclass code for the device, qualified by the bDeviceClass value. */
12
- bDeviceSubClass: number;
13
- /** USB-IF protocol code for the device, qualified by the bDeviceClass and bDeviceSubClass values. */
14
- bDeviceProtocol: number;
15
- /** Maximum packet size for endpoint 0. */
16
- bMaxPacketSize0: number;
17
- /** USB-IF vendor ID. */
18
- idVendor: number;
19
- /** USB-IF product ID. */
20
- idProduct: number;
21
- /** Device release number in binary-coded decimal. */
22
- bcdDevice: number;
23
- /** Index of string descriptor describing manufacturer. */
24
- iManufacturer: number;
25
- /** Index of string descriptor describing product. */
26
- iProduct: number;
27
- /** Index of string descriptor containing device serial number. */
28
- iSerialNumber: number;
29
- /** Number of possible configurations. */
30
- bNumConfigurations: number;
31
- }
32
- /** A structure representing the standard USB configuration descriptor */
33
- export interface ConfigDescriptor {
34
- /** Size of this descriptor (in bytes) */
35
- bLength: number;
36
- /** Descriptor type. */
37
- bDescriptorType: number;
38
- /** Total length of data returned for this configuration. */
39
- wTotalLength: number;
40
- /** Number of interfaces supported by this configuration. */
41
- bNumInterfaces: number;
42
- /** Identifier value for this configuration. */
43
- bConfigurationValue: number;
44
- /** Index of string descriptor describing this configuration. */
45
- iConfiguration: number;
46
- /** Configuration characteristics. */
47
- bmAttributes: number;
48
- /** Maximum power consumption of the USB device from this bus in this configuration when the device is fully operation. */
49
- bMaxPower: number;
50
- /** Extra descriptors. */
51
- extra: Buffer;
52
- /** Array of interfaces supported by this configuration. */
53
- interfaces: InterfaceDescriptor[][];
54
- }
55
- /** A structure representing the standard USB interface descriptor */
56
- export interface InterfaceDescriptor {
57
- /** Size of this descriptor (in bytes) */
58
- bLength: number;
59
- /** Descriptor type. */
60
- bDescriptorType: number;
61
- /** Number of this interface. */
62
- bInterfaceNumber: number;
63
- /** Value used to select this alternate setting for this interface. */
64
- bAlternateSetting: number;
65
- /** Number of endpoints used by this interface (excluding the control endpoint). */
66
- bNumEndpoints: number;
67
- /** USB-IF class code for this interface. */
68
- bInterfaceClass: number;
69
- /** USB-IF subclass code for this interface, qualified by the bInterfaceClass value. */
70
- bInterfaceSubClass: number;
71
- /** USB-IF protocol code for this interface, qualified by the bInterfaceClass and bInterfaceSubClass values. */
72
- bInterfaceProtocol: number;
73
- /** Index of string descriptor describing this interface. */
74
- iInterface: number;
75
- /** Extra descriptors. */
76
- extra: Buffer;
77
- /** Array of endpoint descriptors. */
78
- endpoints: EndpointDescriptor[];
79
- }
80
- /** A structure representing the standard USB endpoint descriptor */
81
- export interface EndpointDescriptor {
82
- /** Size of this descriptor (in bytes) */
83
- bLength: number;
84
- /** Descriptor type. */
85
- bDescriptorType: number;
86
- /** The address of the endpoint described by this descriptor. */
87
- bEndpointAddress: number;
88
- /** Attributes which apply to the endpoint when it is configured using the bConfigurationValue. */
89
- bmAttributes: number;
90
- /** Maximum packet size this endpoint is capable of sending/receiving. */
91
- wMaxPacketSize: number;
92
- /** Interval for polling endpoint for data transfers. */
93
- bInterval: number;
94
- /** For audio devices only: the rate at which synchronization feedback is provided. */
95
- bRefresh: number;
96
- /** For audio devices only: the address if the synch endpoint. */
97
- bSynchAddress: number;
98
- /**
99
- * Extra descriptors.
100
- *
101
- * If libusb encounters unknown endpoint descriptors, it will store them here, should you wish to parse them.
102
- */
103
- extra: Buffer;
104
- }
105
- /** A generic representation of a BOS Device Capability descriptor */
106
- export interface CapabilityDescriptor {
107
- /** Size of this descriptor (in bytes) */
108
- bLength: number;
109
- /** Descriptor type. */
110
- bDescriptorType: number;
111
- /** Device Capability type. */
112
- bDevCapabilityType: number;
113
- /** Device Capability data (bLength - 3 bytes) */
114
- dev_capability_data: Buffer;
115
- }
116
- /** A structure representing the Binary Device Object Store (BOS) descriptor */
117
- export interface BosDescriptor {
118
- /** Size of this descriptor (in bytes) */
119
- bLength: number;
120
- /** Descriptor type. */
121
- bDescriptorType: number;
122
- /** Length of this descriptor and all of its sub descriptors. */
123
- wTotalLength: number;
124
- /** The number of separate device capability descriptors in the BOS. */
125
- bNumDeviceCaps: number;
126
- /** Device Capability Descriptors */
127
- capabilities: CapabilityDescriptor[];
128
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=descriptors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../../tsc/usb/descriptors.ts"],"names":[],"mappings":""}
@@ -1,100 +0,0 @@
1
- import * as usb from './bindings';
2
- import { Interface } from './interface';
3
- import { Capability } from './capability';
4
- import { BosDescriptor, ConfigDescriptor } from './descriptors';
5
- export declare class ExtendedDevice {
6
- /**
7
- * List of Interface objects for the interfaces of the default configuration of the device.
8
- */
9
- interfaces: Interface[] | undefined;
10
- private _timeout;
11
- /**
12
- * Timeout in milliseconds to use for control transfers.
13
- */
14
- get timeout(): number;
15
- set timeout(value: number);
16
- /**
17
- * Object with properties for the fields of the active configuration descriptor.
18
- */
19
- get configDescriptor(): ConfigDescriptor | undefined;
20
- /**
21
- * Contains all config descriptors of the device (same structure as .configDescriptor above)
22
- */
23
- get allConfigDescriptors(): ConfigDescriptor[];
24
- /**
25
- * Contains the parent of the device, such as a hub. If there is no parent this property is set to `null`.
26
- */
27
- get parent(): usb.Device;
28
- /**
29
- * Open the device.
30
- * @param defaultConfig
31
- */
32
- open(this: usb.Device, defaultConfig?: boolean): void;
33
- /**
34
- * Close the device.
35
- *
36
- * The device must be open to use this method.
37
- */
38
- close(this: usb.Device): void;
39
- /**
40
- * Set the device configuration to something other than the default (0). To use this, first call `.open(false)` (which tells it not to auto configure),
41
- * then before claiming an interface, call this method.
42
- *
43
- * The device must be open to use this method.
44
- * @param desired
45
- * @param callback
46
- */
47
- setConfiguration(this: usb.Device, desired: number, callback?: (error: usb.LibUSBException | undefined) => void): void;
48
- /**
49
- * Enable/disable libusb's automatic kernel driver detachment
50
- * When this is enabled libusb will automatically detach the kernel driver on an interface when claiming the interface, and attach it when releasing the interface
51
- *
52
- * The device must be open to use this method.
53
- */
54
- setAutoDetachKernelDriver(enable: boolean): void;
55
- /**
56
- * Perform a control transfer with `libusb_control_transfer`.
57
- *
58
- * Parameter `data_or_length` can be an integer length for an IN transfer, or a `Buffer` for an OUT transfer. The type must match the direction specified in the MSB of bmRequestType.
59
- *
60
- * The `data` parameter of the callback is actual transferred for OUT transfers, or will be passed a Buffer for IN transfers.
61
- *
62
- * The device must be open to use this method.
63
- * @param bmRequestType
64
- * @param bRequest
65
- * @param wValue
66
- * @param wIndex
67
- * @param data_or_length
68
- * @param callback
69
- */
70
- controlTransfer(this: usb.Device, bmRequestType: number, bRequest: number, wValue: number, wIndex: number, data_or_length: number | Buffer, callback?: (error: usb.LibUSBException | undefined, buffer: Buffer | number | undefined) => void): usb.Device;
71
- /**
72
- * Return the interface with the specified interface number.
73
- *
74
- * The device must be open to use this method.
75
- * @param addr
76
- */
77
- interface(this: usb.Device, addr: number): Interface;
78
- /**
79
- * Perform a control transfer to retrieve a string descriptor
80
- *
81
- * The device must be open to use this method.
82
- * @param desc_index
83
- * @param callback
84
- */
85
- getStringDescriptor(this: usb.Device, desc_index: number, callback: (error?: usb.LibUSBException, value?: string) => void): void;
86
- /**
87
- * Perform a control transfer to retrieve an object with properties for the fields of the Binary Object Store descriptor.
88
- *
89
- * The device must be open to use this method.
90
- * @param callback
91
- */
92
- getBosDescriptor(this: usb.Device, callback: (error?: usb.LibUSBException, descriptor?: BosDescriptor) => void): void;
93
- /**
94
- * Retrieve a list of Capability objects for the Binary Object Store capabilities of the device.
95
- *
96
- * The device must be open to use this method.
97
- * @param callback
98
- */
99
- getCapabilities(this: usb.Device, callback: (error: usb.LibUSBException | undefined, capabilities?: Capability[]) => void): void;
100
- }