usb 2.16.0 → 2.18.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.
- package/CHANGELOG.md +14 -0
- package/README.md +14 -0
- package/binding.gyp +2 -9
- package/dist/usb/bindings.d.ts +27 -2
- package/dist/usb/bindings.js.map +1 -1
- package/dist/usb/endpoint.js +1 -1
- package/dist/usb/endpoint.js.map +1 -1
- package/dist/usb/index.d.ts +0 -29
- package/dist/usb/index.js +4 -18
- package/dist/usb/index.js.map +1 -1
- package/dist/webusb/index.d.ts +1 -1
- package/dist/webusb/index.js +1 -1
- package/dist/webusb/index.js.map +1 -1
- package/dist/webusb/webusb-device.d.ts +4 -4
- package/dist/webusb/webusb-device.js +5 -2
- package/dist/webusb/webusb-device.js.map +1 -1
- package/libusb/.clang-tidy +36 -0
- package/libusb/.private/ci-build.sh +5 -1
- package/libusb/AUTHORS +21 -0
- package/libusb/ChangeLog +29 -2
- package/libusb/KEYS +123 -0
- package/libusb/README +8 -9
- package/libusb/Xcode/common.xcconfig +20 -0
- package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +16 -12
- package/libusb/android/examples/unrooted_android.c +1 -0
- package/libusb/configure.ac +12 -2
- package/libusb/examples/dpfp.c +1 -1
- package/libusb/examples/ezusb.c +6 -1
- package/libusb/examples/fxload.c +7 -5
- package/libusb/examples/hotplugtest.c +19 -11
- package/libusb/examples/listdevs.c +41 -3
- package/libusb/examples/testlibusb.c +1 -0
- package/libusb/examples/xusb.c +142 -77
- package/libusb/libusb/Makefile.am +4 -0
- package/libusb/libusb/core.c +183 -24
- package/libusb/libusb/descriptor.c +404 -96
- package/libusb/libusb/hotplug.c +27 -8
- package/libusb/libusb/io.c +10 -5
- package/libusb/libusb/libusb-1.0.def +14 -0
- package/libusb/libusb/libusb.h +179 -19
- package/libusb/libusb/libusbi.h +101 -25
- package/libusb/libusb/os/darwin_usb.c +216 -90
- package/libusb/libusb/os/darwin_usb.h +10 -8
- package/libusb/libusb/os/emscripten_webusb.cpp +38 -12
- package/libusb/libusb/os/events_posix.c +4 -4
- package/libusb/libusb/os/haiku_usb_raw.cpp +4 -0
- package/libusb/libusb/os/linux_usbfs.c +92 -33
- package/libusb/libusb/os/linux_usbfs.h +13 -3
- package/libusb/libusb/os/netbsd_usb.c +6 -4
- package/libusb/libusb/os/openbsd_usb.c +4 -2
- package/libusb/libusb/os/sunos_usb.c +7 -5
- package/libusb/libusb/os/threads_posix.c +20 -19
- package/libusb/libusb/os/threads_posix.h +9 -3
- package/libusb/libusb/os/threads_windows.h +4 -3
- package/libusb/libusb/os/windows_common.c +86 -1
- package/libusb/libusb/os/windows_common.h +20 -1
- package/libusb/libusb/os/windows_hotplug.c +321 -0
- package/libusb/libusb/os/windows_hotplug.h +28 -0
- package/libusb/libusb/os/windows_usbdk.c +16 -8
- package/libusb/libusb/os/windows_winusb.c +788 -56
- package/libusb/libusb/os/windows_winusb.h +11 -6
- package/libusb/libusb/sync.c +8 -5
- package/libusb/libusb/version.h +1 -1
- package/libusb/libusb/version_nano.h +1 -1
- package/libusb/msvc/Base.props +1 -1
- package/libusb/msvc/Configuration.Base.props +2 -1
- package/libusb/msvc/Configuration.DynamicLibrary.props +12 -0
- package/libusb/msvc/ProjectConfigurations.Base.props +69 -16
- package/libusb/msvc/build_all.ps1 +2 -2
- package/libusb/msvc/config.h +4 -0
- package/libusb/msvc/getopt/bits/getopt_core.h +96 -0
- package/libusb/msvc/getopt/bits/getopt_ext.h +77 -0
- package/libusb/msvc/getopt/features.h +21 -0
- package/libusb/msvc/getopt/getopt.c +456 -705
- package/libusb/msvc/getopt/getopt.h +16 -158
- package/libusb/msvc/getopt/getopt1.c +40 -69
- package/libusb/msvc/getopt/getopt_int.h +118 -0
- package/libusb/msvc/getopt/gettext.h +7 -0
- package/libusb/msvc/getopt/unistd.h +5 -0
- package/libusb/msvc/getopt.vcxproj +11 -4
- package/libusb/msvc/libusb.sln +515 -268
- package/libusb/msvc/libusb_dll.vcxproj +2 -0
- package/libusb/msvc/libusb_static.vcxproj +2 -0
- package/libusb/msvc/xusb.vcxproj +1 -1
- package/libusb/tests/Makefile.am +10 -1
- package/libusb/tests/fuzz/corpus/bos/min.bos +0 -0
- package/libusb/tests/fuzz/corpus/descriptor_parsers/min_valid_config.bin +0 -0
- package/libusb/tests/fuzz/corpus/descriptor_parsers/regression_bug_a_endpoint_null.bin +0 -0
- package/libusb/tests/fuzz/corpus/descriptor_parsers/regression_bug_b_iad_oob.bin +0 -0
- package/libusb/tests/fuzz/fuzz_bos_descriptor.c +49 -0
- package/libusb/tests/fuzz/fuzz_descriptor_parsers.c +83 -0
- package/libusb/tests/macos.c +2 -2
- package/libusb/tests/stress_mt.c +6 -3
- package/libusb/tests/webusb-test-shim/index.js +6 -5
- package/libusb.gypi +5 -0
- package/package.json +3 -3
- package/prebuilds/android-arm/node.napi.armv7.node +0 -0
- package/prebuilds/android-arm64/node.napi.armv8.node +0 -0
- package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
- package/prebuilds/linux-arm/node.napi.armv6.node +0 -0
- package/prebuilds/linux-arm/node.napi.armv7.node +0 -0
- package/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
- package/prebuilds/linux-ia32/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
- package/prebuilds/linux-x64/node.napi.musl.node +0 -0
- package/prebuilds/win32-arm64/node.napi.node +0 -0
- package/prebuilds/win32-ia32/node.napi.node +0 -0
- package/prebuilds/win32-x64/node.napi.node +0 -0
- package/src/{hotplug/libusb.cc → hotplug.cc} +2 -3
- package/src/{hotplug/hotplug.h → hotplug.h} +2 -6
- package/src/node_usb.cc +3 -3
- package/test/usb.coffee +4 -4
- package/test/webusb.coffee +22 -12
- package/src/hotplug/windows.cc +0 -168
package/libusb/libusb/hotplug.c
CHANGED
|
@@ -161,6 +161,27 @@ void usbi_hotplug_init(struct libusb_context *ctx)
|
|
|
161
161
|
usbi_atomic_store(&ctx->hotplug_ready, 1);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
static void usbi_recursively_remove_parents(struct libusb_device *dev, struct libusb_device *next_dev)
|
|
165
|
+
{
|
|
166
|
+
if (dev && dev->parent_dev) {
|
|
167
|
+
if (usbi_atomic_load(&dev->parent_dev->refcnt) == 1) {
|
|
168
|
+
/* The parent was processed before this device in the list and
|
|
169
|
+
* therefore has its ref count already decremented for its own ref.
|
|
170
|
+
* The only remaining counted ref comes from its remaining single child.
|
|
171
|
+
* It will thus be released when its child will be released. So we
|
|
172
|
+
* can remove it from the list. This is safe as parent_dev cannot be
|
|
173
|
+
* equal to next_dev given that we know at this point that it was
|
|
174
|
+
* previously seen in the list. */
|
|
175
|
+
assert (dev->parent_dev != next_dev);
|
|
176
|
+
if (dev->parent_dev->list.next && dev->parent_dev->list.prev) {
|
|
177
|
+
list_del(&dev->parent_dev->list);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
usbi_recursively_remove_parents(dev->parent_dev, next_dev);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
164
185
|
void usbi_hotplug_exit(struct libusb_context *ctx)
|
|
165
186
|
{
|
|
166
187
|
struct usbi_hotplug_callback *hotplug_cb, *next_cb;
|
|
@@ -193,7 +214,8 @@ void usbi_hotplug_exit(struct libusb_context *ctx)
|
|
|
193
214
|
free(msg);
|
|
194
215
|
}
|
|
195
216
|
|
|
196
|
-
/*
|
|
217
|
+
usbi_mutex_lock(&ctx->usb_devs_lock); /* hotplug thread might still be processing an already triggered event, possibly accessing this list as well */
|
|
218
|
+
/* free all discovered devices */
|
|
197
219
|
for_each_device_safe(ctx, dev, next_dev) {
|
|
198
220
|
/* remove the device from the usb_devs list only if there are no
|
|
199
221
|
* references held, otherwise leave it on the list so that a
|
|
@@ -201,15 +223,12 @@ void usbi_hotplug_exit(struct libusb_context *ctx)
|
|
|
201
223
|
if (usbi_atomic_load(&dev->refcnt) == 1) {
|
|
202
224
|
list_del(&dev->list);
|
|
203
225
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
equal to next_dev. */
|
|
208
|
-
assert (dev->parent_dev != next_dev);
|
|
209
|
-
list_del(&dev->parent_dev->list);
|
|
210
|
-
}
|
|
226
|
+
|
|
227
|
+
usbi_recursively_remove_parents(dev, next_dev);
|
|
228
|
+
|
|
211
229
|
libusb_unref_device(dev);
|
|
212
230
|
}
|
|
231
|
+
usbi_mutex_unlock(&ctx->usb_devs_lock);
|
|
213
232
|
|
|
214
233
|
usbi_mutex_destroy(&ctx->hotplug_cbs_lock);
|
|
215
234
|
}
|
package/libusb/libusb/io.c
CHANGED
|
@@ -1303,7 +1303,6 @@ struct libusb_transfer * LIBUSB_CALL libusb_alloc_transfer(
|
|
|
1303
1303
|
return NULL;
|
|
1304
1304
|
|
|
1305
1305
|
struct usbi_transfer *itransfer = (struct usbi_transfer *)(ptr + priv_size);
|
|
1306
|
-
itransfer->num_iso_packets = iso_packets;
|
|
1307
1306
|
itransfer->priv = ptr;
|
|
1308
1307
|
usbi_mutex_init(&itransfer->lock);
|
|
1309
1308
|
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
|
|
@@ -1370,8 +1369,10 @@ static int arm_timer_for_next_timeout(struct libusb_context *ctx)
|
|
|
1370
1369
|
|
|
1371
1370
|
/* act on first transfer that has not already been handled */
|
|
1372
1371
|
if (!(itransfer->timeout_flags & (USBI_TRANSFER_TIMEOUT_HANDLED | USBI_TRANSFER_OS_HANDLES_TIMEOUT))) {
|
|
1372
|
+
#ifdef ENABLE_LOGGING
|
|
1373
1373
|
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
|
|
1374
1374
|
usbi_dbg(ctx, "next timeout originally %ums", transfer->timeout);
|
|
1375
|
+
#endif
|
|
1375
1376
|
return usbi_arm_timer(&ctx->timer, cur_ts);
|
|
1376
1377
|
}
|
|
1377
1378
|
}
|
|
@@ -1434,9 +1435,11 @@ out:
|
|
|
1434
1435
|
if (first && usbi_using_timer(ctx) && TIMESPEC_IS_SET(timeout)) {
|
|
1435
1436
|
/* if this transfer has the lowest timeout of all active transfers,
|
|
1436
1437
|
* rearm the timer with this transfer's timeout */
|
|
1438
|
+
#ifdef ENABLE_LOGGING
|
|
1437
1439
|
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
|
|
1438
1440
|
usbi_dbg(ctx, "arm timer for timeout in %ums (first in line)",
|
|
1439
1441
|
transfer->timeout);
|
|
1442
|
+
#endif
|
|
1440
1443
|
r = usbi_arm_timer(&ctx->timer, timeout);
|
|
1441
1444
|
}
|
|
1442
1445
|
#else
|
|
@@ -1714,6 +1717,7 @@ int usbi_handle_transfer_completion(struct usbi_transfer *itransfer,
|
|
|
1714
1717
|
flags = transfer->flags;
|
|
1715
1718
|
transfer->status = status;
|
|
1716
1719
|
transfer->actual_length = itransfer->transferred;
|
|
1720
|
+
assert(transfer->actual_length >= 0);
|
|
1717
1721
|
usbi_dbg(ctx, "transfer %p has callback %p",
|
|
1718
1722
|
(void *) transfer, transfer->callback);
|
|
1719
1723
|
if (transfer->callback) {
|
|
@@ -2044,7 +2048,7 @@ int API_EXPORTED libusb_wait_for_event(libusb_context *ctx, struct timeval *tv)
|
|
|
2044
2048
|
return 0;
|
|
2045
2049
|
}
|
|
2046
2050
|
|
|
2047
|
-
|
|
2051
|
+
/* NB: flying_transfers_lock must be held when calling this */
|
|
2048
2052
|
static void handle_timeout(struct usbi_transfer *itransfer)
|
|
2049
2053
|
{
|
|
2050
2054
|
struct libusb_transfer *transfer =
|
|
@@ -2060,7 +2064,7 @@ static void handle_timeout(struct usbi_transfer *itransfer)
|
|
|
2060
2064
|
"async cancel failed %d", r);
|
|
2061
2065
|
}
|
|
2062
2066
|
|
|
2063
|
-
|
|
2067
|
+
/* NB: flying_transfers_lock must be held when calling this */
|
|
2064
2068
|
static void handle_timeouts_locked(struct libusb_context *ctx)
|
|
2065
2069
|
{
|
|
2066
2070
|
struct timespec systime;
|
|
@@ -2810,9 +2814,8 @@ void API_EXPORTED libusb_free_pollfds(const struct libusb_pollfd **pollfds)
|
|
|
2810
2814
|
* device. This function ensures transfers get cancelled appropriately.
|
|
2811
2815
|
* Callers of this function must hold the events_lock.
|
|
2812
2816
|
*/
|
|
2813
|
-
void usbi_handle_disconnect(struct libusb_device_handle *dev_handle)
|
|
2817
|
+
void usbi_handle_disconnect(struct libusb_context *ctx, struct libusb_device_handle *dev_handle)
|
|
2814
2818
|
{
|
|
2815
|
-
struct libusb_context *ctx = HANDLE_CTX(dev_handle);
|
|
2816
2819
|
struct usbi_transfer *cur;
|
|
2817
2820
|
struct usbi_transfer *to_cancel;
|
|
2818
2821
|
|
|
@@ -2852,9 +2855,11 @@ void usbi_handle_disconnect(struct libusb_device_handle *dev_handle)
|
|
|
2852
2855
|
if (!to_cancel)
|
|
2853
2856
|
break;
|
|
2854
2857
|
|
|
2858
|
+
#ifdef ENABLE_LOGGING
|
|
2855
2859
|
struct libusb_transfer *transfer_to_cancel = USBI_TRANSFER_TO_LIBUSB_TRANSFER(to_cancel);
|
|
2856
2860
|
usbi_dbg(ctx, "cancelling transfer %p from disconnect",
|
|
2857
2861
|
(void *) transfer_to_cancel);
|
|
2862
|
+
#endif
|
|
2858
2863
|
|
|
2859
2864
|
usbi_mutex_lock(&to_cancel->lock);
|
|
2860
2865
|
usbi_backend.clear_transfer_priv(to_cancel);
|
|
@@ -24,6 +24,10 @@ EXPORTS
|
|
|
24
24
|
libusb_dev_mem_alloc@8 = libusb_dev_mem_alloc
|
|
25
25
|
libusb_dev_mem_free
|
|
26
26
|
libusb_dev_mem_free@12 = libusb_dev_mem_free
|
|
27
|
+
libusb_endpoint_set_raw_io
|
|
28
|
+
libusb_endpoint_set_raw_io@12 = libusb_endpoint_set_raw_io
|
|
29
|
+
libusb_endpoint_supports_raw_io
|
|
30
|
+
libusb_endpoint_supports_raw_io@8 = libusb_endpoint_supports_raw_io
|
|
27
31
|
libusb_error_name
|
|
28
32
|
libusb_error_name@4 = libusb_error_name
|
|
29
33
|
libusb_event_handler_active
|
|
@@ -50,6 +54,8 @@ EXPORTS
|
|
|
50
54
|
libusb_free_ss_endpoint_companion_descriptor@4 = libusb_free_ss_endpoint_companion_descriptor
|
|
51
55
|
libusb_free_ss_usb_device_capability_descriptor
|
|
52
56
|
libusb_free_ss_usb_device_capability_descriptor@4 = libusb_free_ss_usb_device_capability_descriptor
|
|
57
|
+
libusb_free_ssplus_usb_device_capability_descriptor
|
|
58
|
+
libusb_free_ssplus_usb_device_capability_descriptor@4 = libusb_free_ssplus_usb_device_capability_descriptor
|
|
53
59
|
libusb_free_streams
|
|
54
60
|
libusb_free_streams@12 = libusb_free_streams
|
|
55
61
|
libusb_free_transfer
|
|
@@ -82,6 +88,8 @@ EXPORTS
|
|
|
82
88
|
libusb_get_device_list@8 = libusb_get_device_list
|
|
83
89
|
libusb_get_device_speed
|
|
84
90
|
libusb_get_device_speed@4 = libusb_get_device_speed
|
|
91
|
+
libusb_get_device_string
|
|
92
|
+
libusb_get_device_string@16 = libusb_get_device_string
|
|
85
93
|
libusb_get_interface_association_descriptors
|
|
86
94
|
libusb_get_interface_association_descriptors@12 = libusb_get_interface_association_descriptors
|
|
87
95
|
libusb_get_max_alt_packet_size
|
|
@@ -90,6 +98,8 @@ EXPORTS
|
|
|
90
98
|
libusb_get_max_iso_packet_size@8 = libusb_get_max_iso_packet_size
|
|
91
99
|
libusb_get_max_packet_size
|
|
92
100
|
libusb_get_max_packet_size@8 = libusb_get_max_packet_size
|
|
101
|
+
libusb_get_max_raw_io_transfer_size
|
|
102
|
+
libusb_get_max_raw_io_transfer_size@8 = libusb_get_max_raw_io_transfer_size
|
|
93
103
|
libusb_get_next_timeout
|
|
94
104
|
libusb_get_next_timeout@8 = libusb_get_next_timeout
|
|
95
105
|
libusb_get_parent
|
|
@@ -104,10 +114,14 @@ EXPORTS
|
|
|
104
114
|
libusb_get_port_numbers@12 = libusb_get_port_numbers
|
|
105
115
|
libusb_get_port_path
|
|
106
116
|
libusb_get_port_path@16 = libusb_get_port_path
|
|
117
|
+
libusb_get_session_data
|
|
118
|
+
libusb_get_session_data@4 = libusb_get_session_data
|
|
107
119
|
libusb_get_ss_endpoint_companion_descriptor
|
|
108
120
|
libusb_get_ss_endpoint_companion_descriptor@12 = libusb_get_ss_endpoint_companion_descriptor
|
|
109
121
|
libusb_get_ss_usb_device_capability_descriptor
|
|
110
122
|
libusb_get_ss_usb_device_capability_descriptor@12 = libusb_get_ss_usb_device_capability_descriptor
|
|
123
|
+
libusb_get_ssplus_usb_device_capability_descriptor
|
|
124
|
+
libusb_get_ssplus_usb_device_capability_descriptor@12 = libusb_get_ssplus_usb_device_capability_descriptor
|
|
111
125
|
libusb_get_string_descriptor_ascii
|
|
112
126
|
libusb_get_string_descriptor_ascii@16 = libusb_get_string_descriptor_ascii
|
|
113
127
|
libusb_get_usb_2_0_extension_descriptor
|
package/libusb/libusb/libusb.h
CHANGED
|
@@ -65,9 +65,6 @@ typedef SSIZE_T ssize_t;
|
|
|
65
65
|
#if defined(interface)
|
|
66
66
|
#undef interface
|
|
67
67
|
#endif
|
|
68
|
-
#if !defined(__CYGWIN__)
|
|
69
|
-
#include <winsock.h>
|
|
70
|
-
#endif
|
|
71
68
|
#endif /* _WIN32 || __CYGWIN__ */
|
|
72
69
|
|
|
73
70
|
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
|
|
@@ -166,9 +163,12 @@ typedef SSIZE_T ssize_t;
|
|
|
166
163
|
* <li>libusb version 1.0.25: LIBUSB_API_VERSION = 0x01000109
|
|
167
164
|
* <li>libusb version 1.0.26: LIBUSB_API_VERSION = 0x01000109
|
|
168
165
|
* <li>libusb version 1.0.27: LIBUSB_API_VERSION = 0x0100010A
|
|
166
|
+
* <li>libusb version 1.0.28: LIBUSB_API_VERSION = 0x0100010A
|
|
167
|
+
* <li>libusb version 1.0.29: LIBUSB_API_VERSION = 0x0100010B
|
|
168
|
+
* <li>libusb version 1.0.30: LIBUSB_API_VERSION = 0x0100010C
|
|
169
169
|
* </ul>
|
|
170
170
|
*/
|
|
171
|
-
#define LIBUSB_API_VERSION
|
|
171
|
+
#define LIBUSB_API_VERSION 0x0100010C
|
|
172
172
|
|
|
173
173
|
/** \def LIBUSBX_API_VERSION
|
|
174
174
|
* \ingroup libusb_misc
|
|
@@ -190,7 +190,7 @@ extern "C" {
|
|
|
190
190
|
* \param x the host-endian value to convert
|
|
191
191
|
* \returns the value in little-endian byte order
|
|
192
192
|
*/
|
|
193
|
-
static inline uint16_t libusb_cpu_to_le16(
|
|
193
|
+
static inline uint16_t libusb_cpu_to_le16(uint16_t x)
|
|
194
194
|
{
|
|
195
195
|
union {
|
|
196
196
|
uint8_t b8[2];
|
|
@@ -262,6 +262,24 @@ enum libusb_class_code {
|
|
|
262
262
|
/** Personal Healthcare */
|
|
263
263
|
LIBUSB_CLASS_PERSONAL_HEALTHCARE = 0x0f,
|
|
264
264
|
|
|
265
|
+
/** Audio & Video */
|
|
266
|
+
LIBUSB_CLASS_AUDIO_VIDEO = 0x10,
|
|
267
|
+
|
|
268
|
+
/** Billboard */
|
|
269
|
+
LIBUSB_CLASS_BILLBOARD = 0x11,
|
|
270
|
+
|
|
271
|
+
/** Interface class */
|
|
272
|
+
LIBUSB_CLASS_TYPE_C_BRIDGE = 0x12,
|
|
273
|
+
|
|
274
|
+
/** Bulk display */
|
|
275
|
+
LIBUSB_CLASS_BULK_DISPLAY_PROTOCOL = 0x13,
|
|
276
|
+
|
|
277
|
+
/** MCTP */
|
|
278
|
+
LIBUSB_CLASS_MCTP = 0x14,
|
|
279
|
+
|
|
280
|
+
/** I3C */
|
|
281
|
+
LIBUSB_CLASS_I3C = 0x3c,
|
|
282
|
+
|
|
265
283
|
/** Diagnostic Device */
|
|
266
284
|
LIBUSB_CLASS_DIAGNOSTIC_DEVICE = 0xdc,
|
|
267
285
|
|
|
@@ -335,10 +353,12 @@ enum libusb_descriptor_type {
|
|
|
335
353
|
#define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6
|
|
336
354
|
#define LIBUSB_DT_BOS_SIZE 5
|
|
337
355
|
#define LIBUSB_DT_DEVICE_CAPABILITY_SIZE 3
|
|
356
|
+
#define LIBUSB_DT_INTERFACE_ASSOCIATION_SIZE 8
|
|
338
357
|
|
|
339
358
|
/* BOS descriptor sizes */
|
|
340
359
|
#define LIBUSB_BT_USB_2_0_EXTENSION_SIZE 7
|
|
341
360
|
#define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10
|
|
361
|
+
#define LIBUSB_BT_SSPLUS_USB_DEVICE_CAPABILITY_SIZE 12
|
|
342
362
|
#define LIBUSB_BT_CONTAINER_ID_SIZE 20
|
|
343
363
|
#define LIBUSB_BT_PLATFORM_DESCRIPTOR_MIN_SIZE 20
|
|
344
364
|
|
|
@@ -562,7 +582,10 @@ enum libusb_bos_type {
|
|
|
562
582
|
LIBUSB_BT_CONTAINER_ID = 0x04,
|
|
563
583
|
|
|
564
584
|
/** Platform descriptor */
|
|
565
|
-
LIBUSB_BT_PLATFORM_DESCRIPTOR = 0x05
|
|
585
|
+
LIBUSB_BT_PLATFORM_DESCRIPTOR = 0x05,
|
|
586
|
+
|
|
587
|
+
/** SuperSpeedPlus device capability */
|
|
588
|
+
LIBUSB_BT_SUPERSPEED_PLUS_CAPABILITY = 0x0A,
|
|
566
589
|
};
|
|
567
590
|
|
|
568
591
|
/** \ingroup libusb_desc
|
|
@@ -927,7 +950,7 @@ struct libusb_usb_2_0_extension_descriptor {
|
|
|
927
950
|
uint8_t bDescriptorType;
|
|
928
951
|
|
|
929
952
|
/** Capability type. Will have value
|
|
930
|
-
* \ref
|
|
953
|
+
* \ref libusb_bos_type::LIBUSB_BT_USB_2_0_EXTENSION
|
|
931
954
|
* LIBUSB_BT_USB_2_0_EXTENSION in this context. */
|
|
932
955
|
uint8_t bDevCapabilityType;
|
|
933
956
|
|
|
@@ -953,7 +976,7 @@ struct libusb_ss_usb_device_capability_descriptor {
|
|
|
953
976
|
uint8_t bDescriptorType;
|
|
954
977
|
|
|
955
978
|
/** Capability type. Will have value
|
|
956
|
-
* \ref
|
|
979
|
+
* \ref libusb_bos_type::LIBUSB_BT_SS_USB_DEVICE_CAPABILITY
|
|
957
980
|
* LIBUSB_BT_SS_USB_DEVICE_CAPABILITY in this context. */
|
|
958
981
|
uint8_t bDevCapabilityType;
|
|
959
982
|
|
|
@@ -980,6 +1003,100 @@ struct libusb_ss_usb_device_capability_descriptor {
|
|
|
980
1003
|
uint16_t bU2DevExitLat;
|
|
981
1004
|
};
|
|
982
1005
|
|
|
1006
|
+
/** \ingroup libusb_desc
|
|
1007
|
+
* enum used in \ref libusb_ssplus_sublink_attribute
|
|
1008
|
+
*/
|
|
1009
|
+
enum libusb_superspeedplus_sublink_attribute_sublink_type {
|
|
1010
|
+
LIBUSB_SSPLUS_ATTR_TYPE_SYM = 0,
|
|
1011
|
+
LIBUSB_SSPLUS_ATTR_TYPE_ASYM = 1,
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
/** \ingroup libusb_desc
|
|
1015
|
+
* enum used in \ref libusb_ssplus_sublink_attribute
|
|
1016
|
+
*/
|
|
1017
|
+
enum libusb_superspeedplus_sublink_attribute_sublink_direction {
|
|
1018
|
+
LIBUSB_SSPLUS_ATTR_DIR_RX = 0,
|
|
1019
|
+
LIBUSB_SSPLUS_ATTR_DIR_TX = 1,
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
/** \ingroup libusb_desc
|
|
1023
|
+
* enum used in \ref libusb_ssplus_sublink_attribute
|
|
1024
|
+
* Bit = Bits per second
|
|
1025
|
+
* Kb = Kbps
|
|
1026
|
+
* Mb = Mbps
|
|
1027
|
+
* Gb = Gbps
|
|
1028
|
+
*/
|
|
1029
|
+
enum libusb_superspeedplus_sublink_attribute_exponent {
|
|
1030
|
+
LIBUSB_SSPLUS_ATTR_EXP_BPS = 0,
|
|
1031
|
+
LIBUSB_SSPLUS_ATTR_EXP_KBS = 1,
|
|
1032
|
+
LIBUSB_SSPLUS_ATTR_EXP_MBS = 2,
|
|
1033
|
+
LIBUSB_SSPLUS_ATTR_EXP_GBS = 3,
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
/** \ingroup libusb_desc
|
|
1037
|
+
* enum used in \ref libusb_ssplus_sublink_attribute
|
|
1038
|
+
*/
|
|
1039
|
+
enum libusb_superspeedplus_sublink_attribute_link_protocol {
|
|
1040
|
+
LIBUSB_SSPLUS_ATTR_PROT_SS = 0,
|
|
1041
|
+
LIBUSB_SSPLUS_ATTR_PROT_SSPLUS = 1,
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1044
|
+
/** \ingroup libusb_desc
|
|
1045
|
+
* Expose \ref libusb_ssplus_usb_device_capability_descriptor.sublinkSpeedAttributes
|
|
1046
|
+
*/
|
|
1047
|
+
struct libusb_ssplus_sublink_attribute {
|
|
1048
|
+
/** Sublink Speed Attribute ID (SSID).
|
|
1049
|
+
This field is an ID that uniquely identifies the speed of this sublink */
|
|
1050
|
+
uint8_t ssid;
|
|
1051
|
+
|
|
1052
|
+
/** This field defines the
|
|
1053
|
+
base 10 exponent times 3, that shall be applied to the
|
|
1054
|
+
mantissa. */
|
|
1055
|
+
enum libusb_superspeedplus_sublink_attribute_exponent exponent;
|
|
1056
|
+
|
|
1057
|
+
/** This field identifies whether the
|
|
1058
|
+
Sublink Speed Attribute defines a symmetric or
|
|
1059
|
+
asymmetric bit rate.*/
|
|
1060
|
+
enum libusb_superspeedplus_sublink_attribute_sublink_type type;
|
|
1061
|
+
|
|
1062
|
+
/** This field indicates if this
|
|
1063
|
+
Sublink Speed Attribute defines the receive or
|
|
1064
|
+
transmit bit rate. */
|
|
1065
|
+
enum libusb_superspeedplus_sublink_attribute_sublink_direction direction;
|
|
1066
|
+
|
|
1067
|
+
/** This field identifies the protocol
|
|
1068
|
+
supported by the link. */
|
|
1069
|
+
enum libusb_superspeedplus_sublink_attribute_link_protocol protocol;
|
|
1070
|
+
|
|
1071
|
+
/** This field defines the mantissa that shall be applied to the exponent when
|
|
1072
|
+
calculating the maximum bit rate. */
|
|
1073
|
+
uint16_t mantissa;
|
|
1074
|
+
};
|
|
1075
|
+
|
|
1076
|
+
/** \ingroup libusb_desc
|
|
1077
|
+
* A structure representing the SuperSpeedPlus descriptor
|
|
1078
|
+
* This descriptor is documented in section 9.6.2.5 of the USB 3.1 specification.
|
|
1079
|
+
*/
|
|
1080
|
+
struct libusb_ssplus_usb_device_capability_descriptor {
|
|
1081
|
+
/** Sublink Speed Attribute Count */
|
|
1082
|
+
uint8_t numSublinkSpeedAttributes;
|
|
1083
|
+
|
|
1084
|
+
/** Sublink Speed ID Count */
|
|
1085
|
+
uint8_t numSublinkSpeedIDs;
|
|
1086
|
+
|
|
1087
|
+
/** Unique ID to indicates the minimum lane speed */
|
|
1088
|
+
uint8_t ssid;
|
|
1089
|
+
|
|
1090
|
+
/** This field indicates the minimum receive lane count.*/
|
|
1091
|
+
uint8_t minRxLaneCount;
|
|
1092
|
+
|
|
1093
|
+
/** This field indicates the minimum transmit lane count*/
|
|
1094
|
+
uint8_t minTxLaneCount;
|
|
1095
|
+
|
|
1096
|
+
/** Array size is \ref libusb_ssplus_usb_device_capability_descriptor.numSublinkSpeedAttributes */
|
|
1097
|
+
struct libusb_ssplus_sublink_attribute sublinkSpeedAttributes[];
|
|
1098
|
+
};
|
|
1099
|
+
|
|
983
1100
|
/** \ingroup libusb_desc
|
|
984
1101
|
* A structure representing the Container ID descriptor.
|
|
985
1102
|
* This descriptor is documented in section 9.6.2.3 of the USB 3.0 specification.
|
|
@@ -995,7 +1112,7 @@ struct libusb_container_id_descriptor {
|
|
|
995
1112
|
uint8_t bDescriptorType;
|
|
996
1113
|
|
|
997
1114
|
/** Capability type. Will have value
|
|
998
|
-
* \ref
|
|
1115
|
+
* \ref libusb_bos_type::LIBUSB_BT_CONTAINER_ID
|
|
999
1116
|
* LIBUSB_BT_CONTAINER_ID in this context. */
|
|
1000
1117
|
uint8_t bDevCapabilityType;
|
|
1001
1118
|
|
|
@@ -1020,7 +1137,7 @@ struct libusb_platform_descriptor {
|
|
|
1020
1137
|
uint8_t bDescriptorType;
|
|
1021
1138
|
|
|
1022
1139
|
/** Capability type. Will have value
|
|
1023
|
-
* \ref
|
|
1140
|
+
* \ref libusb_bos_type::LIBUSB_BT_PLATFORM_DESCRIPTOR
|
|
1024
1141
|
* LIBUSB_BT_CONTAINER_ID in this context. */
|
|
1025
1142
|
uint8_t bDevCapabilityType;
|
|
1026
1143
|
|
|
@@ -1081,16 +1198,16 @@ struct libusb_device_handle;
|
|
|
1081
1198
|
*/
|
|
1082
1199
|
struct libusb_version {
|
|
1083
1200
|
/** Library major version. */
|
|
1084
|
-
|
|
1201
|
+
uint16_t major;
|
|
1085
1202
|
|
|
1086
1203
|
/** Library minor version. */
|
|
1087
|
-
|
|
1204
|
+
uint16_t minor;
|
|
1088
1205
|
|
|
1089
1206
|
/** Library micro version. */
|
|
1090
|
-
|
|
1207
|
+
uint16_t micro;
|
|
1091
1208
|
|
|
1092
1209
|
/** Library nano version. */
|
|
1093
|
-
|
|
1210
|
+
uint16_t nano;
|
|
1094
1211
|
|
|
1095
1212
|
/** Library release candidate suffix string, e.g. "-rc4". */
|
|
1096
1213
|
const char *rc;
|
|
@@ -1167,7 +1284,10 @@ enum libusb_speed {
|
|
|
1167
1284
|
LIBUSB_SPEED_SUPER = 4,
|
|
1168
1285
|
|
|
1169
1286
|
/** The device is operating at super speed plus (10000MBit/s). */
|
|
1170
|
-
LIBUSB_SPEED_SUPER_PLUS = 5
|
|
1287
|
+
LIBUSB_SPEED_SUPER_PLUS = 5,
|
|
1288
|
+
|
|
1289
|
+
/** The device is operating at super speed plus x2 (20000MBit/s). */
|
|
1290
|
+
LIBUSB_SPEED_SUPER_PLUS_X2 = 6,
|
|
1171
1291
|
};
|
|
1172
1292
|
|
|
1173
1293
|
/** \ingroup libusb_misc
|
|
@@ -1545,6 +1665,29 @@ enum libusb_option {
|
|
|
1545
1665
|
LIBUSB_OPTION_MAX = 4
|
|
1546
1666
|
};
|
|
1547
1667
|
|
|
1668
|
+
/** \ingroup libusb_desc
|
|
1669
|
+
* The device string type.
|
|
1670
|
+
*/
|
|
1671
|
+
enum libusb_device_string_type {
|
|
1672
|
+
LIBUSB_DEVICE_STRING_MANUFACTURER,
|
|
1673
|
+
LIBUSB_DEVICE_STRING_PRODUCT,
|
|
1674
|
+
LIBUSB_DEVICE_STRING_SERIAL_NUMBER,
|
|
1675
|
+
LIBUSB_DEVICE_STRING_COUNT /* The total number of string types. */
|
|
1676
|
+
};
|
|
1677
|
+
|
|
1678
|
+
/** \ingroup libusb_desc
|
|
1679
|
+
* The maximum length for a device string descriptor in UTF-8.
|
|
1680
|
+
*
|
|
1681
|
+
* 255 max descriptor length with 2 byte header
|
|
1682
|
+
* => 253 bytes UTF-16LE, no null termination (USB 2.0 9.6.7)
|
|
1683
|
+
* => 126.5 codepoints
|
|
1684
|
+
* => 127 * 3 + 1
|
|
1685
|
+
* => 382 bytes
|
|
1686
|
+
*
|
|
1687
|
+
* Stay with 256 * 3/2 = 384 to be safe.
|
|
1688
|
+
*/
|
|
1689
|
+
#define LIBUSB_DEVICE_STRING_BYTES_MAX (384U)
|
|
1690
|
+
|
|
1548
1691
|
/** \ingroup libusb_lib
|
|
1549
1692
|
* Callback function for handling log messages.
|
|
1550
1693
|
* \param ctx the context which is related to the log message, or NULL if it
|
|
@@ -1581,7 +1724,7 @@ void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
|
|
|
1581
1724
|
void LIBUSB_CALL libusb_set_log_cb(libusb_context *ctx, libusb_log_cb cb, int mode);
|
|
1582
1725
|
const struct libusb_version * LIBUSB_CALL libusb_get_version(void);
|
|
1583
1726
|
int LIBUSB_CALL libusb_has_capability(uint32_t capability);
|
|
1584
|
-
const char * LIBUSB_CALL libusb_error_name(int
|
|
1727
|
+
const char * LIBUSB_CALL libusb_error_name(int error_code);
|
|
1585
1728
|
int LIBUSB_CALL libusb_setlocale(const char *locale);
|
|
1586
1729
|
const char * LIBUSB_CALL libusb_strerror(int errcode);
|
|
1587
1730
|
|
|
@@ -1592,6 +1735,8 @@ void LIBUSB_CALL libusb_free_device_list(libusb_device **list,
|
|
|
1592
1735
|
libusb_device * LIBUSB_CALL libusb_ref_device(libusb_device *dev);
|
|
1593
1736
|
void LIBUSB_CALL libusb_unref_device(libusb_device *dev);
|
|
1594
1737
|
|
|
1738
|
+
int LIBUSB_CALL libusb_get_device_string(libusb_device *dev,
|
|
1739
|
+
enum libusb_device_string_type string_type, char *data, int length);
|
|
1595
1740
|
int LIBUSB_CALL libusb_get_configuration(libusb_device_handle *dev,
|
|
1596
1741
|
int *config);
|
|
1597
1742
|
int LIBUSB_CALL libusb_get_device_descriptor(libusb_device *dev,
|
|
@@ -1625,6 +1770,12 @@ int LIBUSB_CALL libusb_get_ss_usb_device_capability_descriptor(
|
|
|
1625
1770
|
struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap);
|
|
1626
1771
|
void LIBUSB_CALL libusb_free_ss_usb_device_capability_descriptor(
|
|
1627
1772
|
struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap);
|
|
1773
|
+
int LIBUSB_CALL libusb_get_ssplus_usb_device_capability_descriptor(
|
|
1774
|
+
libusb_context *ctx,
|
|
1775
|
+
struct libusb_bos_dev_capability_descriptor *dev_cap,
|
|
1776
|
+
struct libusb_ssplus_usb_device_capability_descriptor **ssplus_usb_device_cap);
|
|
1777
|
+
void LIBUSB_CALL libusb_free_ssplus_usb_device_capability_descriptor(
|
|
1778
|
+
struct libusb_ssplus_usb_device_capability_descriptor *ssplus_usb_device_cap);
|
|
1628
1779
|
int LIBUSB_CALL libusb_get_container_id_descriptor(libusb_context *ctx,
|
|
1629
1780
|
struct libusb_bos_dev_capability_descriptor *dev_cap,
|
|
1630
1781
|
struct libusb_container_id_descriptor **container_id);
|
|
@@ -1635,6 +1786,7 @@ int LIBUSB_CALL libusb_get_platform_descriptor(libusb_context *ctx,
|
|
|
1635
1786
|
struct libusb_platform_descriptor **platform_descriptor);
|
|
1636
1787
|
void LIBUSB_CALL libusb_free_platform_descriptor(
|
|
1637
1788
|
struct libusb_platform_descriptor *platform_descriptor);
|
|
1789
|
+
unsigned long LIBUSB_CALL libusb_get_session_data(libusb_device *dev);
|
|
1638
1790
|
uint8_t LIBUSB_CALL libusb_get_bus_number(libusb_device *dev);
|
|
1639
1791
|
uint8_t LIBUSB_CALL libusb_get_port_number(libusb_device *dev);
|
|
1640
1792
|
int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t *port_numbers, int port_numbers_len);
|
|
@@ -1697,6 +1849,14 @@ int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev_handle,
|
|
|
1697
1849
|
int LIBUSB_CALL libusb_set_auto_detach_kernel_driver(
|
|
1698
1850
|
libusb_device_handle *dev_handle, int enable);
|
|
1699
1851
|
|
|
1852
|
+
int LIBUSB_CALL libusb_endpoint_supports_raw_io(libusb_device_handle* dev_handle,
|
|
1853
|
+
uint8_t endpoint);
|
|
1854
|
+
int LIBUSB_CALL libusb_endpoint_set_raw_io(libusb_device_handle *dev_handle,
|
|
1855
|
+
uint8_t endpoint, int enable);
|
|
1856
|
+
int LIBUSB_CALL libusb_get_max_raw_io_transfer_size(
|
|
1857
|
+
libusb_device_handle *dev_handle,
|
|
1858
|
+
uint8_t endpoint);
|
|
1859
|
+
|
|
1700
1860
|
/* async I/O */
|
|
1701
1861
|
|
|
1702
1862
|
/** \ingroup libusb_asyncio
|
|
@@ -2035,16 +2195,16 @@ static inline unsigned char *libusb_get_iso_packet_buffer_simple(
|
|
|
2035
2195
|
/* sync I/O */
|
|
2036
2196
|
|
|
2037
2197
|
int LIBUSB_CALL libusb_control_transfer(libusb_device_handle *dev_handle,
|
|
2038
|
-
uint8_t
|
|
2198
|
+
uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
|
|
2039
2199
|
unsigned char *data, uint16_t wLength, unsigned int timeout);
|
|
2040
2200
|
|
|
2041
2201
|
int LIBUSB_CALL libusb_bulk_transfer(libusb_device_handle *dev_handle,
|
|
2042
2202
|
unsigned char endpoint, unsigned char *data, int length,
|
|
2043
|
-
int *
|
|
2203
|
+
int *transferred, unsigned int timeout);
|
|
2044
2204
|
|
|
2045
2205
|
int LIBUSB_CALL libusb_interrupt_transfer(libusb_device_handle *dev_handle,
|
|
2046
2206
|
unsigned char endpoint, unsigned char *data, int length,
|
|
2047
|
-
int *
|
|
2207
|
+
int *transferred, unsigned int timeout);
|
|
2048
2208
|
|
|
2049
2209
|
/** \ingroup libusb_desc
|
|
2050
2210
|
* Retrieve a descriptor from the default control pipe.
|