diff --git a/CHANGES b/CHANGES index 9b7459ed..6d38dd26 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ lm-sensors CHANGES file SVN HEAD libsensors: Added support for new sysfs attributes sensors: Added support for new sysfs attributes + Display both instantaneous and average power if available. fancontrol: Support setup where one PWM output controls several fans Output error messages to stderr sensors-detect: Stop calling for PIIX5 SMBus testers diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index b70b8594..1390b3fc 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -505,6 +505,11 @@ static const struct sensor_subfeature_list power_common_sensors[] = { static const struct sensor_subfeature_list power_inst_sensors[] = { { SENSORS_SUBFEATURE_POWER_INPUT_LOWEST, NULL, 0, "lowest" }, { SENSORS_SUBFEATURE_POWER_INPUT_HIGHEST, NULL, 0, "highest" }, + { SENSORS_SUBFEATURE_POWER_AVERAGE, NULL, 0, "avg" }, + { SENSORS_SUBFEATURE_POWER_AVERAGE_LOWEST, NULL, 0, "avg lowest" }, + { SENSORS_SUBFEATURE_POWER_AVERAGE_HIGHEST, NULL, 0, "avg highest" }, + { SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL, NULL, 0, + "interval" }, { -1, NULL, 0, NULL } }; @@ -516,11 +521,9 @@ static const struct sensor_subfeature_list power_avg_sensors[] = { { -1, NULL, 0, NULL } }; -#define MAX(a, b) ((a) > (b) ? (a) : (b)) #define NUM_POWER_ALARMS 4 #define NUM_POWER_SENSORS (ARRAY_SIZE(power_common_sensors) \ - + MAX(ARRAY_SIZE(power_inst_sensors), \ - ARRAY_SIZE(power_avg_sensors)) \ + + ARRAY_SIZE(power_inst_sensors) \ - NUM_POWER_ALARMS - 2) static void print_chip_power(const sensors_chip_name *name, @@ -546,9 +549,13 @@ static void print_chip_power(const sensors_chip_name *name, sensor_count = alarm_count = 0; - /* Power sensors come in 2 flavors: instantaneous and averaged. - To keep things simple, we assume that each sensor only implements - one flavor. */ + /* + * Power sensors come in 2 flavors: instantaneous and averaged. + * Most devices only support one flavor, so we try to display the + * average power if the instantaneous power attribute does not exist. + * If both instantaneous power and average power are supported, + * average power is displayed as limit. + */ sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_POWER_INPUT); get_sensor_limit_data(name, feature,