2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 06:15:15 +00:00

Add support for instantaneous power sensors.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5378 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2008-10-24 09:03:18 +00:00
parent 7aa5cb5871
commit d766935c47
5 changed files with 36 additions and 9 deletions

View File

@@ -2,7 +2,9 @@ lm-sensors CHANGES file
-----------------------
SVN-HEAD
libsensors: Add support for instantaneous power sensors
maxilife scripts: Delete (driver never ported to Linux 2.6)
sensors: Add support for instantaneous power sensors
sensors-detect: Fix detection of ADT7463 and LM96000
Add VIA VX800/VX820 support
Fix detection of Intel 5000 series FB-DIMM AMB

View File

@@ -6,6 +6,12 @@ over time. This document summarizes these evolutions so that application
authors can quickly figure out how to test for the availability of a
given new feature.
0x402 lm-sensors SVN
* Added support for instantaneous power sensors
enum sensors_subfeature_type SENSORS_SUBFEATURE_POWER_INPUT
enum sensors_subfeature_type SENSORS_SUBFEATURE_POWER_INPUT_HIGHEST
enum sensors_subfeature_type SENSORS_SUBFEATURE_POWER_INPUT_LOWEST
0x401 lm-sensors 3.0.2 to 3.0.3
* Added bus type "virtual":
#define SENSORS_BUS_TYPE_VIRTUAL

View File

@@ -31,7 +31,7 @@
when the API + ABI breaks), the third digit is incremented to track small
API additions like new flags / enum values. The second digit is for tracking
larger additions like new methods. */
#define SENSORS_API_VERSION 0x401
#define SENSORS_API_VERSION 0x402
#define SENSORS_CHIP_NAME_PREFIX_ANY NULL
#define SENSORS_CHIP_NAME_ADDR_ANY (-1)
@@ -175,7 +175,9 @@ typedef enum sensors_subfeature_type {
SENSORS_SUBFEATURE_POWER_AVERAGE = SENSORS_FEATURE_POWER << 8,
SENSORS_SUBFEATURE_POWER_AVERAGE_HIGHEST,
SENSORS_SUBFEATURE_POWER_AVERAGE_LOWEST,
SENSORS_SUBFEATURE_POWER_INPUT,
SENSORS_SUBFEATURE_POWER_INPUT_HIGHEST,
SENSORS_SUBFEATURE_POWER_INPUT_LOWEST,
SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL = (SENSORS_FEATURE_POWER << 8) | 0x80,
SENSORS_SUBFEATURE_ENERGY_INPUT = SENSORS_FEATURE_ENERGY << 8,

View File

@@ -247,6 +247,9 @@ static const struct subfeature_type_match power_matches[] = {
{ "average", SENSORS_SUBFEATURE_POWER_AVERAGE },
{ "average_highest", SENSORS_SUBFEATURE_POWER_AVERAGE_HIGHEST },
{ "average_lowest", SENSORS_SUBFEATURE_POWER_AVERAGE_LOWEST },
{ "input", SENSORS_SUBFEATURE_POWER_INPUT },
{ "input_highest", SENSORS_SUBFEATURE_POWER_INPUT_HIGHEST },
{ "input_lowest", SENSORS_SUBFEATURE_POWER_INPUT_LOWEST },
{ "average_interval", SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL },
{ NULL, 0 }
};

View File

@@ -449,8 +449,28 @@ static void print_chip_power(const sensors_chip_name *name,
print_label(label, label_size);
free(label);
/* Power sensors come in 2 flavors: instantaneous and averaged.
To keep things simple, we assume that each sensor only implements
one flavor. */
sf = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_POWER_AVERAGE);
SENSORS_SUBFEATURE_POWER_INPUT);
if (sf) {
sfmin = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_POWER_INPUT_HIGHEST);
sfmax = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_POWER_INPUT_LOWEST);
sfint = NULL;
} else {
sf = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_POWER_AVERAGE);
sfmin = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_POWER_AVERAGE_HIGHEST);
sfmax = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_POWER_AVERAGE_LOWEST);
sfint = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL);
}
if (sf) {
val = get_value(name, sf);
scale_value(&val, &unit);
@@ -458,12 +478,6 @@ static void print_chip_power(const sensors_chip_name *name,
} else
printf(" N/A");
sfmin = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_POWER_AVERAGE_HIGHEST);
sfmax = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_POWER_AVERAGE_LOWEST);
sfint = sensors_get_subfeature(name, feature,
SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL);
if (sfmin || sfmax || sfint) {
printf(" (");