Browse Source

Display errors on failed usb read and write and consider sequential IO errors a permanent failure.

nfactor-troky
Con Kolivas 11 years ago
parent
commit
dc9c3783ec
  1. 32
      usbutils.c

32
usbutils.c

@ -2307,7 +2307,7 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
USB_REJECT(cgpu, MODE_BULK_READ); USB_REJECT(cgpu, MODE_BULK_READ);
err = LIBUSB_ERROR_NO_DEVICE; err = LIBUSB_ERROR_NO_DEVICE;
goto out_unlock; goto out_nodev;
} }
usbdev = cgpu->usbdev; usbdev = cgpu->usbdev;
@ -2419,9 +2419,6 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
*processed = tot; *processed = tot;
memcpy((char *)buf, (const char *)usbbuf, (tot < (int)bufsiz) ? tot + 1 : (int)bufsiz); memcpy((char *)buf, (const char *)usbbuf, (tot < (int)bufsiz) ? tot + 1 : (int)bufsiz);
if (NODEV(err))
release_cgpu(cgpu);
goto out_unlock; goto out_unlock;
} }
@ -2547,10 +2544,16 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
*processed = tot; *processed = tot;
memcpy((char *)buf, (const char *)usbbuf, (tot < (int)bufsiz) ? tot + 1 : (int)bufsiz); memcpy((char *)buf, (const char *)usbbuf, (tot < (int)bufsiz) ? tot + 1 : (int)bufsiz);
if (NODEV(err))
release_cgpu(cgpu);
out_unlock: out_unlock:
if (err && err != LIBUSB_ERROR_TIMEOUT) {
applog(LOG_WARNING, "%s %i usb read error: %s", cgpu->drv->name, cgpu->device_id,
libusb_error_name(err));
if (cgpu->usbinfo.continuous_ioerr_count > USB_RETRY_MAX)
err = LIBUSB_ERROR_OTHER;
if (NODEV(err))
release_cgpu(cgpu);
}
out_nodev:
DEVUNLOCK(cgpu, pstate); DEVUNLOCK(cgpu, pstate);
return err; return err;
@ -2585,7 +2588,7 @@ int _usb_write(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_
USB_REJECT(cgpu, MODE_BULK_WRITE); USB_REJECT(cgpu, MODE_BULK_WRITE);
err = LIBUSB_ERROR_NO_DEVICE; err = LIBUSB_ERROR_NO_DEVICE;
goto out_unlock; goto out_nodev;
} }
usbdev = cgpu->usbdev; usbdev = cgpu->usbdev;
@ -2649,10 +2652,15 @@ int _usb_write(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_
*processed = tot; *processed = tot;
if (NODEV(err)) if (err) {
release_cgpu(cgpu); applog(LOG_WARNING, "%s %i usb write error: %s", cgpu->drv->name, cgpu->device_id,
libusb_error_name(err));
out_unlock: if (cgpu->usbinfo.continuous_ioerr_count > USB_RETRY_MAX)
err = LIBUSB_ERROR_OTHER;
if (NODEV(err))
release_cgpu(cgpu);
}
out_nodev:
DEVUNLOCK(cgpu, pstate); DEVUNLOCK(cgpu, pstate);
return err; return err;

Loading…
Cancel
Save