diff --git a/lib/sysfs.c b/lib/sysfs.c index 9d66cf65..f9d28eb3 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -37,9 +37,9 @@ char sensors_sysfs_mount[NAME_MAX]; #define MAX_SENSORS_PER_TYPE 16 -#define MAX_SUB_FEATURES 22 +#define MAX_SUB_FEATURES 6 /* Room for all 3 types (in, fan, temp) with all their subfeatures + VID */ -#define ALL_POSSIBLE_FEATURES (MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 3 \ +#define ALL_POSSIBLE_FEATURES (MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6 \ + MAX_SENSORS_PER_TYPE) static @@ -120,11 +120,12 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* "calculate" a place to store the feature in our sparse, sorted table */ if (type == SENSORS_FEATURE_VID) { - i = nr + MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 3; + i = nr + MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6; } else { i = (type >> 8) * MAX_SENSORS_PER_TYPE * - MAX_SUB_FEATURES + nr * MAX_SUB_FEATURES + - (type & 0xFF); + MAX_SUB_FEATURES * 2 + nr * MAX_SUB_FEATURES * 2 + + ((type & 0x10) >> 4) * MAX_SUB_FEATURES + + (type & 0x0F); } if (features[i].data.name) { @@ -144,7 +145,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, feature.data.mapping = SENSORS_NO_MAPPING; } else { /* sub feature */ - feature.data.mapping = i - i % MAX_SUB_FEATURES; + feature.data.mapping = i - i % (MAX_SUB_FEATURES * 2); if (!(type & 0x10)) feature.data.flags |= SENSORS_COMPUTE_MAPPING; }