Date: Sat, 22 Nov 2003 12:00:40 -0800 (PST) From: John Reynolds <johnjen@reynoldsnet.org> To: freebsd-ports-bugs@FreeBSD.org Subject: Re: ports/58925: bug in *BSD port of devel/libusb, with fix Message-ID: <200311222000.hAMK0eRZ099077@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/58925; it has been noted by GNATS. From: John Reynolds <johnjen@reynoldsnet.org> To: freebsd-gnats-submit@FreeBSD.org Cc: Andreas Klemm <andreas@FreeBSD.org> Subject: Re: ports/58925: bug in *BSD port of devel/libusb, with fix Date: Sat, 22 Nov 2003 12:58:50 -0700 Well, I've received only good news related to this patch on the unofficially rolled libusb-0.1.7_1 port that I distributed (with a call for testers). I think it's OK to patch this and I will work with the libusb code t get the patch into the actual package at some point. Somebody with the commit-bit in Ports, please apply the following patch to libusb. Note that it will create files/patch-usb.c which needs to be "cvs add"'ed. -Jr diff -urN libusb.orig/Makefile libusb/Makefile --- libusb.orig/Makefile Tue Nov 18 22:29:36 2003 +++ libusb/Makefile Tue Nov 18 22:30:05 2003 @@ -7,6 +7,7 @@ PORTNAME= libusb PORTVERSION= 0.1.7 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ${PORTNAME} diff -urN libusb.orig/files/patch-bsd.c libusb/files/patch-bsd.c --- libusb.orig/files/patch-bsd.c Wed Dec 31 17:00:00 1969 +++ libusb/files/patch-bsd.c Tue Nov 18 22:32:25 2003 @@ -0,0 +1,62 @@ +--- bsd.c Tue Nov 4 12:23:39 2003 ++++ bsd-new.c Tue Nov 4 12:23:21 2003 +@@ -276,7 +276,7 @@ + int usb_bulk_write(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout) + { +- int fd, ret, sent = 0; ++ int fd, ret; + + /* Ensure the endpoint address is correct */ + ep &= ~USB_ENDPOINT_IN; +@@ -298,8 +298,7 @@ + USB_ERROR_STR(ret, "error setting timeout: %s", + strerror(errno)); + +- do { +- ret = write(fd, bytes+sent, size-sent); ++ ret = write(fd, bytes, size); + if (ret < 0) + #if __FreeBSD__ + USB_ERROR_STR(ret, "error writing to bulk endpoint %s.%d: %s", +@@ -309,16 +308,13 @@ + dev->device->filename, UE_GET_ADDR(ep), strerror(errno)); + #endif + +- sent += ret; +- } while(ret > 0 && sent < size); +- +- return sent; ++ return ret; + } + + 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, one = 1; + + /* Ensure the endpoint address is correct */ + ep |= USB_ENDPOINT_IN; +@@ -345,8 +341,7 @@ + USB_ERROR_STR(ret, "error setting short xfer: %s", + strerror(errno)); + +- do { +- ret = read(fd, bytes+retrieved, size-retrieved); ++ ret = read(fd, bytes, size); + if (ret < 0) + #if __FreeBSD__ + USB_ERROR_STR(ret, "error reading from bulk endpoint %s.%d: %s", +@@ -355,10 +350,8 @@ + USB_ERROR_STR(ret, "error reading from bulk endpoint %s.%02d: %s", + dev->device->filename, UE_GET_ADDR(ep), strerror(errno)); + #endif +- retrieved += ret; +- } while (ret > 0 && retrieved < size); + +- return retrieved; ++ return ret; + } + + int usb_control_msg(usb_dev_handle *dev, int requesttype, int request, -- John & Jennifer Reynolds johnjen at reynoldsnet.org www.reynoldsnet.org Structural / Physical Design - ICG/PNG SCD jreynold at sedona.ch.intel.com Running FreeBSD since 2.1.5-RELEASE. FreeBSD: The Power to Serve! "Unix is user friendly, it's just particular about the friends it chooses."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311222000.hAMK0eRZ099077>