Add missing LibUSB 1.0 API function.
Reported by: lme @ MFC after: 1 week
This commit is contained in:
parent
0cc457b000
commit
748205a370
@ -48,6 +48,7 @@ MLINKS += libusb.3 libusb_get_bus_number.3
|
||||
MLINKS += libusb.3 libusb_get_device_address.3
|
||||
MLINKS += libusb.3 libusb_get_device_speed.3
|
||||
MLINKS += libusb.3 libusb_get_max_packet_size.3
|
||||
MLINKS += libusb.3 libusb_get_max_iso_packet_size.3
|
||||
MLINKS += libusb.3 libusb_ref_device.3
|
||||
MLINKS += libusb.3 libusb_unref_device.3
|
||||
MLINKS += libusb.3 libusb_open.3
|
||||
|
@ -26,7 +26,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd February 25, 2012
|
||||
.Dd April 12, 2012
|
||||
.Dt LIBUSB 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -118,6 +118,12 @@ LIBUSB_SPEED_UNKNOWN is returned in case of unknown wire speed.
|
||||
Returns the wMaxPacketSize value on success, LIBUSB_ERROR_NOT_FOUND if the
|
||||
endpoint does not exist and LIBUSB_ERROR_OTHERS on other failure.
|
||||
.Pp
|
||||
.Ft int
|
||||
.Fn libusb_get_max_iso_packet_size "libusb_device *dev" "unsigned char endpoint"
|
||||
Returns the packet size multiplied by the packet multiplier on success,
|
||||
LIBUSB_ERROR_NOT_FOUND if the endpoint does not exist and
|
||||
LIBUSB_ERROR_OTHERS on other failure.
|
||||
.Pp
|
||||
.Ft libusb_device *
|
||||
.Fn libusb_ref_device "libusb_device *dev"
|
||||
Increment the reference counter of the device
|
||||
|
@ -371,6 +371,7 @@ 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);
|
||||
int libusb_get_max_iso_packet_size(libusb_device * dev, uint8_t endpoint);
|
||||
libusb_device *libusb_ref_device(libusb_device * dev);
|
||||
void libusb_unref_device(libusb_device * dev);
|
||||
int libusb_open(libusb_device * dev, libusb_device_handle ** devh);
|
||||
|
@ -331,6 +331,30 @@ out:
|
||||
return (ret);
|
||||
}
|
||||
|
||||
int
|
||||
libusb_get_max_iso_packet_size(libusb_device *dev, uint8_t endpoint)
|
||||
{
|
||||
int multiplier;
|
||||
int ret;
|
||||
|
||||
ret = libusb_get_max_packet_size(dev, endpoint);
|
||||
|
||||
switch (libusb20_dev_get_speed(dev->os_priv)) {
|
||||
case LIBUSB20_SPEED_LOW:
|
||||
case LIBUSB20_SPEED_FULL:
|
||||
break;
|
||||
default:
|
||||
if (ret > -1) {
|
||||
multiplier = (1 + ((ret >> 11) & 3));
|
||||
if (multiplier > 3)
|
||||
multiplier = 3;
|
||||
ret = (ret & 0x7FF) * multiplier;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
||||
libusb_device *
|
||||
libusb_ref_device(libusb_device *dev)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user