With this the hardcoded /sys location for reading sensor data can be
changed. In particular it makes it possible to tar up the /sys directory
when a problem is encountered, and then reproduce it on another system.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Cast of (const char **) to (char **) avoids one warning to introduce
another. Drop it. rrd upstream should not need the cast anymore.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
sensors_parse_chip_name claims to overwrite all of result but path is
not set. This is generally not a problem when using statically allocated
data that is pre-zeroed but the parser uses dynamic allocation and the
chip name may contain garbage depending on the specific code flow
resulting from compiling the parser.
Setting the path was dropped when it was renamed from busname.
Fixes: 8896ba3b ("Rename sensors_chip_name.busname to path, as this is
what we are using it for by now.")
The dependencies for the parser files are not correct.
There is baroque irule adding header prerequisites to the parser but the
parser may still fail to build.
The real dependency is on conf-parse.h
There is no way to tell make that a rule produces two targets, such as
parse.c and parse.h. However, the dependency files are generated by a
separate rule, and not as a byproduct of building the source so they can
themselves have dependencies.
And dependencies they do have: when the header is generated it's in lib
but when the header is missing while generating dependency file it's
searched in top directory, and then the file that depends on it cannot
be built because the header neveer appears there.
When the generated .c file is addded as prerequisite to the dependency
file that should reference the header generated together with the .c
file the dependency file is generated correctly with the header present.
This is not easily reproducible with the current source but adding
conf-lex.h generated with conf-lex.c and including it in conf-parse.c
now makes both conf-lex.ad depend on conf-parse.h and conf-lex.ad on
conf-lex.h making the build 100% fail.
When the sensor does not provide a value something bogus is printed,
print a NaN instead.
Also update the output counting to also print a comman for NaNs.
This is not really a problem when the specific scaling factors happen to
be for factors not matched by a generic match but this may not hold in
general over time.
Fixes: 1bd92120 ("Fill the magnitude field of dynamically generated device entries.")