mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-17 19:30:26 +00:00
libsensors + sensors: Add freq_input support
This commit is contained in:
1 parent
42f240d2a4
commit
543632712e
3 files changed
+40
No files matched your search
@@ -148,6 +148,7 @@ typedef enum sensors_feature_type {
|
|||||||
SENSORS_FEATURE_INTRUSION = 0x11,
|
SENSORS_FEATURE_INTRUSION = 0x11,
|
||||||
SENSORS_FEATURE_MAX_OTHER,
|
SENSORS_FEATURE_MAX_OTHER,
|
||||||
SENSORS_FEATURE_BEEP_ENABLE = 0x18,
|
SENSORS_FEATURE_BEEP_ENABLE = 0x18,
|
||||||
|
SENSORS_FEATURE_FREQ,
|
||||||
SENSORS_FEATURE_MAX,
|
SENSORS_FEATURE_MAX,
|
||||||
SENSORS_FEATURE_UNKNOWN = INT_MAX,
|
SENSORS_FEATURE_UNKNOWN = INT_MAX,
|
||||||
} sensors_feature_type;
|
} sensors_feature_type;
|
||||||
@@ -251,6 +252,7 @@ typedef enum sensors_subfeature_type {
|
|||||||
|
|
||||||
SENSORS_SUBFEATURE_BEEP_ENABLE = SENSORS_FEATURE_BEEP_ENABLE << 8,
|
SENSORS_SUBFEATURE_BEEP_ENABLE = SENSORS_FEATURE_BEEP_ENABLE << 8,
|
||||||
|
|
||||||
|
SENSORS_SUBFEATURE_FREQ_INPUT = SENSORS_FEATURE_FREQ << 8,
|
||||||
SENSORS_SUBFEATURE_UNKNOWN = INT_MAX,
|
SENSORS_SUBFEATURE_UNKNOWN = INT_MAX,
|
||||||
} sensors_subfeature_type;
|
} sensors_subfeature_type;
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ int get_type_scaling(sensors_subfeature_type type)
|
|||||||
return 1;
|
return 1;
|
||||||
case SENSORS_SUBFEATURE_POWER_AVERAGE:
|
case SENSORS_SUBFEATURE_POWER_AVERAGE:
|
||||||
case SENSORS_SUBFEATURE_ENERGY_INPUT:
|
case SENSORS_SUBFEATURE_ENERGY_INPUT:
|
||||||
|
case SENSORS_SUBFEATURE_FREQ_INPUT:
|
||||||
return 1000000;
|
return 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,6 +182,7 @@ char *get_feature_name(sensors_feature_type ftype, char *sfname)
|
|||||||
case SENSORS_FEATURE_CURR:
|
case SENSORS_FEATURE_CURR:
|
||||||
case SENSORS_FEATURE_HUMIDITY:
|
case SENSORS_FEATURE_HUMIDITY:
|
||||||
case SENSORS_FEATURE_INTRUSION:
|
case SENSORS_FEATURE_INTRUSION:
|
||||||
|
case SENSORS_FEATURE_FREQ:
|
||||||
underscore = strchr(sfname, '_');
|
underscore = strchr(sfname, '_');
|
||||||
name = strndup(sfname, underscore - sfname);
|
name = strndup(sfname, underscore - sfname);
|
||||||
if (!name)
|
if (!name)
|
||||||
@@ -329,6 +331,11 @@ static const struct subfeature_type_match intrusion_matches[] = {
|
|||||||
{ "beep", SENSORS_SUBFEATURE_INTRUSION_BEEP },
|
{ "beep", SENSORS_SUBFEATURE_INTRUSION_BEEP },
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct subfeature_type_match freq_matches[] = {
|
||||||
|
{ "input", SENSORS_SUBFEATURE_FREQ_INPUT },
|
||||||
|
{ NULL, 0 }
|
||||||
|
};
|
||||||
static struct feature_type_match matches[] = {
|
static struct feature_type_match matches[] = {
|
||||||
{ "temp%d%c", temp_matches },
|
{ "temp%d%c", temp_matches },
|
||||||
{ "in%d%c", in_matches },
|
{ "in%d%c", in_matches },
|
||||||
@@ -339,6 +346,7 @@ static struct feature_type_match matches[] = {
|
|||||||
{ "energy%d%c", energy_matches },
|
{ "energy%d%c", energy_matches },
|
||||||
{ "intrusion%d%c", intrusion_matches },
|
{ "intrusion%d%c", intrusion_matches },
|
||||||
{ "humidity%d%c", humidity_matches },
|
{ "humidity%d%c", humidity_matches },
|
||||||
|
{ "freq%d%c", freq_matches },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Return the subfeature type and channel number based on the subfeature
|
/* Return the subfeature type and channel number based on the subfeature
|
||||||
|
|||||||
@@ -833,6 +833,33 @@ static void print_chip_curr(const sensors_chip_name *name,
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_chip_freq(const sensors_chip_name *name,
|
||||||
|
const sensors_feature *feature,
|
||||||
|
int label_size)
|
||||||
|
{
|
||||||
|
const sensors_subfeature *sf;
|
||||||
|
double val;
|
||||||
|
char *label;
|
||||||
|
|
||||||
|
if (!(label = sensors_get_label(name, feature))) {
|
||||||
|
fprintf(stderr, "ERROR: Can't get label of feature %s!\n",
|
||||||
|
feature->name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
print_label(label, label_size);
|
||||||
|
free(label);
|
||||||
|
|
||||||
|
sf = sensors_get_subfeature(name, feature,
|
||||||
|
SENSORS_SUBFEATURE_FREQ_INPUT);
|
||||||
|
if (sf && get_input_value(name, sf, &val) == 0) {
|
||||||
|
printf("%4.0f %s", val, "MHz");
|
||||||
|
} else {
|
||||||
|
printf(" N/A ");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
static void print_chip_intrusion(const sensors_chip_name *name,
|
static void print_chip_intrusion(const sensors_chip_name *name,
|
||||||
const sensors_feature *feature,
|
const sensors_feature *feature,
|
||||||
int label_size)
|
int label_size)
|
||||||
@@ -894,6 +921,9 @@ void print_chip(const sensors_chip_name *name)
|
|||||||
case SENSORS_FEATURE_HUMIDITY:
|
case SENSORS_FEATURE_HUMIDITY:
|
||||||
print_chip_humidity(name, feature, label_size);
|
print_chip_humidity(name, feature, label_size);
|
||||||
break;
|
break;
|
||||||
|
case SENSORS_FEATURE_FREQ:
|
||||||
|
print_chip_freq(name, feature, label_size);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user