Browse Source

core: make errors on reading experimental options from config less scary.

The config file is written poorly: first off, not all available options
are written (they have to be written manually, since there's no struct
enumeration); then, default values are not commented out.
nfactor-troky
Noel Maersk 11 years ago
parent
commit
b5b20c19f6
  1. 6
      driver-opencl.c
  2. 4
      sgminer.c

6
driver-opencl.c

@ -567,6 +567,7 @@ char *set_intensity(char *arg) @@ -567,6 +567,7 @@ char *set_intensity(char *arg)
else {
gpus[device].dynamic = false;
val = atoi(nextptr);
if (val == 0) return "disabled";
if (val < MIN_INTENSITY || val > MAX_INTENSITY)
return "Invalid value passed to set intensity";
tt = &gpus[device].intensity;
@ -583,6 +584,7 @@ char *set_intensity(char *arg) @@ -583,6 +584,7 @@ char *set_intensity(char *arg)
else {
gpus[device].dynamic = false;
val = atoi(nextptr);
if (val == 0) return "disabled";
if (val < MIN_INTENSITY || val > MAX_INTENSITY)
return "Invalid value passed to set intensity";
@ -614,6 +616,7 @@ char *set_xintensity(char *arg) @@ -614,6 +616,7 @@ char *set_xintensity(char *arg)
if (nextptr == NULL)
return "Invalid parameters for shader based intensity";
val = atoi(nextptr);
if (val == 0) return "disabled";
if (val < MIN_XINTENSITY || val > MAX_XINTENSITY)
return "Invalid value passed to set shader-based intensity";
@ -625,6 +628,7 @@ char *set_xintensity(char *arg) @@ -625,6 +628,7 @@ char *set_xintensity(char *arg)
while ((nextptr = strtok(NULL, ",")) != NULL) {
val = atoi(nextptr);
if (val == 0) return "disabled";
if (val < MIN_XINTENSITY || val > MAX_XINTENSITY)
return "Invalid value passed to set shader based intensity";
gpus[device].dynamic = false; // Disable dynamic intensity
@ -653,6 +657,7 @@ char *set_rawintensity(char *arg) @@ -653,6 +657,7 @@ char *set_rawintensity(char *arg)
if (nextptr == NULL)
return "Invalid parameters for raw intensity";
val = atoi(nextptr);
if (val == 0) return "disabled";
if (val < MIN_RAWINTENSITY || val > MAX_RAWINTENSITY)
return "Invalid value passed to set raw intensity";
@ -664,6 +669,7 @@ char *set_rawintensity(char *arg) @@ -664,6 +669,7 @@ char *set_rawintensity(char *arg)
while ((nextptr = strtok(NULL, ",")) != NULL) {
val = atoi(nextptr);
if (val == 0) return "disabled";
if (val < MIN_RAWINTENSITY || val > MAX_RAWINTENSITY)
return "Invalid value passed to set raw intensity";
gpus[device].dynamic = false; // Disable dynamic intensity

4
sgminer.c

@ -1412,10 +1412,10 @@ static char *parse_config(json_t *config, bool fileconf, int parent_iteration) @@ -1412,10 +1412,10 @@ static char *parse_config(json_t *config, bool fileconf, int parent_iteration)
* file, just skipping over them provided the
* JSON is still valid after that. */
if (fileconf) {
applog(LOG_ERR, "Invalid config option %s: %s", p, err);
applog(LOG_WARNING, "Skipping config option %s: %s", p, err);
fileconf_load = -1;
} else {
snprintf(err_buf, sizeof(err_buf), "Parsing JSON option %s: %s",
snprintf(err_buf, sizeof(err_buf), "Error parsing JSON option %s: %s",
p, err);
return err_buf;
}

Loading…
Cancel
Save