mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-25 20:28:21 +00:00
-rewrite dyn chip code, it now uses sensors_feature_get_type() to
identify sysfs entries. Reasons for this rewrite / bugs fixed: -Don't give features like alarms / sensor type / fault flag a compute mapping only a normal mapping -Don't generate features for sysfs entries like uvent, modalias, etc. instead only generate features for features known by sensors_feature_get_type() -Sort the list of found features logically instead of sorted in alphabet order of the sysfs entry. So now it starts with all in entries, then all fan and then all temp. Just like the order of most entries in lib/chips.c. Also this means that it now contains in0 - in10 in that order and not in0, in10, in1 - in9 git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4368 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
16408d8665
commit
bd74aa2390
4 files changed
+140
-127
No files matched your search
+11
-12
@@ -515,27 +515,24 @@ struct feature_type_match
|
||||
};
|
||||
|
||||
static struct feature_type_match temp_matches[] = {
|
||||
{ "max", SENSORS_FEATURE_TEMP_MAX },
|
||||
{ "min", SENSORS_FEATURE_TEMP_MIN },
|
||||
{ "type", SENSORS_FEATURE_TEMP_SENS },
|
||||
{ "hyst", SENSORS_FEATURE_TEMP_HYST },
|
||||
{ "over", SENSORS_FEATURE_TEMP_OVER },
|
||||
{ "max", SENSORS_FEATURE_TEMP_MAX },
|
||||
{ "min", SENSORS_FEATURE_TEMP_MIN },
|
||||
{ "low", SENSORS_FEATURE_TEMP_LOW },
|
||||
{ "crit", SENSORS_FEATURE_TEMP_CRIT },
|
||||
{ "fault", SENSORS_FEATURE_TEMP_FAULT },
|
||||
{ "alarm", SENSORS_FEATURE_TEMP_ALARM },
|
||||
{ "fault", SENSORS_FEATURE_TEMP_FAULT },
|
||||
{ "type", SENSORS_FEATURE_TEMP_SENS },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static struct feature_type_match in_matches[] = {
|
||||
{ "max", SENSORS_FEATURE_IN_MAX },
|
||||
{ "max_alarm", SENSORS_FEATURE_IN_MAX_ALARM },
|
||||
{ "min", SENSORS_FEATURE_IN_MIN },
|
||||
{ "min_alarm", SENSORS_FEATURE_IN_MIN_ALARM },
|
||||
{ "max", SENSORS_FEATURE_IN_MAX },
|
||||
{ "alarm", SENSORS_FEATURE_IN_ALARM },
|
||||
{ "min_alarm", SENSORS_FEATURE_IN_MIN_ALARM },
|
||||
{ "max_alarm", SENSORS_FEATURE_IN_MAX_ALARM },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
@@ -562,10 +559,11 @@ sensors_feature_type sensors_feature_get_type(
|
||||
const sensors_feature_data *feature)
|
||||
{
|
||||
const char *name;
|
||||
regex_t preg;
|
||||
regmatch_t pmatch[4];
|
||||
int size_first, size_second, retval, i;
|
||||
struct feature_type_match *submatches;
|
||||
static regex_t reg;
|
||||
static regex_t *preg = NULL;
|
||||
|
||||
/* use sysname if exists */
|
||||
if (container_of(feature, const struct sensors_chip_feature, data)->sysname)
|
||||
@@ -573,11 +571,12 @@ sensors_feature_type sensors_feature_get_type(
|
||||
else
|
||||
name = feature->name;
|
||||
|
||||
regcomp(&preg, GET_TYPE_REGEX, 0);
|
||||
if (!preg) {
|
||||
regcomp(®, GET_TYPE_REGEX, 0);
|
||||
preg = ®
|
||||
}
|
||||
|
||||
retval = regexec(&preg, name, 4, pmatch, 0);
|
||||
|
||||
regfree(&preg);
|
||||
retval = regexec(preg, name, 4, pmatch, 0);
|
||||
|
||||
if (retval == -1)
|
||||
return SENSORS_FEATURE_UNKNOWN;
|
||||
|
||||
Reference in new issue
Block a user