|
|
@ -2011,7 +2011,7 @@ static void rejected_inc(struct cgpu_info *cgpu, uint32_t mode) |
|
|
|
int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *processed, unsigned int timeout, const char *end, __maybe_unused enum usb_cmds cmd, bool readonce) |
|
|
|
int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *processed, unsigned int timeout, const char *end, __maybe_unused enum usb_cmds cmd, bool readonce) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct cg_usb_device *usbdev = cgpu->usbdev; |
|
|
|
struct cg_usb_device *usbdev = cgpu->usbdev; |
|
|
|
bool ftdi = (usbdev->usb_type == USB_TYPE_FTDI); |
|
|
|
bool ftdi; |
|
|
|
#if DO_USB_STATS |
|
|
|
#if DO_USB_STATS |
|
|
|
struct timeval tv_start; |
|
|
|
struct timeval tv_start; |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -2027,6 +2027,11 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro |
|
|
|
unsigned char usbbuf[USB_MAX_READ+4], *ptr; |
|
|
|
unsigned char usbbuf[USB_MAX_READ+4], *ptr; |
|
|
|
size_t usbbufread; |
|
|
|
size_t usbbufread; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(!usbdev)) |
|
|
|
|
|
|
|
return LIBUSB_ERROR_NO_DEVICE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ftdi = (usbdev->usb_type == USB_TYPE_FTDI); |
|
|
|
|
|
|
|
|
|
|
|
USBDEBUG("USB debug: _usb_read(%s (nodev=%s),ep=%d,buf=%p,bufsiz=%zu,proc=%p,timeout=%u,end=%s,cmd=%s,ftdi=%s,readonce=%s)", cgpu->drv->name, bool_str(cgpu->usbinfo.nodev), ep, buf, bufsiz, processed, timeout, end ? (char *)str_text((char *)end) : "NULL", usb_cmdname(cmd), bool_str(ftdi), bool_str(readonce)); |
|
|
|
USBDEBUG("USB debug: _usb_read(%s (nodev=%s),ep=%d,buf=%p,bufsiz=%zu,proc=%p,timeout=%u,end=%s,cmd=%s,ftdi=%s,readonce=%s)", cgpu->drv->name, bool_str(cgpu->usbinfo.nodev), ep, buf, bufsiz, processed, timeout, end ? (char *)str_text((char *)end) : "NULL", usb_cmdname(cmd), bool_str(ftdi), bool_str(readonce)); |
|
|
|
|
|
|
|
|
|
|
|
if (bufsiz > USB_MAX_READ) |
|
|
|
if (bufsiz > USB_MAX_READ) |
|
|
|