1 | import type { DeviceDescriptor, ConfigDescriptor, BosDescriptor } from './descriptors';
|
2 |
|
3 |
|
4 |
|
5 | export declare function getDeviceList(): Device[];
|
6 |
|
7 |
|
8 |
|
9 | export declare let pollHotplug: boolean;
|
10 |
|
11 |
|
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 |
|
20 |
|
21 |
|
22 | export declare function setDebugLevel(level: number): void;
|
23 |
|
24 |
|
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 |
|
33 |
|
34 | export declare function refHotplugEvents(): void;
|
35 |
|
36 |
|
37 |
|
38 | export declare function unrefHotplugEvents(): void;
|
39 |
|
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 |
|
58 | busNumber: number;
|
59 |
|
60 | deviceAddress: number;
|
61 |
|
62 | portNumbers: number[];
|
63 |
|
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 | |
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 | reset(callback: (error?: LibUSBException) => void): void;
|
86 | }
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 | export declare const LIBUSB_CLASS_PER_INTERFACE: number;
|
93 |
|
94 | export declare const LIBUSB_CLASS_AUDIO: number;
|
95 |
|
96 | export declare const LIBUSB_CLASS_COMM: number;
|
97 |
|
98 | export declare const LIBUSB_CLASS_HID: number;
|
99 |
|
100 | export declare const LIBUSB_CLASS_PRINTER: number;
|
101 |
|
102 | export declare const LIBUSB_CLASS_PTP: number;
|
103 |
|
104 | export declare const LIBUSB_CLASS_MASS_STORAGE: number;
|
105 |
|
106 | export declare const LIBUSB_CLASS_HUB: number;
|
107 |
|
108 | export declare const LIBUSB_CLASS_DATA: number;
|
109 |
|
110 | export declare const LIBUSB_CLASS_WIRELESS: number;
|
111 |
|
112 | export declare const LIBUSB_CLASS_APPLICATION: number;
|
113 |
|
114 | export declare const LIBUSB_CLASS_VENDOR_SPEC: number;
|
115 |
|
116 | export declare const LIBUSB_REQUEST_GET_STATUS: number;
|
117 |
|
118 | export declare const LIBUSB_REQUEST_CLEAR_FEATURE: number;
|
119 |
|
120 | export declare const LIBUSB_REQUEST_SET_FEATURE: number;
|
121 |
|
122 | export declare const LIBUSB_REQUEST_SET_ADDRESS: number;
|
123 |
|
124 | export declare const LIBUSB_REQUEST_GET_DESCRIPTOR: number;
|
125 |
|
126 | export declare const LIBUSB_REQUEST_SET_DESCRIPTOR: number;
|
127 |
|
128 | export declare const LIBUSB_REQUEST_GET_CONFIGURATION: number;
|
129 |
|
130 | export declare const LIBUSB_REQUEST_SET_CONFIGURATION: number;
|
131 |
|
132 | export declare const LIBUSB_REQUEST_GET_INTERFACE: number;
|
133 |
|
134 | export declare const LIBUSB_REQUEST_SET_INTERFACE: number;
|
135 |
|
136 | export declare const LIBUSB_REQUEST_SYNCH_FRAME: number;
|
137 |
|
138 | export declare const LIBUSB_DT_DEVICE: number;
|
139 |
|
140 | export declare const LIBUSB_DT_CONFIG: number;
|
141 |
|
142 | export declare const LIBUSB_DT_STRING: number;
|
143 | export declare const LIBUSB_DT_BOS: number;
|
144 |
|
145 | export declare const LIBUSB_DT_INTERFACE: number;
|
146 |
|
147 | export declare const LIBUSB_DT_ENDPOINT: number;
|
148 |
|
149 | export declare const LIBUSB_DT_HID: number;
|
150 |
|
151 | export declare const LIBUSB_DT_REPORT: number;
|
152 |
|
153 | export declare const LIBUSB_DT_PHYSICAL: number;
|
154 |
|
155 | export declare const LIBUSB_DT_HUB: number;
|
156 |
|
157 | export declare const LIBUSB_ENDPOINT_IN: number;
|
158 |
|
159 | export declare const LIBUSB_ENDPOINT_OUT: number;
|
160 |
|
161 | export declare const LIBUSB_TRANSFER_TYPE_CONTROL: number;
|
162 |
|
163 | export declare const LIBUSB_TRANSFER_TYPE_ISOCHRONOUS: number;
|
164 |
|
165 | export declare const LIBUSB_TRANSFER_TYPE_BULK: number;
|
166 |
|
167 | export declare const LIBUSB_TRANSFER_TYPE_INTERRUPT: number;
|
168 |
|
169 | export declare const LIBUSB_ISO_SYNC_TYPE_NONE: number;
|
170 |
|
171 | export declare const LIBUSB_ISO_SYNC_TYPE_ASYNC: number;
|
172 |
|
173 | export declare const LIBUSB_ISO_SYNC_TYPE_ADAPTIVE: number;
|
174 |
|
175 | export declare const LIBUSB_ISO_SYNC_TYPE_SYNC: number;
|
176 |
|
177 | export declare const LIBUSB_ISO_USAGE_TYPE_DATA: number;
|
178 |
|
179 | export declare const LIBUSB_ISO_USAGE_TYPE_FEEDBACK: number;
|
180 |
|
181 | export declare const LIBUSB_ISO_USAGE_TYPE_IMPLICIT: number;
|
182 |
|
183 |
|
184 |
|
185 |
|
186 | export declare const LIBUSB_TRANSFER_COMPLETED: number;
|
187 |
|
188 | export declare const LIBUSB_TRANSFER_ERROR: number;
|
189 |
|
190 | export declare const LIBUSB_TRANSFER_TIMED_OUT: number;
|
191 |
|
192 | export declare const LIBUSB_TRANSFER_CANCELLED: number;
|
193 |
|
194 |
|
195 |
|
196 |
|
197 | export declare const LIBUSB_TRANSFER_STALL: number;
|
198 |
|
199 | export declare const LIBUSB_TRANSFER_NO_DEVICE: number;
|
200 |
|
201 | export declare const LIBUSB_TRANSFER_OVERFLOW: number;
|
202 |
|
203 | export declare const LIBUSB_TRANSFER_SHORT_NOT_OK: number;
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 | export declare const LIBUSB_TRANSFER_FREE_BUFFER: number;
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 | export declare const LIBUSB_TRANSFER_FREE_TRANSFER: number;
|
218 |
|
219 | export declare const LIBUSB_REQUEST_TYPE_STANDARD: number;
|
220 |
|
221 | export declare const LIBUSB_REQUEST_TYPE_CLASS: number;
|
222 |
|
223 | export declare const LIBUSB_REQUEST_TYPE_VENDOR: number;
|
224 |
|
225 | export declare const LIBUSB_REQUEST_TYPE_RESERVED: number;
|
226 |
|
227 | export declare const LIBUSB_RECIPIENT_DEVICE: number;
|
228 |
|
229 | export declare const LIBUSB_RECIPIENT_INTERFACE: number;
|
230 |
|
231 | export declare const LIBUSB_RECIPIENT_ENDPOINT: number;
|
232 |
|
233 | export declare const LIBUSB_RECIPIENT_OTHER: number;
|
234 | export declare const LIBUSB_CONTROL_SETUP_SIZE: number;
|
235 | export declare const LIBUSB_DT_BOS_SIZE: number;
|
236 | export declare const LIBUSB_CAP_HAS_CAPABILITY: number;
|
237 | export declare const LIBUSB_CAP_HAS_HOTPLUG: number;
|
238 | export declare const LIBUSB_CAP_HAS_HID_ACCESS: number;
|
239 | export declare const LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER: number;
|
240 |
|
241 | export declare const LIBUSB_ERROR_IO: number;
|
242 |
|
243 | export declare const LIBUSB_ERROR_INVALID_PARAM: number;
|
244 |
|
245 | export declare const LIBUSB_ERROR_ACCESS: number;
|
246 |
|
247 | export declare const LIBUSB_ERROR_NO_DEVICE: number;
|
248 |
|
249 | export declare const LIBUSB_ERROR_NOT_FOUND: number;
|
250 |
|
251 | export declare const LIBUSB_ERROR_BUSY: number;
|
252 |
|
253 | export declare const LIBUSB_ERROR_TIMEOUT: number;
|
254 |
|
255 | export declare const LIBUSB_ERROR_OVERFLOW: number;
|
256 |
|
257 | export declare const LIBUSB_ERROR_PIPE: number;
|
258 |
|
259 | export declare const LIBUSB_ERROR_INTERRUPTED: number;
|
260 |
|
261 | export declare const LIBUSB_ERROR_NO_MEM: number;
|
262 |
|
263 | export declare const LIBUSB_ERROR_NOT_SUPPORTED: number;
|
264 |
|
265 | export declare const LIBUSB_ERROR_OTHER: number;
|