current value as well as critical limits set and sensor unit.
* Add a new flag: -T. When it's enabled statistics will be created for
the sensors. Max, min and average statistics as well as sensor unit
will be displayed. Must be used with an interval.
You can see the new code in action here:
http://www.netbsd.org/~xtraeme/envstat_stats.txt
Thanks to jmcneill@ for comments and ideas.
Changes beyond OpenBSD's driver:
- Improved support for AMD K8
- Added support for AMD Barcelona, AMD Phenom and AMD Griffin
Tested on various single and multi-socket machines.
Review and OK xtreame
via the -s flag (the requirement for -d is not there anymore). [1]
You can do something like the following now:
$ envstat -s "acpibat0:charge,acpibat0:charge state,acpitz0:temperature"
[acpibat0]
charge: 3.015 Ah (79.70%)
charge state: NORMAL
[acpitz0]
temperature: 54.000 degC
$
* As bonus, the code has been modified to use a simple queue for
the sensors, and this has simplified and improved some parts of the
code as well.
[1] Item requested by joerg@ yesterday.
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
$