Add missing function to get device speed to the LibUSB v1.0 API.
MFC after: 1 week Approved by: re (kib)
This commit is contained in:
parent
8efbf2642b
commit
9a46d4678d
@ -151,6 +151,14 @@ enum libusb_error {
|
||||
LIBUSB_ERROR_OTHER = -99,
|
||||
};
|
||||
|
||||
enum libusb_speed {
|
||||
LIBUSB_SPEED_UNKNOWN = 0,
|
||||
LIBUSB_SPEED_LOW = 1,
|
||||
LIBUSB_SPEED_FULL = 2,
|
||||
LIBUSB_SPEED_HIGH = 3,
|
||||
LIBUSB_SPEED_SUPER = 4,
|
||||
};
|
||||
|
||||
enum libusb_transfer_status {
|
||||
LIBUSB_TRANSFER_COMPLETED,
|
||||
LIBUSB_TRANSFER_ERROR,
|
||||
@ -304,6 +312,7 @@ ssize_t libusb_get_device_list(libusb_context * ctx, libusb_device *** list);
|
||||
void libusb_free_device_list(libusb_device ** list, int unref_devices);
|
||||
uint8_t libusb_get_bus_number(libusb_device * dev);
|
||||
uint8_t libusb_get_device_address(libusb_device * dev);
|
||||
enum libusb_speed libusb_get_device_speed(libusb_device * dev);
|
||||
int libusb_clear_halt(libusb_device_handle *devh, uint8_t endpoint);
|
||||
int libusb_get_max_packet_size(libusb_device * dev, uint8_t endpoint);
|
||||
libusb_device *libusb_ref_device(libusb_device * dev);
|
||||
|
@ -272,6 +272,27 @@ libusb_get_device_address(libusb_device *dev)
|
||||
return (libusb20_dev_get_address(dev->os_priv));
|
||||
}
|
||||
|
||||
enum libusb_speed
|
||||
libusb_get_device_speed(libusb_device *dev)
|
||||
{
|
||||
if (dev == NULL)
|
||||
return (0); /* should not happen */
|
||||
|
||||
switch (libusb20_dev_get_speed(dev->os_priv)) {
|
||||
case LIBUSB20_SPEED_LOW:
|
||||
return (LIBUSB_SPEED_LOW);
|
||||
case LIBUSB20_SPEED_FULL:
|
||||
return (LIBUSB_SPEED_FULL);
|
||||
case LIBUSB20_SPEED_HIGH:
|
||||
return (LIBUSB_SPEED_HIGH);
|
||||
case LIBUSB20_SPEED_SUPER:
|
||||
return (LIBUSB_SPEED_SUPER);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (LIBUSB_SPEED_UNKNOWN);
|
||||
}
|
||||
|
||||
int
|
||||
libusb_get_max_packet_size(libusb_device *dev, uint8_t endpoint)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user