diff options
author | Pav Lucistnik <pav@FreeBSD.org> | 2008-11-14 09:52:21 +0000 |
---|---|---|
committer | Pav Lucistnik <pav@FreeBSD.org> | 2008-11-14 09:52:21 +0000 |
commit | 87caa7a6afd53ffb40409fbe932879cb27b41637 (patch) | |
tree | a32dc65ffb3900bace8cfbf33a6514bdd3a8467d /devel/libusb/files | |
parent | 48755bd36c2b55cb37a03b7f517fe1f9669bdd1e (diff) | |
download | ports-87caa7a6afd53ffb40409fbe932879cb27b41637.tar.gz ports-87caa7a6afd53ffb40409fbe932879cb27b41637.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)
Notes
Notes:
svn path=/head/; revision=222826
Diffstat (limited to 'devel/libusb/files')
-rw-r--r-- | devel/libusb/files/patch-bsd.c | 25 |
1 files changed, 17 insertions, 8 deletions
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; } |