diff options
author | hselasky <hselasky@FreeBSD.org> | 2012-04-12 18:06:30 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2012-04-12 18:06:30 +0000 |
commit | 4a73b1171086162f4344312ca649185f15985512 (patch) | |
tree | 57895ee208bf599df923ae71036670675175c7eb /lib/libusb/libusb10.c | |
parent | 20ac4e4f812f8a1caca5d5d792b599580c95d8e4 (diff) | |
download | FreeBSD-src-4a73b1171086162f4344312ca649185f15985512.zip FreeBSD-src-4a73b1171086162f4344312ca649185f15985512.tar.gz |
Add missing LibUSB 1.0 API function.
Reported by: lme @
MFC after: 1 week
Diffstat (limited to 'lib/libusb/libusb10.c')
-rw-r--r-- | lib/libusb/libusb10.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c index 0be318a..02ad315 100644 --- a/lib/libusb/libusb10.c +++ b/lib/libusb/libusb10.c @@ -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) { |