aboutsummaryrefslogtreecommitdiffstats
path: root/devel
diff options
context:
space:
mode:
authorpav <pav@FreeBSD.org>2008-11-14 17:52:21 +0800
committerpav <pav@FreeBSD.org>2008-11-14 17:52:21 +0800
commita1af8379f1a10a5ae00efdd4996ac7f65a12ed71 (patch)
treee57fcbf0c8b78ad6deaa9b8dc567a0826fdb0684 /devel
parenta5eccfe97ccf357d61952b8f79ae4cdcef8d5f1d (diff)
downloadfreebsd-ports-gnome-a1af8379f1a10a5ae00efdd4996ac7f65a12ed71.tar.gz
freebsd-ports-gnome-a1af8379f1a10a5ae00efdd4996ac7f65a12ed71.tar.zst
freebsd-ports-gnome-a1af8379f1a10a5ae00efdd4996ac7f65a12ed71.zip
- Fix a runtime failure. While usb_control_msg is supposed to return the
actual number of bytes received, the FreeBSD version returns the receiving buffer size instead. Applications inspecting the returned length for error checking will fail. My patch is based on this excerpt from FreeBSDs /usr/src/sys/dev/usb/usb.h. PR: ports/128549 Submitted by: ladan (maintainer)
Diffstat (limited to 'devel')
-rw-r--r--devel/libusb/Makefile2
-rw-r--r--devel/libusb/files/patch-bsd.c25
2 files changed, 18 insertions, 9 deletions
diff --git a/devel/libusb/Makefile b/devel/libusb/Makefile
index d0c743f281a8..aaa32b2fc07d 100644
--- a/devel/libusb/Makefile
+++ b/devel/libusb/Makefile
@@ -7,7 +7,7 @@
PORTNAME= libusb
PORTVERSION= 0.1.12
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
diff --git a/devel/libusb/files/patch-bsd.c b/devel/libusb/files/patch-bsd.c
index 7acf9679e81c..5a4c24f33cb3 100644
--- a/devel/libusb/files/patch-bsd.c
+++ b/devel/libusb/files/patch-bsd.c
@@ -1,14 +1,23 @@
---- bsd.c.orig Sun Jul 30 11:18:07 2006
-+++ bsd.c Sun Jul 30 11:20:30 2006
+--- bsd.c.orig 2006-03-04 03:52:46.000000000 +0100
++++ bsd.c 2008-11-03 00:08:15.000000000 +0100
@@ -408,7 +408,7 @@
/* Ensure the endpoint address is correct */
ep |= USB_ENDPOINT_IN;
-
+
- fd = ensure_ep_open(dev, ep, O_RDONLY);
+ fd = ensure_ep_open(dev, ep, O_RDONLY | O_NONBLOCK);
if (fd < 0) {
- if (usb_debug >= 2) {
- #ifdef __FreeBSD_kernel__
+ if (usb_debug >= 2) {
+ #ifdef __FreeBSD_kernel__
+@@ -477,7 +477,7 @@
+ USB_ERROR_STR(-errno, "error sending control message: %s",
+ strerror(errno));
+
+- return UGETW(req.ucr_request.wLength);
++ return req.ucr_actlen;
+ }
+
+ int usb_os_find_busses(struct usb_bus **busses)
@@ -623,9 +623,21 @@
int usb_clear_halt(usb_dev_handle *dev, unsigned int ep)
@@ -16,8 +25,7 @@
- /* Not yet done, because I haven't needed it. */
+ int ret;
+ struct usb_ctl_request ctl_req;
-
-- USB_ERROR_STR(-ENOSYS, "usb_clear_halt called, unimplemented on BSD");
++
+ ctl_req.ucr_addr = 0; // Not used for this type of request
+ ctl_req.ucr_request.bmRequestType = UT_WRITE_ENDPOINT;
+ ctl_req.ucr_request.bRequest = UR_CLEAR_FEATURE;
@@ -28,7 +36,8 @@
+
+ if ((ret = ioctl(dev->fd, USB_DO_REQUEST, &ctl_req)) < 0)
+ USB_ERROR_STR(-errno, "clear_halt: failed for %d", ep);
-+
+
+- USB_ERROR_STR(-ENOSYS, "usb_clear_halt called, unimplemented on BSD");
+ return ret;
}