From 39d0e42b1178047a6186a0e2c94943d28f8e0fe7 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 4 Jul 2016 16:28:13 +0200 Subject: [PATCH] improve the --led values parsing sample usage if GPU #0 is RVB and GPU #1 a generic led: ccminer --led=0x00ff00,100,mining to put the led on while the gpus are scanning --- ccminer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ccminer.cpp b/ccminer.cpp index e7f849d..9716db1 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -2974,20 +2974,20 @@ void parse_arg(int key, char *arg) if (!opt_led_mode) opt_led_mode = LED_MODE_SHARES; char *pch = strtok(arg,","); - int n = 0, val; + int n = 0, lastval, val; while (pch != NULL && n < MAX_GPUS) { int dev_id = device_map[n++]; char * p = strstr(pch, "0x"); val = p ? (int32_t) strtoul(p, NULL, 16) : atoi(pch); if (!val && !strcmp(pch, "mining")) opt_led_mode = LED_MODE_MINING; - if (!val && !strcmp(pch, "shares")) - opt_led_mode = LED_MODE_SHARES; - device_led[dev_id] = val; + else if (device_led[dev_id] == -1) + device_led[dev_id] = lastval = val; pch = strtok(NULL, ","); } - if (val <= 100) while (n < MAX_GPUS) - device_led[n++] = val; + if (lastval) while (n < MAX_GPUS) { + device_led[n++] = lastval; + } } break; case 1005: