summaryrefslogtreecommitdiff
path: root/devel/libusb
diff options
context:
space:
mode:
authormycroft <mycroft@pkgsrc.org>2004-06-23 08:42:57 +0000
committermycroft <mycroft@pkgsrc.org>2004-06-23 08:42:57 +0000
commitc1612355decdce986ebb6f435e2cf3745fa4518d (patch)
tree51cd619d978c0ac98eaf956c0adace9b7e3e11b3 /devel/libusb
parentab1398b36a556ca7004136895ec5a994fa76a918 (diff)
downloadpkgsrc-c1612355decdce986ebb6f435e2cf3745fa4518d.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/libusb')
-rw-r--r--devel/libusb/distinfo3
-rw-r--r--devel/libusb/patches/patch-ad32
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;
+ }