mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-02 15:36:05 +00:00
bf9aba73d3
The sdr carries unit fields for every sensor record, and they were read into the reading whether or not the sensor has a number for them to describe. A discrete sensor reports which of its states are asserted and no value at all, so a watchdog came back with units of "% ", and a discrete sensor on a full record picks up a base unit the same way, reporting degrees celsius for a sensor that never has a temperature. A caller that shows the unit alongside whatever value it was handed then prints a unit with nothing to apply it to, which is what the client was taught to skip in 8c8c32cc. The client is not the only consumer of a reading, so answer the question in the library. The record itself says which sensors those are, and the reading path already works it out to decide whether to decode a number: a sensor has one only if the numeric format says how to read it, or the format is unsigned and the record either supports thresholds or is of reading type 1. Ask that once, where the units are assembled, and give the sensors that fail it no unit, so the unit and the value cannot come to different conclusions about whether the sensor has a reading at all. A threshold or numeric sensor reports exactly what it did before, including the ones whose unit is a percentage, a combination of two units, or nothing because the record names no unit. On the Lenovo XCC this was checked against nothing changes: its 305 readable sensors decode identically, discrete ones included, because they are all compact records naming no unit in the first place. The sensors that change are the ones the finding came from, which name a unit on a record that has no number to put it on.