As per an earlier thread on misc@, this fixes sensorsd.conf(5) parsing of SENSOR_INDICATOR values. Since parsing as integers was both undocumented and confusing, it is no longer supported. Also, bail on error if the high/low values don’t create a valid range.
This mimics existing behavior, but still isn't very intuitive. I.e. “low=Off:high=On” will always be “within” user limits. Should indicators limits behave differently? Feedback is welcome. --david Index: sensorsd.c =================================================================== RCS file: /cvs/src/usr.sbin/sensorsd/sensorsd.c,v retrieving revision 1.53 diff -u -p -r1.53 sensorsd.c --- sensorsd.c 29 Jun 2014 00:58:45 -0000 1.53 +++ sensorsd.c 8 Dec 2014 19:45:45 -0000 @@ -723,6 +723,8 @@ parse_config_sdlim(struct sdlim_t *sdlim if (cgetstr(buf, "high", &ebuf) < 0) ebuf = NULL; p->upper = get_val(ebuf, 1, p->type); + if (p->lower > p->upper) + errx(1, "%s: incorrect sensor range", node); if (cgetstr(buf, "command", &ebuf) < 0) ebuf = NULL; if (ebuf) @@ -749,7 +751,7 @@ get_val(char *buf, int upper, enum senso } val = strtod(buf, &p); - if (buf == p) + if (buf == p && type != SENSOR_INDICATOR) err(1, "incorrect value: %s", buf); switch(type) { @@ -780,6 +782,13 @@ get_val(char *buf, int upper, enum senso rval = val * 1000.0; break; case SENSOR_INDICATOR: + if (strcmp(buf, "On") == 0) + rval = 1; + else if (strcmp(buf, "Off") == 0) + rval = 0; + else + errx(1, "incorrect value: %s", buf); + break; case SENSOR_INTEGER: case SENSOR_DRIVE: case SENSOR_ANGLE: