1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

usb_ftdi_set_latency LOG_ERRs if called incorrectly

This commit is contained in:
Kano 2013-06-05 01:44:50 +10:00
parent f366d53f3c
commit 58bb4d486d

View File

@ -2493,6 +2493,18 @@ int usb_ftdi_set_latency(struct cgpu_info *cgpu)
{
int err;
if (cgpu->usbdev->usb_type != USB_TYPE_FTDI) {
applog(LOG_ERR, "%s: cgid %d latency request on non-FTDI device",
cgpu->drv->name, cgpu->cgminer_id);
return LIBUSB_ERROR_NOT_SUPPORTED;
}
if (cgpu->usbdev->found->latency == LATENCY_UNUSED) {
applog(LOG_ERR, "%s: cgid %d invalid latency (UNUSED)",
cgpu->drv->name, cgpu->cgminer_id);
return LIBUSB_ERROR_NOT_SUPPORTED;
}
err = usb_transfer_data(cgpu, FTDI_TYPE_OUT, FTDI_REQUEST_LATENCY,
cgpu->usbdev->found->latency,
cgpu->usbdev->found->interface, NULL, 0, C_LATENCY);