openbsd-ports/devel/libusb/patches/patch-bsd_c

63 lines
2.0 KiB
Plaintext

--- bsd.c.orig Tue Feb 17 23:34:52 2004
+++ bsd.c Fri May 20 22:35:57 2005
@@ -357,7 +357,7 @@ int usb_bulk_read(usb_dev_handle *dev, i
int usb_interrupt_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;
@@ -379,8 +379,7 @@ int usb_interrupt_write(usb_dev_handle *
USB_ERROR_STR(-errno, "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(-errno, "error writing to interrupt endpoint %s.%d: %s",
@@ -390,16 +389,13 @@ int usb_interrupt_write(usb_dev_handle *
dev->device->filename, UE_GET_ADDR(ep), strerror(errno));
#endif
- sent += ret;
- } while (ret > 0 && sent < size);
-
- return sent;
+ return ret;
}
int usb_interrupt_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;
@@ -424,8 +420,7 @@ int usb_interrupt_read(usb_dev_handle *d
if (ret < 0)
USB_ERROR_STR(-errno, "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(-errno, "error reading from interrupt endpoint %s.%d: %s",
@@ -434,10 +429,7 @@ int usb_interrupt_read(usb_dev_handle *d
USB_ERROR_STR(-errno, "error reading from interrupt 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,