Browse Source

Why are we reading extra again in usb read when buffering is enabled? Don't do that.

nfactor-troky
Con Kolivas 11 years ago
parent
commit
ea12210032
  1. 26
      usbutils.c

26
usbutils.c

@ -2542,15 +2542,10 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
max = ((double)timeout) / 1000.0; max = ((double)timeout) / 1000.0;
cgtime(&read_start); cgtime(&read_start);
while (bufleft > 0) { while (bufleft > 0) {
// TODO: use (USB_MAX_READ - tot) always? if (ftdi)
if (usbdev->buffer) usbbufread = bufleft + 2;
usbbufread = USB_MAX_READ - tot; else
else { usbbufread = bufleft;
if (ftdi)
usbbufread = bufleft + 2;
else
usbbufread = bufleft;
}
got = 0; got = 0;
err = usb_bulk_transfer(usbdev->handle, intinfo, epinfo, err = usb_bulk_transfer(usbdev->handle, intinfo, epinfo,
@ -2628,15 +2623,10 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
max = ((double)timeout) / 1000.0; max = ((double)timeout) / 1000.0;
cgtime(&read_start); cgtime(&read_start);
while (bufleft > 0) { while (bufleft > 0) {
// TODO: use (USB_MAX_READ - tot) always? if (ftdi)
if (usbdev->buffer) usbbufread = bufleft + 2;
usbbufread = USB_MAX_READ - tot; else
else { usbbufread = bufleft;
if (ftdi)
usbbufread = bufleft + 2;
else
usbbufread = bufleft;
}
got = 0; got = 0;
err = usb_bulk_transfer(usbdev->handle, intinfo, epinfo, err = usb_bulk_transfer(usbdev->handle, intinfo, epinfo,
ptr, usbbufread, &got, timeout, ptr, usbbufread, &got, timeout,

Loading…
Cancel
Save