Add an option to send a USB reset via the USB menu.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
diff --git a/cgminer.c b/cgminer.c
index dfc3b5e..d32418c 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -5160,6 +5160,7 @@ static void set_usb(void)
immedok(logwin, true);
clear_logwin();
+retry:
rd_lock(&mining_thr_lock);
mt = mining_threads;
rd_unlock(&mining_thr_lock);
@@ -5179,12 +5180,12 @@ static void set_usb(void)
wlogprint("Hotplug interval:%d\n", hotplug_time);
wlogprint("%d USB devices, %d enabled, %d disabled, %d zombie\n",
total, enabled, disabled, zombie);
-retry:
wlogprint("[S]ummary of device information\n");
wlogprint("[E]nable device\n");
wlogprint("[D]isable device\n");
wlogprint("[U]nplug to allow hotplug restart\n");
- //wlogprint("[R]elease device from cgminer\n");
+ wlogprint("[R]eset device USB\n");
+ //wlogprint("[B]lacklist device from cgminer\n");
wlogprint("Select an option or any other key to return\n");
logwin_update();
input = getch();
@@ -5196,6 +5197,7 @@ retry:
goto retry;
}
cgpu = mining_thr[selected]->cgpu;
+ wlogprint("Device %03u:%03u\n", cgpu->usbinfo.bus_number, cgpu->usbinfo.device_address);
wlogprint("Name %s\n", cgpu->drv->name);
wlogprint("ID %d\n", cgpu->device_id);
wlogprint("Enabled: %s\n", cgpu->deven != DEV_DISABLED ? "Yes" : "No");
@@ -5258,6 +5260,19 @@ retry:
}
usb_nodev(cgpu);
goto retry;
+ } else if (!strncasecmp(&input, "r", 1)) {
+ selected = curses_int("Select device number");
+ if (selected < 0 || selected >= mt) {
+ wlogprint("Invalid selection\n");
+ goto retry;
+ }
+ cgpu = mining_thr[selected]->cgpu;
+ if (cgpu->usbinfo.nodev) {
+ wlogprint("Device already removed, unable to reset!\n");
+ goto retry;
+ }
+ usb_reset(cgpu);
+ goto retry;
} else
clear_logwin();