mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
USB move usbdev info that needs to stay around into usbinfo
This commit is contained in:
parent
8f4340bfeb
commit
7fbc3770b4
4
api.c
4
api.c
@ -1575,7 +1575,7 @@ static void pgastatus(struct io_data *io_data, int pga, bool isjson, bool precom
|
|||||||
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
|
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
|
||||||
root = api_add_diff(root, "Last Share Difficulty", &(cgpu->last_share_diff), false);
|
root = api_add_diff(root, "Last Share Difficulty", &(cgpu->last_share_diff), false);
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
||||||
root = api_add_bool(root, "No Device", &(cgpu->nodev), false);
|
root = api_add_bool(root, "No Device", &(cgpu->usbinfo.nodev), false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
root = print_data(root, buf, isjson, precom);
|
root = print_data(root, buf, isjson, precom);
|
||||||
@ -1793,7 +1793,7 @@ static void pgaenable(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
||||||
if (cgpu->nodev) {
|
if (cgpu->usbinfo.nodev) {
|
||||||
message(io_data, MSG_USBNODEV, id, NULL, isjson);
|
message(io_data, MSG_USBNODEV, id, NULL, isjson);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
|
|||||||
applog(LOG_DEBUG, "%s%i: reset got err %d",
|
applog(LOG_DEBUG, "%s%i: reset got err %d",
|
||||||
bitforce->drv->name, bitforce->device_id, err);
|
bitforce->drv->name, bitforce->device_id, err);
|
||||||
|
|
||||||
if (bitforce->nodev)
|
if (bitforce->usbinfo.nodev)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
// Set data control
|
// Set data control
|
||||||
@ -102,7 +102,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
|
|||||||
applog(LOG_DEBUG, "%s%i: setdata got err %d",
|
applog(LOG_DEBUG, "%s%i: setdata got err %d",
|
||||||
bitforce->drv->name, bitforce->device_id, err);
|
bitforce->drv->name, bitforce->device_id, err);
|
||||||
|
|
||||||
if (bitforce->nodev)
|
if (bitforce->usbinfo.nodev)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
// Set the baud
|
// Set the baud
|
||||||
@ -113,7 +113,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
|
|||||||
applog(LOG_DEBUG, "%s%i: setbaud got err %d",
|
applog(LOG_DEBUG, "%s%i: setbaud got err %d",
|
||||||
bitforce->drv->name, bitforce->device_id, err);
|
bitforce->drv->name, bitforce->device_id, err);
|
||||||
|
|
||||||
if (bitforce->nodev)
|
if (bitforce->usbinfo.nodev)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
// Set Flow Control
|
// Set Flow Control
|
||||||
@ -123,7 +123,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
|
|||||||
applog(LOG_DEBUG, "%s%i: setflowctrl got err %d",
|
applog(LOG_DEBUG, "%s%i: setflowctrl got err %d",
|
||||||
bitforce->drv->name, bitforce->device_id, err);
|
bitforce->drv->name, bitforce->device_id, err);
|
||||||
|
|
||||||
if (bitforce->nodev)
|
if (bitforce->usbinfo.nodev)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
// Set Modem Control
|
// Set Modem Control
|
||||||
@ -133,7 +133,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
|
|||||||
applog(LOG_DEBUG, "%s%i: setmodemctrl got err %d",
|
applog(LOG_DEBUG, "%s%i: setmodemctrl got err %d",
|
||||||
bitforce->drv->name, bitforce->device_id, err);
|
bitforce->drv->name, bitforce->device_id, err);
|
||||||
|
|
||||||
if (bitforce->nodev)
|
if (bitforce->usbinfo.nodev)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
// Clear any sent data
|
// Clear any sent data
|
||||||
@ -143,7 +143,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
|
|||||||
applog(LOG_DEBUG, "%s%i: purgetx got err %d",
|
applog(LOG_DEBUG, "%s%i: purgetx got err %d",
|
||||||
bitforce->drv->name, bitforce->device_id, err);
|
bitforce->drv->name, bitforce->device_id, err);
|
||||||
|
|
||||||
if (bitforce->nodev)
|
if (bitforce->usbinfo.nodev)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
// Clear any received data
|
// Clear any received data
|
||||||
@ -178,14 +178,14 @@ static bool bitforce_detect_one(struct libusb_device *dev, struct usb_find_devic
|
|||||||
if (!usb_init(bitforce, dev, found)) {
|
if (!usb_init(bitforce, dev, found)) {
|
||||||
applog(LOG_ERR, "%s detect (%d:%d) failed to initialise (incorrect device?)",
|
applog(LOG_ERR, "%s detect (%d:%d) failed to initialise (incorrect device?)",
|
||||||
bitforce->drv->dname,
|
bitforce->drv->dname,
|
||||||
(int)libusb_get_bus_number(dev),
|
(int)(bitforce->usbinfo.bus_number),
|
||||||
(int)libusb_get_device_address(dev));
|
(int)(bitforce->usbinfo.device_address));
|
||||||
goto shin;
|
goto shin;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(devpath, "%d:%d",
|
sprintf(devpath, "%d:%d",
|
||||||
(int)(bitforce->usbdev->bus_number),
|
(int)(bitforce->usbinfo.bus_number),
|
||||||
(int)(bitforce->usbdev->device_address));
|
(int)(bitforce->usbinfo.device_address));
|
||||||
|
|
||||||
|
|
||||||
// Allow 2 complete attempts if the 1st time returns an unrecognised reply
|
// Allow 2 complete attempts if the 1st time returns an unrecognised reply
|
||||||
@ -361,7 +361,7 @@ static bool bitforce_get_temp(struct cgpu_info *bitforce)
|
|||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
// Device is gone
|
// Device is gone
|
||||||
if (bitforce->nodev)
|
if (bitforce->usbinfo.nodev)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Do not try to get the temperature if we're polling for a result to
|
/* Do not try to get the temperature if we're polling for a result to
|
||||||
@ -683,7 +683,7 @@ static int64_t bitforce_scanhash(struct thr_info *thr, struct work *work, int64_
|
|||||||
int64_t ret;
|
int64_t ret;
|
||||||
|
|
||||||
// Device is gone
|
// Device is gone
|
||||||
if (bitforce->nodev)
|
if (bitforce->usbinfo.nodev)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
send_ret = bitforce_send_work(thr, work);
|
send_ret = bitforce_send_work(thr, work);
|
||||||
|
@ -129,14 +129,14 @@ static bool modminer_detect_one(struct libusb_device *dev, struct usb_find_devic
|
|||||||
if (!usb_init(modminer, dev, found)) {
|
if (!usb_init(modminer, dev, found)) {
|
||||||
applog(LOG_ERR, "%s detect (%d:%d) failed to initialise (incorrect device?)",
|
applog(LOG_ERR, "%s detect (%d:%d) failed to initialise (incorrect device?)",
|
||||||
modminer->drv->dname,
|
modminer->drv->dname,
|
||||||
(int)libusb_get_bus_number(dev),
|
(int)(modminer->usbinfo.bus_number),
|
||||||
(int)libusb_get_device_address(dev));
|
(int)(modminer->usbinfo.device_address));
|
||||||
goto shin;
|
goto shin;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(devpath, "%d:%d",
|
sprintf(devpath, "%d:%d",
|
||||||
(int)(modminer->usbdev->bus_number),
|
(int)(modminer->usbinfo.bus_number),
|
||||||
(int)(modminer->usbdev->device_address));
|
(int)(modminer->usbinfo.device_address));
|
||||||
|
|
||||||
do_ping(modminer);
|
do_ping(modminer);
|
||||||
|
|
||||||
@ -204,15 +204,15 @@ static bool modminer_detect_one(struct libusb_device *dev, struct usb_find_devic
|
|||||||
tmp->name = devname;
|
tmp->name = devname;
|
||||||
|
|
||||||
sprintf(devpath, "%d:%d:%d",
|
sprintf(devpath, "%d:%d:%d",
|
||||||
(int)(modminer->usbdev->bus_number),
|
(int)(modminer->usbinfo.bus_number),
|
||||||
(int)(modminer->usbdev->device_address),
|
(int)(modminer->usbinfo.device_address),
|
||||||
i);
|
i);
|
||||||
|
|
||||||
tmp->device_path = strdup(devpath);
|
tmp->device_path = strdup(devpath);
|
||||||
tmp->usbdev = modminer->usbdev;
|
tmp->usbdev = modminer->usbdev;
|
||||||
// Only the first copy gets the already used stats
|
// Only the first copy gets the already used stats
|
||||||
if (!added)
|
if (!added)
|
||||||
tmp->usbstat = modminer->usbstat;
|
tmp->usbinfo.usbstat = modminer->usbinfo.usbstat;
|
||||||
tmp->fpgaid = (char)i;
|
tmp->fpgaid = (char)i;
|
||||||
tmp->modminer_mutex = modminer->modminer_mutex;
|
tmp->modminer_mutex = modminer->modminer_mutex;
|
||||||
tmp->deven = DEV_ENABLED;
|
tmp->deven = DEV_ENABLED;
|
||||||
@ -640,7 +640,7 @@ static const char *modminer_delta_clock(struct thr_info *thr, int delta, bool te
|
|||||||
int err, amount;
|
int err, amount;
|
||||||
|
|
||||||
// Device is gone
|
// Device is gone
|
||||||
if (modminer->nodev)
|
if (modminer->usbinfo.nodev)
|
||||||
return clocknodev;
|
return clocknodev;
|
||||||
|
|
||||||
// Only do once if multiple shares per work or multiple reasons
|
// Only do once if multiple shares per work or multiple reasons
|
||||||
@ -828,7 +828,7 @@ static void check_temperature(struct thr_info *thr)
|
|||||||
int amount;
|
int amount;
|
||||||
|
|
||||||
// Device is gone
|
// Device is gone
|
||||||
if (modminer->nodev)
|
if (modminer->usbinfo.nodev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (state->one_byte_temp) {
|
if (state->one_byte_temp) {
|
||||||
@ -916,7 +916,7 @@ static uint64_t modminer_process_results(struct thr_info *thr)
|
|||||||
int temploop;
|
int temploop;
|
||||||
|
|
||||||
// Device is gone
|
// Device is gone
|
||||||
if (modminer->nodev)
|
if (modminer->usbinfo.nodev)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// If we are overheated it will just keep checking for results
|
// If we are overheated it will just keep checking for results
|
||||||
@ -1079,7 +1079,7 @@ static int64_t modminer_scanhash(struct thr_info *thr, struct work *work, int64_
|
|||||||
struct timeval tv1, tv2;
|
struct timeval tv1, tv2;
|
||||||
|
|
||||||
// Device is gone
|
// Device is gone
|
||||||
if (thr->cgpu->nodev)
|
if (thr->cgpu->usbinfo.nodev)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Don't start new work if overheated
|
// Don't start new work if overheated
|
||||||
@ -1092,7 +1092,7 @@ static int64_t modminer_scanhash(struct thr_info *thr, struct work *work, int64_
|
|||||||
check_temperature(thr);
|
check_temperature(thr);
|
||||||
|
|
||||||
// Device is gone
|
// Device is gone
|
||||||
if (thr->cgpu->nodev)
|
if (thr->cgpu->usbinfo.nodev)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (state->overheated == true) {
|
if (state->overheated == true) {
|
||||||
|
3
miner.h
3
miner.h
@ -400,8 +400,7 @@ struct cgpu_info {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
||||||
int usbstat;
|
struct cg_usb_info usbinfo;
|
||||||
bool nodev;
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_MODMINER
|
#ifdef USE_MODMINER
|
||||||
char fpgaid;
|
char fpgaid;
|
||||||
|
51
usbutils.c
51
usbutils.c
@ -641,7 +641,7 @@ static void add_used(libusb_device *dev, bool lock)
|
|||||||
mutex_unlock(list_lock);
|
mutex_unlock(list_lock);
|
||||||
|
|
||||||
sprintf(buf, "add_used() duplicate bus_number %d device_address %d",
|
sprintf(buf, "add_used() duplicate bus_number %d device_address %d",
|
||||||
bus_number, device_address);
|
(int)bus_number, (int)device_address);
|
||||||
quit(1, buf);
|
quit(1, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,7 +692,7 @@ static void release(uint8_t bus_number, uint8_t device_address, bool lock)
|
|||||||
mutex_unlock(list_lock);
|
mutex_unlock(list_lock);
|
||||||
|
|
||||||
sprintf(buf, "release() unknown: bus_number %d device_address %d",
|
sprintf(buf, "release() unknown: bus_number %d device_address %d",
|
||||||
bus_number, device_address);
|
(int)bus_number, (int)device_address);
|
||||||
quit(1, buf);
|
quit(1, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -752,26 +752,26 @@ void usb_uninit(struct cgpu_info *cgpu)
|
|||||||
void release_cgpu(struct cgpu_info *cgpu)
|
void release_cgpu(struct cgpu_info *cgpu)
|
||||||
{
|
{
|
||||||
struct cg_usb_device *cgusb = cgpu->usbdev;
|
struct cg_usb_device *cgusb = cgpu->usbdev;
|
||||||
uint8_t bus_number;
|
|
||||||
uint8_t device_address;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
cgpu->nodev = true;
|
cgpu->usbinfo.nodev = true;
|
||||||
|
cgpu->usbinfo.nodev_count++;
|
||||||
|
gettimeofday(&(cgpu->usbinfo.last_nodev), NULL);
|
||||||
|
|
||||||
// Any devices sharing the same USB device should be marked also
|
// Any devices sharing the same USB device should be marked also
|
||||||
// Currently only MMQ shares a USB device
|
// Currently only MMQ shares a USB device
|
||||||
for (i = 0; i < total_devices; i++)
|
for (i = 0; i < total_devices; i++)
|
||||||
if (devices[i] != cgpu && devices[i]->usbdev == cgusb) {
|
if (devices[i] != cgpu && devices[i]->usbdev == cgusb) {
|
||||||
devices[i]->nodev = true;
|
devices[i]->usbinfo.nodev = true;
|
||||||
|
devices[i]->usbinfo.nodev_count++;
|
||||||
|
memcpy(&(devices[i]->usbinfo.last_nodev),
|
||||||
|
&(cgpu->usbinfo.last_nodev), sizeof(struct timeval));
|
||||||
devices[i]->usbdev = NULL;
|
devices[i]->usbdev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bus_number = cgusb->bus_number;
|
|
||||||
device_address = cgusb->device_address;
|
|
||||||
|
|
||||||
usb_uninit(cgpu);
|
usb_uninit(cgpu);
|
||||||
|
|
||||||
release(bus_number, device_address, true);
|
release(cgpu->usbinfo.bus_number, cgpu->usbinfo.device_address, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find_devices *found)
|
bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find_devices *found)
|
||||||
@ -783,12 +783,12 @@ bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find
|
|||||||
unsigned char strbuf[STRBUFLEN+1];
|
unsigned char strbuf[STRBUFLEN+1];
|
||||||
int err, i, j, k;
|
int err, i, j, k;
|
||||||
|
|
||||||
|
cgpu->usbinfo.bus_number = libusb_get_bus_number(dev);
|
||||||
|
cgpu->usbinfo.device_address = libusb_get_device_address(dev);
|
||||||
|
|
||||||
cgusb = calloc(1, sizeof(*cgusb));
|
cgusb = calloc(1, sizeof(*cgusb));
|
||||||
cgusb->found = found;
|
cgusb->found = found;
|
||||||
|
|
||||||
cgusb->bus_number = libusb_get_bus_number(dev);
|
|
||||||
cgusb->device_address = libusb_get_device_address(dev);
|
|
||||||
|
|
||||||
cgusb->descriptor = calloc(1, sizeof(*(cgusb->descriptor)));
|
cgusb->descriptor = calloc(1, sizeof(*(cgusb->descriptor)));
|
||||||
|
|
||||||
err = libusb_get_device_descriptor(dev, cgusb->descriptor);
|
err = libusb_get_device_descriptor(dev, cgusb->descriptor);
|
||||||
@ -828,7 +828,8 @@ bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find
|
|||||||
switch(err) {
|
switch(err) {
|
||||||
case LIBUSB_ERROR_BUSY:
|
case LIBUSB_ERROR_BUSY:
|
||||||
applog(LOG_WARNING, "USB init, %s device %d:%d in use",
|
applog(LOG_WARNING, "USB init, %s device %d:%d in use",
|
||||||
found->name, cgusb->bus_number, cgusb->device_address);
|
found->name, (int)(cgpu->usbinfo.bus_number),
|
||||||
|
(int)(cgpu->usbinfo.device_address));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
applog(LOG_DEBUG, "USB init, failed to set config to %d, err %d",
|
applog(LOG_DEBUG, "USB init, failed to set config to %d, err %d",
|
||||||
@ -908,7 +909,7 @@ bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find
|
|||||||
// cgusb->fwVersion <- for temp1/temp2 decision? or serial? (driver-modminer.c)
|
// cgusb->fwVersion <- for temp1/temp2 decision? or serial? (driver-modminer.c)
|
||||||
// cgusb->interfaceVersion
|
// cgusb->interfaceVersion
|
||||||
|
|
||||||
applog(LOG_DEBUG, "USB init device bus_number=%d device_address=%d usbver=%04x prod='%s' manuf='%s' serial='%s'", (int)(cgusb->bus_number), (int)(cgusb->device_address), cgusb->usbver, cgusb->prod_string, cgusb->manuf_string, cgusb->serial_string);
|
applog(LOG_DEBUG, "USB init device bus_number=%d device_address=%d usbver=%04x prod='%s' manuf='%s' serial='%s'", (int)(cgpu->usbinfo.bus_number), (int)(cgpu->usbinfo.device_address), cgusb->usbver, cgusb->prod_string, cgusb->manuf_string, cgusb->serial_string);
|
||||||
|
|
||||||
cgpu->usbdev = cgusb;
|
cgpu->usbdev = cgusb;
|
||||||
|
|
||||||
@ -1134,7 +1135,7 @@ static void newstats(struct cgpu_info *cgpu)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
cgpu->usbstat = ++next_stat;
|
cgpu->usbinfo.usbstat = ++next_stat;
|
||||||
|
|
||||||
usb_stats = realloc(usb_stats, sizeof(*usb_stats) * next_stat);
|
usb_stats = realloc(usb_stats, sizeof(*usb_stats) * next_stat);
|
||||||
usb_stats[next_stat-1].name = cgpu->drv->name;
|
usb_stats[next_stat-1].name = cgpu->drv->name;
|
||||||
@ -1148,11 +1149,11 @@ static void newstats(struct cgpu_info *cgpu)
|
|||||||
void update_usb_stats(__maybe_unused struct cgpu_info *cgpu)
|
void update_usb_stats(__maybe_unused struct cgpu_info *cgpu)
|
||||||
{
|
{
|
||||||
#if DO_USB_STATS
|
#if DO_USB_STATS
|
||||||
if (cgpu->usbstat < 1)
|
if (cgpu->usbinfo.usbstat < 1)
|
||||||
newstats(cgpu);
|
newstats(cgpu);
|
||||||
|
|
||||||
// we don't know the device_id until after add_cgpu()
|
// we don't know the device_id until after add_cgpu()
|
||||||
usb_stats[cgpu->usbstat - 1].device_id = cgpu->device_id;
|
usb_stats[cgpu->usbinfo.usbstat - 1].device_id = cgpu->device_id;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1163,10 +1164,10 @@ static void stats(struct cgpu_info *cgpu, struct timeval *tv_start, struct timev
|
|||||||
double diff;
|
double diff;
|
||||||
int item;
|
int item;
|
||||||
|
|
||||||
if (cgpu->usbstat < 1)
|
if (cgpu->usbinfo.usbstat < 1)
|
||||||
newstats(cgpu);
|
newstats(cgpu);
|
||||||
|
|
||||||
details = &(usb_stats[cgpu->usbstat - 1].details[cmd * 2 + seq]);
|
details = &(usb_stats[cgpu->usbinfo.usbstat - 1].details[cmd * 2 + seq]);
|
||||||
|
|
||||||
diff = tdiff(tv_finish, tv_start);
|
diff = tdiff(tv_finish, tv_start);
|
||||||
|
|
||||||
@ -1201,10 +1202,10 @@ static void rejected_inc(struct cgpu_info *cgpu)
|
|||||||
struct cg_usb_stats_details *details;
|
struct cg_usb_stats_details *details;
|
||||||
int item = CMD_ERROR;
|
int item = CMD_ERROR;
|
||||||
|
|
||||||
if (cgpu->usbstat < 1)
|
if (cgpu->usbinfo.usbstat < 1)
|
||||||
newstats(cgpu);
|
newstats(cgpu);
|
||||||
|
|
||||||
details = &(usb_stats[cgpu->usbstat - 1].details[C_REJECTED * 2 + 0]);
|
details = &(usb_stats[cgpu->usbinfo.usbstat - 1].details[C_REJECTED * 2 + 0]);
|
||||||
|
|
||||||
details->item[item].count++;
|
details->item[item].count++;
|
||||||
}
|
}
|
||||||
@ -1222,7 +1223,7 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
|
|||||||
int err, got, tot, i;
|
int err, got, tot, i;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
if (cgpu->nodev) {
|
if (cgpu->usbinfo.nodev) {
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
*processed = 0;
|
*processed = 0;
|
||||||
#if DO_USB_STATS
|
#if DO_USB_STATS
|
||||||
@ -1330,7 +1331,7 @@ int _usb_write(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pr
|
|||||||
#endif
|
#endif
|
||||||
int err, sent;
|
int err, sent;
|
||||||
|
|
||||||
if (cgpu->nodev) {
|
if (cgpu->usbinfo.nodev) {
|
||||||
*processed = 0;
|
*processed = 0;
|
||||||
#if DO_USB_STATS
|
#if DO_USB_STATS
|
||||||
rejected_inc(cgpu);
|
rejected_inc(cgpu);
|
||||||
@ -1364,7 +1365,7 @@ int _usb_transfer(struct cgpu_info *cgpu, uint8_t request_type, uint8_t bRequest
|
|||||||
#endif
|
#endif
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (cgpu->nodev) {
|
if (cgpu->usbinfo.nodev) {
|
||||||
#if DO_USB_STATS
|
#if DO_USB_STATS
|
||||||
rejected_inc(cgpu);
|
rejected_inc(cgpu);
|
||||||
#endif
|
#endif
|
||||||
|
11
usbutils.h
11
usbutils.h
@ -67,8 +67,6 @@ struct cg_usb_device {
|
|||||||
libusb_device_handle *handle;
|
libusb_device_handle *handle;
|
||||||
pthread_mutex_t *mutex;
|
pthread_mutex_t *mutex;
|
||||||
struct libusb_device_descriptor *descriptor;
|
struct libusb_device_descriptor *descriptor;
|
||||||
uint8_t bus_number;
|
|
||||||
uint8_t device_address;
|
|
||||||
uint16_t usbver;
|
uint16_t usbver;
|
||||||
int speed;
|
int speed;
|
||||||
char *prod_string;
|
char *prod_string;
|
||||||
@ -78,6 +76,15 @@ struct cg_usb_device {
|
|||||||
unsigned char interfaceVersion; // ??
|
unsigned char interfaceVersion; // ??
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct cg_usb_info {
|
||||||
|
uint8_t bus_number;
|
||||||
|
uint8_t device_address;
|
||||||
|
int usbstat;
|
||||||
|
bool nodev;
|
||||||
|
int nodev_count;
|
||||||
|
struct timeval last_nodev;
|
||||||
|
};
|
||||||
|
|
||||||
enum usb_cmds {
|
enum usb_cmds {
|
||||||
C_REJECTED = 0,
|
C_REJECTED = 0,
|
||||||
C_PING,
|
C_PING,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user