usb 2.2.0 → 2.3.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 +7 -0
- package/README.md +16 -2
- package/dist/usb/index.js +7 -16
- package/dist/usb/index.js.map +1 -1
- package/libusb/.private/ci-container-build.sh +70 -0
- package/libusb/AUTHORS +10 -0
- package/libusb/ChangeLog +13 -0
- package/libusb/android/examples/unrooted_android.c +3 -4
- package/libusb/appveyor.yml +4 -0
- package/libusb/configure.ac +14 -1
- package/libusb/libusb/Makefile.am +1 -1
- package/libusb/libusb/core.c +17 -5
- package/libusb/libusb/hotplug.c +3 -0
- package/libusb/libusb/io.c +32 -8
- package/libusb/libusb/libusb.h +7 -0
- package/libusb/libusb/libusbi.h +22 -4
- package/libusb/libusb/os/darwin_usb.c +77 -20
- package/libusb/libusb/os/linux_usbfs.c +1 -1
- package/libusb/libusb/os/windows_common.c +14 -3
- package/libusb/libusb/os/windows_common.h +2 -1
- package/libusb/libusb/os/windows_winusb.c +30 -3
- package/libusb/libusb/version.h +1 -1
- package/libusb/libusb/version_nano.h +1 -1
- package/libusb/tests/Makefile.am +12 -1
- package/libusb/tests/umockdev.c +1175 -0
- package/package.json +1 -1
- 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-ia32/node.napi.node +0 -0
- package/prebuilds/win32-x64/node.napi.node +0 -0
- package/tsc/usb/index.ts +5 -8
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
|
|
44
44
|
/* Default timeout to 10s for reenumerate. This is needed because USBDeviceReEnumerate
|
|
45
45
|
* does not return error status on macOS. */
|
|
46
|
-
#define DARWIN_REENUMERATE_TIMEOUT_US
|
|
46
|
+
#define DARWIN_REENUMERATE_TIMEOUT_US (10 * USEC_PER_SEC)
|
|
47
47
|
|
|
48
48
|
#include <AvailabilityMacros.h>
|
|
49
49
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 && MAC_OS_X_VERSION_MIN_REQUIRED < 101200
|
|
@@ -86,6 +86,7 @@ static int darwin_release_interface(struct libusb_device_handle *dev_handle, uin
|
|
|
86
86
|
static int darwin_reenumerate_device(struct libusb_device_handle *dev_handle, bool capture);
|
|
87
87
|
static int darwin_clear_halt(struct libusb_device_handle *dev_handle, unsigned char endpoint);
|
|
88
88
|
static int darwin_reset_device(struct libusb_device_handle *dev_handle);
|
|
89
|
+
static int darwin_detach_kernel_driver (struct libusb_device_handle *dev_handle, uint8_t interface);
|
|
89
90
|
static void darwin_async_io_callback (void *refcon, IOReturn result, void *arg0);
|
|
90
91
|
|
|
91
92
|
static enum libusb_error darwin_scan_devices(struct libusb_context *ctx);
|
|
@@ -493,6 +494,7 @@ static void *darwin_event_thread_main (void *arg0) {
|
|
|
493
494
|
io_iterator_t libusb_rem_device_iterator;
|
|
494
495
|
io_iterator_t libusb_add_device_iterator;
|
|
495
496
|
|
|
497
|
+
/* ctx must only be used for logging during thread startup */
|
|
496
498
|
usbi_dbg (ctx, "creating hotplug event source");
|
|
497
499
|
|
|
498
500
|
runloop = CFRunLoopGetCurrent ();
|
|
@@ -514,7 +516,7 @@ static void *darwin_event_thread_main (void *arg0) {
|
|
|
514
516
|
kresult = IOServiceAddMatchingNotification (libusb_notification_port, kIOTerminatedNotification,
|
|
515
517
|
IOServiceMatching(darwin_device_class),
|
|
516
518
|
darwin_devices_detached,
|
|
517
|
-
|
|
519
|
+
NULL, &libusb_rem_device_iterator);
|
|
518
520
|
|
|
519
521
|
if (kresult != kIOReturnSuccess) {
|
|
520
522
|
usbi_err (ctx, "could not add hotplug event source: %s", darwin_error_str (kresult));
|
|
@@ -527,7 +529,7 @@ static void *darwin_event_thread_main (void *arg0) {
|
|
|
527
529
|
kresult = IOServiceAddMatchingNotification(libusb_notification_port, kIOFirstMatchNotification,
|
|
528
530
|
IOServiceMatching(darwin_device_class),
|
|
529
531
|
darwin_devices_attached,
|
|
530
|
-
|
|
532
|
+
NULL, &libusb_add_device_iterator);
|
|
531
533
|
|
|
532
534
|
if (kresult != kIOReturnSuccess) {
|
|
533
535
|
usbi_err (ctx, "could not add hotplug event source: %s", darwin_error_str (kresult));
|
|
@@ -552,7 +554,7 @@ static void *darwin_event_thread_main (void *arg0) {
|
|
|
552
554
|
/* run the runloop */
|
|
553
555
|
CFRunLoopRun();
|
|
554
556
|
|
|
555
|
-
usbi_dbg (
|
|
557
|
+
usbi_dbg (NULL, "darwin event thread exiting");
|
|
556
558
|
|
|
557
559
|
/* signal the main thread that the hotplug runloop has finished. */
|
|
558
560
|
pthread_mutex_lock (&libusb_darwin_at_mutex);
|
|
@@ -1389,12 +1391,16 @@ static enum libusb_error get_endpoints (struct libusb_device_handle *dev_handle,
|
|
|
1389
1391
|
|
|
1390
1392
|
/* current interface */
|
|
1391
1393
|
struct darwin_interface *cInterface = &priv->interfaces[iface];
|
|
1394
|
+
#if InterfaceVersion >= 550
|
|
1395
|
+
IOUSBEndpointProperties pipeProperties = {.bVersion = kUSBEndpointPropertiesVersion3};
|
|
1396
|
+
#else
|
|
1397
|
+
UInt8 dont_care1, dont_care3;
|
|
1398
|
+
UInt16 dont_care2;
|
|
1399
|
+
#endif
|
|
1392
1400
|
|
|
1393
1401
|
IOReturn kresult;
|
|
1394
1402
|
|
|
1395
1403
|
UInt8 numep, direction, number;
|
|
1396
|
-
UInt8 dont_care1, dont_care3;
|
|
1397
|
-
UInt16 dont_care2;
|
|
1398
1404
|
int rc;
|
|
1399
1405
|
struct libusb_context *ctx = HANDLE_CTX (dev_handle);
|
|
1400
1406
|
|
|
@@ -1410,9 +1416,14 @@ static enum libusb_error get_endpoints (struct libusb_device_handle *dev_handle,
|
|
|
1410
1416
|
|
|
1411
1417
|
/* iterate through pipe references */
|
|
1412
1418
|
for (UInt8 i = 1 ; i <= numep ; i++) {
|
|
1419
|
+
#if InterfaceVersion >= 550
|
|
1420
|
+
kresult = (*(cInterface->interface))->GetPipePropertiesV3 (cInterface->interface, i, &pipeProperties);
|
|
1421
|
+
number = pipeProperties.bEndpointNumber;
|
|
1422
|
+
direction = pipeProperties.bDirection;
|
|
1423
|
+
#else
|
|
1413
1424
|
kresult = (*(cInterface->interface))->GetPipeProperties(cInterface->interface, i, &direction, &number, &dont_care1,
|
|
1414
1425
|
&dont_care2, &dont_care3);
|
|
1415
|
-
|
|
1426
|
+
#endif
|
|
1416
1427
|
if (kresult != kIOReturnSuccess) {
|
|
1417
1428
|
/* probably a buggy device. try to get the endpoint address from the descriptors */
|
|
1418
1429
|
struct libusb_config_descriptor *config;
|
|
@@ -1430,6 +1441,10 @@ static enum libusb_error get_endpoints (struct libusb_device_handle *dev_handle,
|
|
|
1430
1441
|
return rc;
|
|
1431
1442
|
}
|
|
1432
1443
|
|
|
1444
|
+
if (iface >= config->bNumInterfaces) {
|
|
1445
|
+
usbi_err (HANDLE_CTX (dev_handle), "interface %d out of range for device", iface);
|
|
1446
|
+
return LIBUSB_ERROR_NOT_FOUND;
|
|
1447
|
+
}
|
|
1433
1448
|
endpoint_desc = config->interface[iface].altsetting[alt_setting].endpoint + i - 1;
|
|
1434
1449
|
|
|
1435
1450
|
cInterface->endpoint_addrs[i - 1] = endpoint_desc->bEndpointAddress;
|
|
@@ -1801,17 +1816,18 @@ static int darwin_reenumerate_device (struct libusb_device_handle *dev_handle, b
|
|
|
1801
1816
|
usbi_dbg (ctx, "darwin/reenumerate_device: waiting for re-enumeration to complete...");
|
|
1802
1817
|
|
|
1803
1818
|
struct timespec start;
|
|
1804
|
-
|
|
1819
|
+
usbi_get_monotonic_time(&start);
|
|
1805
1820
|
|
|
1806
1821
|
while (dpriv->in_reenumerate) {
|
|
1807
1822
|
struct timespec delay = {.tv_sec = 0, .tv_nsec = 1000};
|
|
1808
1823
|
nanosleep (&delay, NULL);
|
|
1809
1824
|
|
|
1810
1825
|
struct timespec now;
|
|
1811
|
-
|
|
1812
|
-
|
|
1826
|
+
usbi_get_monotonic_time(&now);
|
|
1827
|
+
unsigned long elapsed_us = (now.tv_sec - start.tv_sec) * USEC_PER_SEC +
|
|
1828
|
+
(now.tv_nsec - start.tv_nsec) / 1000;
|
|
1813
1829
|
|
|
1814
|
-
if (
|
|
1830
|
+
if (elapsed_us >= DARWIN_REENUMERATE_TIMEOUT_US) {
|
|
1815
1831
|
usbi_err (ctx, "darwin/reenumerate_device: timeout waiting for reenumerate");
|
|
1816
1832
|
dpriv->in_reenumerate = false;
|
|
1817
1833
|
return LIBUSB_ERROR_TIMEOUT;
|
|
@@ -1843,14 +1859,40 @@ static int darwin_reenumerate_device (struct libusb_device_handle *dev_handle, b
|
|
|
1843
1859
|
static int darwin_reset_device (struct libusb_device_handle *dev_handle) {
|
|
1844
1860
|
struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
|
|
1845
1861
|
IOReturn kresult;
|
|
1862
|
+
enum libusb_error ret;
|
|
1846
1863
|
|
|
1864
|
+
#if !defined(TARGET_OS_OSX) || TARGET_OS_OSX == 1
|
|
1847
1865
|
if (dpriv->capture_count > 0) {
|
|
1848
1866
|
/* we have to use ResetDevice as USBDeviceReEnumerate() loses the authorization for capture */
|
|
1849
1867
|
kresult = (*(dpriv->device))->ResetDevice (dpriv->device);
|
|
1850
|
-
|
|
1868
|
+
ret = darwin_to_libusb (kresult);
|
|
1851
1869
|
} else {
|
|
1852
|
-
|
|
1870
|
+
ret = darwin_reenumerate_device (dev_handle, false);
|
|
1871
|
+
}
|
|
1872
|
+
#else
|
|
1873
|
+
/* ResetDevice() is missing on non-macOS platforms */
|
|
1874
|
+
ret = darwin_reenumerate_device (dev_handle, false);
|
|
1875
|
+
if ((ret == LIBUSB_SUCCESS || ret == LIBUSB_ERROR_NOT_FOUND) && dpriv->capture_count > 0) {
|
|
1876
|
+
int capture_count;
|
|
1877
|
+
int8_t active_config = dpriv->active_config;
|
|
1878
|
+
unsigned long claimed_interfaces = dev_handle->claimed_interfaces;
|
|
1879
|
+
|
|
1880
|
+
/* save old capture_count */
|
|
1881
|
+
capture_count = dpriv->capture_count;
|
|
1882
|
+
/* reset capture count */
|
|
1883
|
+
dpriv->capture_count = 0;
|
|
1884
|
+
/* attempt to detach kernel driver again as it is now re-attached */
|
|
1885
|
+
ret = darwin_detach_kernel_driver (dev_handle, 0);
|
|
1886
|
+
if (ret != LIBUSB_SUCCESS) {
|
|
1887
|
+
return ret;
|
|
1888
|
+
}
|
|
1889
|
+
/* restore capture_count */
|
|
1890
|
+
dpriv->capture_count = capture_count;
|
|
1891
|
+
/* restore configuration */
|
|
1892
|
+
ret = darwin_restore_state (dev_handle, active_config, claimed_interfaces);
|
|
1853
1893
|
}
|
|
1894
|
+
#endif
|
|
1895
|
+
return ret;
|
|
1854
1896
|
}
|
|
1855
1897
|
|
|
1856
1898
|
static io_service_t usb_find_interface_matching_location (const io_name_t class_name, UInt8 interface_number, UInt32 location) {
|
|
@@ -2019,11 +2061,17 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer) {
|
|
|
2019
2061
|
struct darwin_transfer_priv *tpriv = usbi_get_transfer_priv(itransfer);
|
|
2020
2062
|
|
|
2021
2063
|
IOReturn kresult;
|
|
2022
|
-
uint8_t
|
|
2023
|
-
uint16_t maxPacketSize;
|
|
2064
|
+
uint8_t pipeRef, interval;
|
|
2024
2065
|
UInt64 frame;
|
|
2025
2066
|
AbsoluteTime atTime;
|
|
2026
2067
|
int i;
|
|
2068
|
+
#if InterfaceVersion >= 550
|
|
2069
|
+
IOUSBEndpointProperties pipeProperties = {.bVersion = kUSBEndpointPropertiesVersion3};
|
|
2070
|
+
#else
|
|
2071
|
+
/* None of the values below are used in libusb for iso transfers */
|
|
2072
|
+
uint8_t direction, number, transferType;
|
|
2073
|
+
uint16_t maxPacketSize;
|
|
2074
|
+
#endif
|
|
2027
2075
|
|
|
2028
2076
|
struct darwin_interface *cInterface;
|
|
2029
2077
|
|
|
@@ -2055,8 +2103,20 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer) {
|
|
|
2055
2103
|
}
|
|
2056
2104
|
|
|
2057
2105
|
/* determine the properties of this endpoint and the speed of the device */
|
|
2058
|
-
|
|
2106
|
+
#if InterfaceVersion >= 550
|
|
2107
|
+
kresult = (*(cInterface->interface))->GetPipePropertiesV3 (cInterface->interface, pipeRef, &pipeProperties);
|
|
2108
|
+
interval = pipeProperties.bInterval;
|
|
2109
|
+
#else
|
|
2110
|
+
kresult = (*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
|
|
2059
2111
|
&transferType, &maxPacketSize, &interval);
|
|
2112
|
+
#endif
|
|
2113
|
+
if (kresult != kIOReturnSuccess) {
|
|
2114
|
+
usbi_err (TRANSFER_CTX (transfer), "failed to get pipe properties: %d", kresult);
|
|
2115
|
+
free(tpriv->isoc_framelist);
|
|
2116
|
+
tpriv->isoc_framelist = NULL;
|
|
2117
|
+
|
|
2118
|
+
return darwin_to_libusb (kresult);
|
|
2119
|
+
}
|
|
2060
2120
|
|
|
2061
2121
|
/* Last but not least we need the bus frame number */
|
|
2062
2122
|
kresult = (*(cInterface->interface))->GetBusFrameNumber(cInterface->interface, &frame, &atTime);
|
|
@@ -2068,9 +2128,6 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer) {
|
|
|
2068
2128
|
return darwin_to_libusb (kresult);
|
|
2069
2129
|
}
|
|
2070
2130
|
|
|
2071
|
-
(*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
|
|
2072
|
-
&transferType, &maxPacketSize, &interval);
|
|
2073
|
-
|
|
2074
2131
|
/* schedule for a frame a little in the future */
|
|
2075
2132
|
frame += 4;
|
|
2076
2133
|
|
|
@@ -2417,7 +2474,7 @@ static int darwin_free_streams (struct libusb_device_handle *dev_handle, unsigne
|
|
|
2417
2474
|
|
|
2418
2475
|
/* macOS APIs for getting entitlement values */
|
|
2419
2476
|
|
|
2420
|
-
#if TARGET_OS_OSX
|
|
2477
|
+
#if !defined(TARGET_OS_OSX) || TARGET_OS_OSX == 1
|
|
2421
2478
|
#include <Security/Security.h>
|
|
2422
2479
|
#else
|
|
2423
2480
|
typedef struct __SecTask *SecTaskRef;
|
|
@@ -1429,7 +1429,7 @@ static int op_get_configuration(struct libusb_device_handle *handle,
|
|
|
1429
1429
|
uint8_t *config)
|
|
1430
1430
|
{
|
|
1431
1431
|
struct linux_device_priv *priv = usbi_get_device_priv(handle->dev);
|
|
1432
|
-
int active_config;
|
|
1432
|
+
int active_config = -1; /* to please compiler */
|
|
1433
1433
|
int r;
|
|
1434
1434
|
|
|
1435
1435
|
if (priv->sysfs_dir) {
|
|
@@ -346,6 +346,8 @@ static enum windows_version get_windows_version(void)
|
|
|
346
346
|
if ((vi.dwMajorVersion > 6) || ((vi.dwMajorVersion == 6) && (vi.dwMinorVersion >= 2))) {
|
|
347
347
|
// Starting with Windows 8.1 Preview, GetVersionEx() does no longer report the actual OS version
|
|
348
348
|
// See: http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx
|
|
349
|
+
// And starting with Windows 10 Preview 2, Windows enforces the use of the application/supportedOS
|
|
350
|
+
// manifest in order for VerSetConditionMask() to report the ACTUAL OS major and minor...
|
|
349
351
|
|
|
350
352
|
major_equal = VerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL);
|
|
351
353
|
for (major = vi.dwMajorVersion; major <= 9; major++) {
|
|
@@ -381,6 +383,7 @@ static enum windows_version get_windows_version(void)
|
|
|
381
383
|
|
|
382
384
|
ws = (vi.wProductType <= VER_NT_WORKSTATION);
|
|
383
385
|
version = vi.dwMajorVersion << 4 | vi.dwMinorVersion;
|
|
386
|
+
|
|
384
387
|
switch (version) {
|
|
385
388
|
case 0x50: winver = WINDOWS_2000; w = "2000"; break;
|
|
386
389
|
case 0x51: winver = WINDOWS_XP; w = "XP"; break;
|
|
@@ -390,14 +393,22 @@ static enum windows_version get_windows_version(void)
|
|
|
390
393
|
case 0x62: winver = WINDOWS_8; w = (ws ? "8" : "2012"); break;
|
|
391
394
|
case 0x63: winver = WINDOWS_8_1; w = (ws ? "8.1" : "2012_R2"); break;
|
|
392
395
|
case 0x64: // Early Windows 10 Insider Previews and Windows Server 2017 Technical Preview 1 used version 6.4
|
|
393
|
-
case 0xA0: winver = WINDOWS_10; w = (ws ? "10" : "2016");
|
|
396
|
+
case 0xA0: winver = WINDOWS_10; w = (ws ? "10" : "2016");
|
|
397
|
+
if (vi.dwBuildNumber < 20000)
|
|
398
|
+
break;
|
|
399
|
+
// fallthrough
|
|
400
|
+
case 0xB0: winver = WINDOWS_11; w = (ws ? "11" : "2022"); break;
|
|
394
401
|
default:
|
|
395
402
|
if (version < 0x50)
|
|
396
403
|
return WINDOWS_UNDEFINED;
|
|
397
|
-
winver =
|
|
398
|
-
w = "
|
|
404
|
+
winver = WINDOWS_12_OR_LATER;
|
|
405
|
+
w = "12 or later";
|
|
399
406
|
}
|
|
400
407
|
|
|
408
|
+
// We cannot tell if we are on 8, 10, or 11 without "app manifest"
|
|
409
|
+
if (version == 0x62 && vi.dwBuildNumber == 9200)
|
|
410
|
+
w = "8 (or later)";
|
|
411
|
+
|
|
401
412
|
arch = is_x64() ? "64-bit" : "32-bit";
|
|
402
413
|
|
|
403
414
|
if (vi.wServicePackMinor)
|
|
@@ -523,6 +523,10 @@ static int windows_assign_endpoints(struct libusb_device_handle *dev_handle, uin
|
|
|
523
523
|
return r;
|
|
524
524
|
}
|
|
525
525
|
|
|
526
|
+
if (iface >= conf_desc->bNumInterfaces) {
|
|
527
|
+
usbi_err(HANDLE_CTX(dev_handle), "interface %d out of range for device", iface);
|
|
528
|
+
return LIBUSB_ERROR_NOT_FOUND;
|
|
529
|
+
}
|
|
526
530
|
if_desc = &conf_desc->interface[iface].altsetting[altsetting];
|
|
527
531
|
safe_free(priv->usb_interface[iface].endpoint);
|
|
528
532
|
|
|
@@ -2986,7 +2990,11 @@ static int winusbx_submit_iso_transfer(int sub_api, struct usbi_transfer *itrans
|
|
|
2986
2990
|
// WinUSB only supports isoch transfers spanning a full USB frames. Later, we might be smarter about this
|
|
2987
2991
|
// and allocate a temporary buffer. However, this is harder than it seems as its destruction would depend on overlapped
|
|
2988
2992
|
// IO...
|
|
2989
|
-
|
|
2993
|
+
if (transfer->dev_handle->dev->speed >= LIBUSB_SPEED_HIGH) // Microframes (125us)
|
|
2994
|
+
iso_transfer_size_multiple = (pipe_info_ex.MaximumBytesPerInterval * 8) / interval;
|
|
2995
|
+
else // Normal Frames (1ms)
|
|
2996
|
+
iso_transfer_size_multiple = pipe_info_ex.MaximumBytesPerInterval / interval;
|
|
2997
|
+
|
|
2990
2998
|
if (transfer->length % iso_transfer_size_multiple != 0) {
|
|
2991
2999
|
usbi_err(TRANSFER_CTX(transfer), "length of isoch buffer must be a multiple of the MaximumBytesPerInterval * 8 / Interval");
|
|
2992
3000
|
return LIBUSB_ERROR_INVALID_PARAM;
|
|
@@ -3225,12 +3233,25 @@ static enum libusb_transfer_status winusbx_copy_transfer_data(int sub_api, struc
|
|
|
3225
3233
|
int i;
|
|
3226
3234
|
|
|
3227
3235
|
if (transfer->type == LIBUSB_TRANSFER_TYPE_ISOCHRONOUS) {
|
|
3236
|
+
struct winusb_device_priv *priv = usbi_get_device_priv(transfer->dev_handle->dev);
|
|
3237
|
+
|
|
3238
|
+
if (sub_api == SUB_API_NOTSET)
|
|
3239
|
+
sub_api = priv->sub_api;
|
|
3240
|
+
if (WinUSBX[sub_api].hDll == NULL)
|
|
3241
|
+
return LIBUSB_TRANSFER_ERROR;
|
|
3242
|
+
|
|
3228
3243
|
// for isochronous, need to copy the individual iso packet actual_lengths and statuses
|
|
3229
3244
|
if ((sub_api == SUB_API_LIBUSBK) || (sub_api == SUB_API_LIBUSB0)) {
|
|
3230
3245
|
// iso only supported on libusbk-based backends for now
|
|
3231
3246
|
PKISO_CONTEXT iso_context = transfer_priv->iso_context;
|
|
3232
3247
|
for (i = 0; i < transfer->num_iso_packets; i++) {
|
|
3233
|
-
transfer
|
|
3248
|
+
if (IS_XFERIN(transfer)) {
|
|
3249
|
+
transfer->iso_packet_desc[i].actual_length = iso_context->IsoPackets[i].actual_length;
|
|
3250
|
+
} else {
|
|
3251
|
+
// On Windows the usbd Length field is not used for OUT transfers.
|
|
3252
|
+
// Copy the requested value back for consistency with other platforms.
|
|
3253
|
+
transfer->iso_packet_desc[i].actual_length = transfer->iso_packet_desc[i].length;
|
|
3254
|
+
}
|
|
3234
3255
|
// TODO translate USDB_STATUS codes http://msdn.microsoft.com/en-us/library/ff539136(VS.85).aspx to libusb_transfer_status
|
|
3235
3256
|
//transfer->iso_packet_desc[i].status = transfer_priv->iso_context->IsoPackets[i].status;
|
|
3236
3257
|
}
|
|
@@ -3251,6 +3272,9 @@ static enum libusb_transfer_status winusbx_copy_transfer_data(int sub_api, struc
|
|
|
3251
3272
|
} else {
|
|
3252
3273
|
for (i = 0; i < transfer->num_iso_packets; i++) {
|
|
3253
3274
|
transfer->iso_packet_desc[i].status = LIBUSB_TRANSFER_COMPLETED;
|
|
3275
|
+
// On Windows the usbd Length field is not used for OUT transfers.
|
|
3276
|
+
// Copy the requested value back for consistency with other platforms.
|
|
3277
|
+
transfer->iso_packet_desc[i].actual_length = transfer->iso_packet_desc[i].length;
|
|
3254
3278
|
}
|
|
3255
3279
|
}
|
|
3256
3280
|
} else {
|
|
@@ -3860,7 +3884,10 @@ static int hid_open(int sub_api, struct libusb_device_handle *dev_handle)
|
|
|
3860
3884
|
|
|
3861
3885
|
priv->hid->string_index[1] = dev->device_descriptor.iProduct;
|
|
3862
3886
|
if (priv->hid->string_index[1] != 0)
|
|
3863
|
-
HidD_GetProductString(
|
|
3887
|
+
// Using HidD_GetIndexedString() instead of HidD_GetProductString(), as the latter would otherwise return the name
|
|
3888
|
+
// of the interface instead of the iProduct string whenever the iInterface member of the USB_INTERFACE_DESCRIPTOR
|
|
3889
|
+
// structure for the interface is nonzero (see Remarks section in the documentation of the HID API routines)
|
|
3890
|
+
HidD_GetIndexedString(hid_handle, priv->hid->string_index[1], priv->hid->string[1], sizeof(priv->hid->string[1]));
|
|
3864
3891
|
else
|
|
3865
3892
|
priv->hid->string[1][0] = 0;
|
|
3866
3893
|
|
package/libusb/libusb/version.h
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
#define LIBUSB_NANO
|
|
1
|
+
#define LIBUSB_NANO 11724
|
package/libusb/tests/Makefile.am
CHANGED
|
@@ -2,6 +2,17 @@ AM_CPPFLAGS = -I$(top_srcdir)/libusb
|
|
|
2
2
|
LDADD = ../libusb/libusb-1.0.la
|
|
3
3
|
LIBS =
|
|
4
4
|
|
|
5
|
+
stress_SOURCES = stress.c libusb_testlib.h testlib.c
|
|
6
|
+
|
|
5
7
|
noinst_PROGRAMS = stress
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
if BUILD_UMOCKDEV_TEST
|
|
10
|
+
# NOTE: We add libumockdev-preload.so so that we can run tests in-process
|
|
11
|
+
# We also use -Wl,-lxxx as the compiler doesn't need it and libtool
|
|
12
|
+
# would reorder the flags otherwise.
|
|
13
|
+
umockdev_CPPFLAGS = ${UMOCKDEV_CFLAGS} -I$(top_srcdir)/libusb
|
|
14
|
+
umockdev_LDFLAGS = -Wl,--push-state,--no-as-needed -Wl,-lumockdev-preload -Wl,--pop-state ${UMOCKDEV_LIBS}
|
|
15
|
+
umockdev_SOURCES = umockdev.c
|
|
16
|
+
|
|
17
|
+
noinst_PROGRAMS += umockdev
|
|
18
|
+
endif
|