Browse Source

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
master
Tanguy Pruvot 9 years ago
parent
commit
39d0e42b11
  1. 12
      ccminer.cpp

12
ccminer.cpp

@ -2974,20 +2974,20 @@ void parse_arg(int key, char *arg)
if (!opt_led_mode) if (!opt_led_mode)
opt_led_mode = LED_MODE_SHARES; opt_led_mode = LED_MODE_SHARES;
char *pch = strtok(arg,","); char *pch = strtok(arg,",");
int n = 0, val; int n = 0, lastval, val;
while (pch != NULL && n < MAX_GPUS) { while (pch != NULL && n < MAX_GPUS) {
int dev_id = device_map[n++]; int dev_id = device_map[n++];
char * p = strstr(pch, "0x"); char * p = strstr(pch, "0x");
val = p ? (int32_t) strtoul(p, NULL, 16) : atoi(pch); val = p ? (int32_t) strtoul(p, NULL, 16) : atoi(pch);
if (!val && !strcmp(pch, "mining")) if (!val && !strcmp(pch, "mining"))
opt_led_mode = LED_MODE_MINING; opt_led_mode = LED_MODE_MINING;
if (!val && !strcmp(pch, "shares")) else if (device_led[dev_id] == -1)
opt_led_mode = LED_MODE_SHARES; device_led[dev_id] = lastval = val;
device_led[dev_id] = val;
pch = strtok(NULL, ","); pch = strtok(NULL, ",");
} }
if (val <= 100) while (n < MAX_GPUS) if (lastval) while (n < MAX_GPUS) {
device_led[n++] = val; device_led[n++] = lastval;
}
} }
break; break;
case 1005: case 1005:

Loading…
Cancel
Save