Browse Source

Merge branch 'master' of github.com:ckolivas/cgminer into redfury

nfactor-troky
Con Kolivas 11 years ago
parent
commit
c50b13a602
  1. 19
      driver-icarus.c
  2. 10
      usbutils.c

19
driver-icarus.c

@ -297,7 +297,7 @@ static void icarus_initialise(struct cgpu_info *icarus, int baud)
return; return;
// Latency // Latency
usb_ftdi_set_latency(icarus); _usb_ftdi_set_latency(icarus, info->intinfo);
if (icarus->usbinfo.nodev) if (icarus->usbinfo.nodev)
return; return;
@ -890,13 +890,6 @@ static bool icarus_detect_one(struct libusb_device *dev, struct usb_find_devices
cgtmp->usbinfo.usbstat = USB_NOSTAT; cgtmp->usbinfo.usbstat = USB_NOSTAT;
if (!add_cgpu(cgtmp)) {
usb_uninit(cgtmp);
continue;
}
update_usb_stats(cgtmp);
intmp = (struct ICARUS_INFO *)malloc(sizeof(struct ICARUS_INFO)); intmp = (struct ICARUS_INFO *)malloc(sizeof(struct ICARUS_INFO));
if (unlikely(!intmp)) if (unlikely(!intmp))
quit(1, "Failed2 to malloc ICARUS_INFO"); quit(1, "Failed2 to malloc ICARUS_INFO");
@ -907,6 +900,16 @@ static bool icarus_detect_one(struct libusb_device *dev, struct usb_find_devices
memcpy(intmp, info, sizeof(struct ICARUS_INFO)); memcpy(intmp, info, sizeof(struct ICARUS_INFO));
intmp->intinfo = i; intmp->intinfo = i;
icarus_initialise(cgtmp, baud);
if (!add_cgpu(cgtmp)) {
usb_uninit(cgtmp);
free(intmp);
continue;
}
update_usb_stats(cgtmp);
} }
} }

10
usbutils.c

@ -2335,7 +2335,7 @@ usb_bulk_transfer(struct libusb_device_handle *dev_handle, int intinfo,
STATS_TIMEVAL(&tv_start); STATS_TIMEVAL(&tv_start);
cg_rlock(&cgusb_fd_lock); cg_rlock(&cgusb_fd_lock);
err = libusb_bulk_transfer(dev_handle, endpoint, data, err = libusb_bulk_transfer(dev_handle, endpoint, buf,
length, transferred, timeout); length, transferred, timeout);
errn = errno; errn = errno;
cg_runlock(&cgusb_fd_lock); cg_runlock(&cgusb_fd_lock);
@ -2390,7 +2390,7 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
usbdev = cgpu->usbdev; usbdev = cgpu->usbdev;
ftdi = (usbdev->usb_type == USB_TYPE_FTDI); ftdi = (usbdev->usb_type == USB_TYPE_FTDI);
USBDEBUG("USB debug: _usb_read(%s (nodev=%s),intinfo=%d,epinfo=%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), intinfo, epinfo, 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),intinfo=%d,epinfo=%d,buf=%p,bufsiz=%d,proc=%p,timeout=%u,end=%s,cmd=%s,ftdi=%s,readonce=%s)", cgpu->drv->name, bool_str(cgpu->usbinfo.nodev), intinfo, epinfo, buf, (int)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)
quit(1, "%s USB read request %d too large (max=%d)", cgpu->drv->name, (int)bufsiz, USB_MAX_READ); quit(1, "%s USB read request %d too large (max=%d)", cgpu->drv->name, (int)bufsiz, USB_MAX_READ);
@ -2449,7 +2449,7 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
cgtime(&tv_finish); cgtime(&tv_finish);
ptr[got] = '\0'; ptr[got] = '\0';
USBDEBUG("USB debug: @_usb_read(%s (nodev=%s)) first=%s err=%d%s got=%d ptr='%s' usbbufread=%zu", cgpu->drv->name, bool_str(cgpu->usbinfo.nodev), bool_str(first), err, isnodev(err), got, (char *)str_text((char *)ptr), usbbufread); USBDEBUG("USB debug: @_usb_read(%s (nodev=%s)) first=%s err=%d%s got=%d ptr='%s' usbbufread=%d", cgpu->drv->name, bool_str(cgpu->usbinfo.nodev), bool_str(first), err, isnodev(err), got, (char *)str_text((char *)ptr), (int)usbbufread);
IOERR_CHECK(cgpu, err); IOERR_CHECK(cgpu, err);
@ -2552,7 +2552,7 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
cgtime(&tv_finish); cgtime(&tv_finish);
ptr[got] = '\0'; ptr[got] = '\0';
USBDEBUG("USB debug: @_usb_read(%s (nodev=%s)) first=%s err=%d%s got=%d ptr='%s' usbbufread=%zu", cgpu->drv->name, bool_str(cgpu->usbinfo.nodev), bool_str(first), err, isnodev(err), got, (char *)str_text((char *)ptr), usbbufread); USBDEBUG("USB debug: @_usb_read(%s (nodev=%s)) first=%s err=%d%s got=%d ptr='%s' usbbufread=%d", cgpu->drv->name, bool_str(cgpu->usbinfo.nodev), bool_str(first), err, isnodev(err), got, (char *)str_text((char *)ptr), (int)usbbufread);
IOERR_CHECK(cgpu, err); IOERR_CHECK(cgpu, err);
@ -2644,7 +2644,7 @@ int _usb_write(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_
DEVLOCK(cgpu, pstate); DEVLOCK(cgpu, pstate);
USBDEBUG("USB debug: _usb_write(%s (nodev=%s),intinfo=%d,epinfo=%d,buf='%s',bufsiz=%zu,proc=%p,timeout=%u,cmd=%s)", cgpu->drv->name, bool_str(cgpu->usbinfo.nodev), intinfo, epinfo, (char *)str_text(buf), bufsiz, processed, timeout, usb_cmdname(cmd)); USBDEBUG("USB debug: _usb_write(%s (nodev=%s),intinfo=%d,epinfo=%d,buf='%s',bufsiz=%d,proc=%p,timeout=%u,cmd=%s)", cgpu->drv->name, bool_str(cgpu->usbinfo.nodev), intinfo, epinfo, (char *)str_text(buf), (int)bufsiz, processed, timeout, usb_cmdname(cmd));
*processed = 0; *processed = 0;

Loading…
Cancel
Save