Summary: | bug in *BSD port of devel/libusb, with fix | ||||||
---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Andreas Klemm <andreas> | ||||
Component: | Individual Port(s) | Assignee: | freebsd-ports-bugs (Nobody) <ports-bugs> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Only Me | ||||||
Priority: | Normal | ||||||
Version: | Latest | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
Description
Andreas Klemm
2003-11-04 16:20:24 UTC
i can confirm that the fix is working. i was having probelms using a HP Photosmart camera with the PTP driver, was receiving timeouts... been searching for a fix for 2 weeks, when Mariusz Woloszyn told me that they found this bug... after editing by hand the libusb sources, and recompiling, everything worked ok, without any other software update or smtg else... i did not notice any other problems since than, other than little synchronization problems when stressing the camera/USB by turning it off, then back on quickly and running gphoto2 --auto-detect in the same time on a 400MHz (old!) machine... but i think this is not at all related to the patch, which is working fine. i'd recommend patching the current port of libusb so that this problem is fixed and posting a note or smtg about this, as i've seen at least a dozen people having posted related problems in various forums, from Germany to Australia... maybe a notice on the gPhoto homepage would be a good idea, if there's any need i can write a short description/how-to on this thema, publish it on my page and somebody can put a link to it there... anyway, thanks to all the people working on this! and if i should write the how-to (only if there's interest in linking from the gPhoto2-page to it), just mail me and let me know... if not, it's futile work in my opinion, and i shall not do it... i could write a fairly complete tutorial on using ur digital camera through the PTP driver on FreeBSD, with all the probs i got into, and the fixes i found... there are some things which need a bit of time/experience to get a camera working here... THIS mail went to: Andreas Klemm Mariusz Woloszyn Freebsd-gnats-submit Freebsd Libusb port maintainer gphoto2 devel maillist -- ANdrei R. Software Developer Cronon AG Regensburg / Germany ------------------------------------[ http://www.goanga.com ]--- _ _ o' \.=./ `o The only people who find what they're looking (o o) for in life are the ones looking for mistakes. --ooO--(_)--Ooo------------------------------------------------- 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." State Changed From-To: open->closed applied fix from Mariusz Woloszyn <emsi@ipartners.pl> has been tested under -current and -stable |