Add enable and disable USB device functions to the 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 56 57 58 59 60 61 62 63 64
diff --git a/cgminer.c b/cgminer.c
index f565a69..72ea982 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -5143,10 +5143,16 @@ retry:
}
#ifdef USE_USBUTILS
+static void mt_enable(struct thr_info *mythr)
+{
+ cgsem_post(&mythr->sem);
+}
+
static void set_usb(void)
{
int selected, i, mt, enabled = 0, disabled = 0, zombie = 0, total = 0;
struct cgpu_info *cgpu;
+ struct thr_info *thr;
double val;
char input;
@@ -5175,9 +5181,8 @@ static void set_usb(void)
total, enabled, disabled, zombie);
retry:
wlogprint("[S]ummary of device information\n");
- //wlogprint("[D]etailed device statistics\n");
- //wlogprint("[E]nable device\n");
- //wlogprint("[D]isable device\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("Select an option or any other key to return\n");
@@ -5216,6 +5221,30 @@ retry:
val = cgpu->diff_rejected / cgpu->diff1;
wlogprint("Device Rejected %.1f%%\n", val);
goto retry;
+ } else if (!strncasecmp(&input, "e", 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 removed, unable to re-enable!\n");
+ goto retry;
+ }
+ thr = get_thread(selected);
+ cgpu->deven = DEV_ENABLED;
+ mt_enable(thr);
+ goto retry;
+ } else if (!strncasecmp(&input, "d", 1)) {
+ selected = curses_int("Select device number");
+ if (selected < 0 || selected >= mt) {
+ wlogprint("Invalid selection\n");
+ goto retry;
+ }
+ cgpu = mining_thr[selected]->cgpu;
+ cgpu->deven = DEV_DISABLED;
+ goto retry;
} else
clear_logwin();