diff options
author | mycroft <mycroft@pkgsrc.org> | 2004-06-23 08:42:57 +0000 |
---|---|---|
committer | mycroft <mycroft@pkgsrc.org> | 2004-06-23 08:42:57 +0000 |
commit | 39660dcfaf06a2161fc5b4d5bbd0527bf3d49541 (patch) | |
tree | 51cd619d978c0ac98eaf956c0adace9b7e3e11b3 /devel | |
parent | 74b65bdf4f82516cb1edcdd01b194b5bce7077d1 (diff) | |
download | pkgsrc-39660dcfaf06a2161fc5b4d5bbd0527bf3d49541.tar.gz |
Make usb_bulk_read() terminate short transfers correctly. This mimics the
Linux code, and is critical for making PTP work.
Diffstat (limited to 'devel')
-rw-r--r-- | devel/libusb/distinfo | 3 | ||||
-rw-r--r-- | devel/libusb/patches/patch-ad | 32 |
2 files changed, 34 insertions, 1 deletions
diff --git a/devel/libusb/distinfo b/devel/libusb/distinfo index 0b386e8a2c9..93081f0778f 100644 --- a/devel/libusb/distinfo +++ b/devel/libusb/distinfo @@ -1,6 +1,7 @@ -$NetBSD: distinfo,v 1.11 2004/05/03 08:45:44 adam Exp $ +$NetBSD: distinfo,v 1.12 2004/06/23 08:42:57 mycroft Exp $ SHA1 (libusb-0.1.8.tar.gz) = 94f3ff525a12e82ac6944a28f0bed5c765921ffd Size (libusb-0.1.8.tar.gz) = 321295 bytes SHA1 (patch-aa) = e64f2686c079c6d48eff0e3eea53a63114322644 SHA1 (patch-ac) = cc92318e0979779f6ef03ee653bc94ee2b96a055 +SHA1 (patch-ad) = ed6a27a9e68ece7505f38c8ad6ad8cf7a0513f6b diff --git a/devel/libusb/patches/patch-ad b/devel/libusb/patches/patch-ad new file mode 100644 index 00000000000..edeba91e064 --- /dev/null +++ b/devel/libusb/patches/patch-ad @@ -0,0 +1,32 @@ +$NetBSD: patch-ad,v 1.4 2004/06/23 08:42:57 mycroft Exp $ + +--- bsd.c.orig 2004-01-27 22:36:40.000000000 +0000 ++++ bsd.c 2004-06-23 08:40:16.000000000 +0000 +@@ -320,7 +320,7 @@ + int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout) + { +- int fd, ret, retrieved = 0, one = 1; ++ int fd, ret, retrieved = 0, one = 1, requested; + + /* Ensure the endpoint address is correct */ + ep |= USB_ENDPOINT_IN; +@@ -346,7 +346,8 @@ + USB_ERROR_STR(-errno, "error setting short xfer: %s", strerror(errno)); + + do { +- ret = read(fd, bytes+retrieved, size-retrieved); ++ requested = size - retrieved; ++ ret = read(fd, bytes+retrieved, requested); + if (ret < 0) + #if __FreeBSD__ + USB_ERROR_STR(-errno, "error reading from bulk endpoint %s.%d: %s", +@@ -356,7 +357,7 @@ + dev->device->filename, UE_GET_ADDR(ep), strerror(errno)); + #endif + retrieved += ret; +- } while (ret > 0 && retrieved < size); ++ } while (ret > 0 && retrieved < size && ret == requested); + + return retrieved; + } |