64 lines
2.0 KiB
Plaintext
64 lines
2.0 KiB
Plaintext
$OpenBSD: patch-bsd_c,v 1.7 2006/11/15 18:34:13 pvalchev Exp $
|
|
--- bsd.c.orig Fri Mar 3 19:52:46 2006
|
|
+++ bsd.c Tue Nov 14 21:00:00 2006
|
|
@@ -361,7 +361,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;
|
|
@@ -383,8 +383,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)
|
|
#ifdef __FreeBSD_kernel__
|
|
USB_ERROR_STR(-errno, "error writing to interrupt endpoint %s.%d: %s",
|
|
@@ -394,16 +393,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;
|
|
@@ -428,8 +424,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)
|
|
#ifdef __FreeBSD_kernel__
|
|
USB_ERROR_STR(-errno, "error reading from interrupt endpoint %s.%d: %s",
|
|
@@ -438,10 +433,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,
|