mirror of
https://github.com/libusb/libusb
synced 2024-11-21 14:29:12 -07:00
Add API support for LIBUSB_SPEED_SUPER_PLUS_X2 20Gbps USB 3.2 gen 2x2
Implement detection on darwin and linux_usbfs, and report it in xusb. Closes #1477
This commit is contained in:
parent
f00f06e9eb
commit
5b17c383f8
7 changed files with 20 additions and 5 deletions
|
@ -210,6 +210,7 @@ static void print_device(libusb_device *dev, libusb_device_handle *handle)
|
|||
case LIBUSB_SPEED_HIGH: speed = "480M"; break;
|
||||
case LIBUSB_SPEED_SUPER: speed = "5G"; break;
|
||||
case LIBUSB_SPEED_SUPER_PLUS: speed = "10G"; break;
|
||||
case LIBUSB_SPEED_SUPER_PLUS_X2: speed = "20G"; break;
|
||||
default: speed = "Unknown";
|
||||
}
|
||||
|
||||
|
|
|
@ -174,6 +174,7 @@ static void print_device(libusb_device *dev, libusb_device_handle *handle)
|
|||
case LIBUSB_SPEED_HIGH: speed = "480M"; break;
|
||||
case LIBUSB_SPEED_SUPER: speed = "5G"; break;
|
||||
case LIBUSB_SPEED_SUPER_PLUS: speed = "10G"; break;
|
||||
case LIBUSB_SPEED_SUPER_PLUS_X2: speed = "20G"; break;
|
||||
default: speed = "Unknown";
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
// in libusb_config_descriptor => catter for that
|
||||
#define usb_interface interface
|
||||
|
||||
#ifndef ARRAYSIZE
|
||||
#define ARRAYSIZE(array) (sizeof(array) / sizeof(array[0]))
|
||||
#endif
|
||||
|
||||
// Global variables
|
||||
static bool binary_dump = false;
|
||||
static bool extra_info = false;
|
||||
|
@ -856,8 +860,9 @@ static int test_device(uint16_t vid, uint16_t pid)
|
|||
int i, j, k, r;
|
||||
int iface, nb_ifaces, first_iface = -1;
|
||||
struct libusb_device_descriptor dev_desc;
|
||||
const char* const speed_name[6] = { "Unknown", "1.5 Mbit/s (USB LowSpeed)", "12 Mbit/s (USB FullSpeed)",
|
||||
"480 Mbit/s (USB HighSpeed)", "5000 Mbit/s (USB SuperSpeed)", "10000 Mbit/s (USB SuperSpeedPlus)" };
|
||||
const char* const speed_name[] = { "Unknown", "1.5 Mbit/s (USB LowSpeed)", "12 Mbit/s (USB FullSpeed)",
|
||||
"480 Mbit/s (USB HighSpeed)", "5000 Mbit/s (USB SuperSpeed)", "10000 Mbit/s (USB SuperSpeedPlus)",
|
||||
"20000 Mbit/s (USB SuperSpeedPlus x2)" };
|
||||
unsigned char string[128];
|
||||
uint8_t string_index[3]; // indexes of the string descriptors
|
||||
uint8_t endpoint_in = 0, endpoint_out = 0; // default IN and OUT endpoints
|
||||
|
@ -884,7 +889,8 @@ static int test_device(uint16_t vid, uint16_t pid)
|
|||
printf(" (from root hub)\n");
|
||||
}
|
||||
r = libusb_get_device_speed(dev);
|
||||
if ((r<0) || (r>5)) r=0;
|
||||
if ((r < 0) || ((size_t)r >= ARRAYSIZE(speed_name)))
|
||||
r = 0;
|
||||
printf(" speed: %s\n", speed_name[r]);
|
||||
}
|
||||
|
||||
|
|
|
@ -1265,7 +1265,10 @@ enum libusb_speed {
|
|||
LIBUSB_SPEED_SUPER = 4,
|
||||
|
||||
/** The device is operating at super speed plus (10000MBit/s). */
|
||||
LIBUSB_SPEED_SUPER_PLUS = 5
|
||||
LIBUSB_SPEED_SUPER_PLUS = 5,
|
||||
|
||||
/** The device is operating at super speed plus x2 (20000MBit/s). */
|
||||
LIBUSB_SPEED_SUPER_PLUS_X2 = 6,
|
||||
};
|
||||
|
||||
/** \ingroup libusb_misc
|
||||
|
|
|
@ -1437,6 +1437,9 @@ static enum libusb_error process_new_device (struct libusb_context *ctx, struct
|
|||
#endif
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
|
||||
case kUSBDeviceSpeedSuperPlus: dev->speed = LIBUSB_SPEED_SUPER_PLUS; break;
|
||||
#endif
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500
|
||||
case kUSBDeviceSpeedSuperPlusBy2: dev->speed = LIBUSB_SPEED_SUPER_PLUS_X2; break;
|
||||
#endif
|
||||
default:
|
||||
usbi_warn (ctx, "Got unknown device speed %d", devSpeed);
|
||||
|
|
|
@ -933,6 +933,7 @@ static int initialize_device(struct libusb_device *dev, uint8_t busnum,
|
|||
case 480: dev->speed = LIBUSB_SPEED_HIGH; break;
|
||||
case 5000: dev->speed = LIBUSB_SPEED_SUPER; break;
|
||||
case 10000: dev->speed = LIBUSB_SPEED_SUPER_PLUS; break;
|
||||
case 20000: dev->speed = LIBUSB_SPEED_SUPER_PLUS_X2; break;
|
||||
default:
|
||||
usbi_warn(ctx, "unknown device speed: %d Mbps", speed);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define LIBUSB_NANO 11897
|
||||
#define LIBUSB_NANO 11898
|
||||
|
|
Loading…
Reference in a new issue