static const char *temperature_units[] = {" C"};
static const char *volt_units[] = {" mV", " V"};
static const char *amp_units[] = {" mA", " A"};
+ static const char *watt_units[] = {" mW", " W"};
const char **units;
unsigned max_unit;
max_unit = ARRAY_SIZE(hz_units)-1;
units = hz_units;
break;
+ case PIPE_DRIVER_QUERY_TYPE_WATTS:
+ max_unit = ARRAY_SIZE(watt_units)-1;
+ units = watt_units;
+ break;
default:
if (max_value == 100) {
max_unit = ARRAY_SIZE(percent_units)-1;
SENSORS_CURRENT_CURRENT);
pane->type = PIPE_DRIVER_QUERY_TYPE_AMPS;
}
+ else if (sscanf(name, "sensors_pow_cu-%s", arg_name) == 1) {
+ hud_sensors_temp_graph_install(pane, arg_name,
+ SENSORS_POWER_CURRENT);
+ pane->type = PIPE_DRIVER_QUERY_TYPE_WATTS;
+ }
#endif
else if (strcmp(name, "samples-passed") == 0 &&
has_occlusion_query(hud->pipe->screen)) {
if (sf)
sti->critical = get_value(sti->chip, sf);
break;
+ case SENSORS_POWER_CURRENT:
+ sf = sensors_get_subfeature(sti->chip, sti->feature,
+ SENSORS_SUBFEATURE_POWER_INPUT);
+ if (sf) {
+ /* Sensors API returns in WATTs, even though driver is reporting mW,
+ * convert back to mW */
+ sti->current = get_value(sti->chip, sf) * 1000;
+ }
+ break;
}
sf = sensors_get_subfeature(sti->chip, sti->feature,
case SENSORS_CURRENT_CURRENT:
hud_graph_add_value(gr, (uint64_t) sti->current);
break;
+ case SENSORS_POWER_CURRENT:
+ hud_graph_add_value(gr, (uint64_t) sti->current);
+ break;
}
sti->last_time = now;
mode == SENSORS_VOLTAGE_CURRENT ? "VOLTS" :
mode == SENSORS_CURRENT_CURRENT ? "AMPS" :
mode == SENSORS_TEMP_CURRENT ? "CU" :
+ mode == SENSORS_POWER_CURRENT ? "POWER" :
mode == SENSORS_TEMP_CRITICAL ? "CR" : "UNDEFINED");
#endif
sti->mode == SENSORS_VOLTAGE_CURRENT ? "Volts" :
sti->mode == SENSORS_CURRENT_CURRENT ? "Amps" :
sti->mode == SENSORS_TEMP_CURRENT ? "Curr" :
+ sti->mode == SENSORS_POWER_CURRENT ? "Pow" :
sti->mode == SENSORS_TEMP_CRITICAL ? "Crit" : "Unkn");
gr->query_data = sti;
case SENSORS_CURRENT_CURRENT:
hud_pane_set_max_value(pane, 5000);
break;
+ case SENSORS_POWER_CURRENT:
+ hud_pane_set_max_value(pane, 5000 /* mW */);
+ break;
}
}
/* Create a 'current' and 'critical' object pair.
* Ignore sensor if its not temperature based.
*/
- if (feature->type == SENSORS_FEATURE_TEMP) {
+ switch(feature->type) {
+ case SENSORS_FEATURE_TEMP:
create_object(name, featurename, chip, feature,
SENSORS_TEMP_CURRENT);
create_object(name, featurename, chip, feature,
SENSORS_TEMP_CRITICAL);
- }
- if (feature->type == SENSORS_FEATURE_IN) {
+ break;
+ case SENSORS_FEATURE_IN:
create_object(name, featurename, chip, feature,
SENSORS_VOLTAGE_CURRENT);
- }
- if (feature->type == SENSORS_FEATURE_CURR) {
+ break;
+ case SENSORS_FEATURE_CURR:
create_object(name, featurename, chip, feature,
SENSORS_CURRENT_CURRENT);
+ break;
+ case SENSORS_FEATURE_POWER:
+ create_object(name, featurename, chip, feature,
+ SENSORS_POWER_CURRENT);
+ break;
+ default:
+ break;
}
free(featurename);
}
case SENSORS_CURRENT_CURRENT:
snprintf(line, sizeof(line), " sensors_curr_cu-%s", sti->name);
break;
+ case SENSORS_POWER_CURRENT:
+ snprintf(line, sizeof(line), " sensors_pow_cu-%s", sti->name);
+ break;
}
puts(line);