introduce ENVSYS_BATTERY_CHARGE, which is the same than an Indicator and
it's used to know if the battery is currently charging or discharging.
- Require two sensors at least for SME_CLASS_BATTERY to make the low-power
condition work: a ENVSYS_BATTERY_CAPACITY plus ENVSYS_BATTERY_CHARGE.
- Simplify sme_event_check_lowpower() and make it check the required
sensors in the SME_CLASS_ACADAPTER and SME_CLASS_BATTERY classes.
If the acadapter is not ready, trust the state returned by the battery
device.
Based on suggestion from joerg@.
sensors (those that contain the 'want-percentage' object on its
dictionary), the 'critical-capacity' prop must be used instead.
- When setting a 'critical-{max,min}' property check if the value is
higher than the 'max-value' or lower than the 'min-value' on its
dictionary, raise an error if it's true.
- use one for temporary sensor dictionaries.
- use one as the dictionary that will be returned to send_dictionary().
This fixes multiple settings in multiple devices.
foo0 {
#
# CPU Temperature
#
sensor0 {
critical-max = 70C;
critical-min = 20C;
}
...
}
...
Removed the -m flag that was previously used to set properties for
sensors. Now the -c flag will process all properties specified in
the file (accepted as argument).
To remove all properties that were set, the new -S flag can be used.
This will restore default values for all devices.
- some unclear language cleaned up
- inconsistent usage of 'device' and 'driver' to refer to the same thing
- difficult error handling
And print the device name if -d flag is not specified for any driver
registered, e.g:
$ envstat
[aiboost0]
CPU Temperature: 36.000 degC max: 70.000 degC min: 15.000 degC
MB Temperature: 38.000 degC max: 50.000 degC min: 15.000 degC
Vcore Voltage: 1.232 V max: 1.350 V min: 1.150 V
+3.3 Voltage: 3.264 V max: 3.500 V min: 3.000 V
+5 Voltage: 5.017 V max: 5.600 V min: 4.500 V
+12 Voltage: 11.932 V max: 13.500 V min: 11.200 V
CPU FAN Speed: 1268 RPM
$
ENVSYS_GSTRING (aka Generic String) uses the genstr member in
the envsys_data_t struct to add a generic string that envstat(8)
will show as value or state.
It's like the ENVSYS_DRIVER, but doesn't use value_cur. Below
is the dictionary created on these sensors:
<dict>
<key>description</key>
<string>acpibat0 charge state</string>
<key>generic-state-string</key>
<string>NORMAL</string>
<key>monitoring-supported</key>
<false/>
<key>state</key>
<string>valid</string>
<key>type</key>
<string>Generic string</string>
</dict>
Note that it's limited to 32 chars, but we can grow it if needed.
envstat(8) will print ENVSYS_GSTRING sensors as:
$ envstat -dacpibat0 -s"acpibat0 charge state"
acpibat0 charge state: NORMAL
$
in the /dev/sysmon device.
Use O_RDONLY for ENVSYS_GETDICTIONARY and O_RDWR for ENVSYS_SETDICTIONARY
in envstat(8).
Fixes PR kern/36661 by YAMAMOTO Takashi.
the analysis. Closes PR bin/36636.
- Also use the longest string for the column alignment counting all
sensors available from all devices, not per-device.
Thanks to rmind@ for help.