mirror of
https://git.freebsd.org/ports.git
synced 2025-07-17 17:29:23 -04:00
- fix for PR 58925
solves problem of hanging usb sessions with cams using gphoto2 ptp2 driver - bumped port revision - tested by different people under -current and -stable, no ill side effects and really cures the problem. The author of bsd.c clearly states out in the sources, that he has ported codee from linux 1:1 and he "kind of hopes" that it is ok. But it wasn't. This patch fixes hang that happens after the 1st read because the USB driver tries to read more bytes than are available. 0000 10 00 00 00 01 00 02 10-00 00 00 00 01 00 00 00 ................ 1.240828 gphoto2-port(2): Reading 512=0x200 bytes from port... gp_port_read: Operation timed out 9.267455 PTP2/library.c(2): PTP: gp_port_* function returned 0xffffffde -34 9.267819 context(0): PTP I/O error PR: 58925 Submitted by: Mariusz Woloszyn <emsi@ipartners.pl> Reviewed by: John Reynolds <johnjen@reynoldsnet.org> and some tester Approved by: portmgr@ (Joe Marcus Clarke <marcus@marcuscom.com>)
This commit is contained in:
parent
d1868e9f76
commit
00dcb052a3
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=94786
2 changed files with 63 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
PORTNAME= libusb
|
||||
PORTVERSION= 0.1.7
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= devel
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
|
||||
MASTER_SITE_SUBDIR= ${PORTNAME}
|
||||
|
|
62
devel/libusb/files/patch-bsd.c
Normal file
62
devel/libusb/files/patch-bsd.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
--- bsd.c.orig Mon Nov 11 19:04:16 2002
|
||||
+++ bsd.c Sun Nov 23 15:51:49 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,
|
Loading…
Add table
Reference in a new issue