Changeset 4554

Show
Ignore:
Timestamp:
07/05/07 18:09:40 (1 year ago)
Author:
khali
Message:

Add support for multiple VID values. Untested as I don't have a chip with
multiple VIDs, but these exist. This closes ticket #2223.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/branches/lm-sensors-3.0.0/lib/sensors.h

    r4543 r4554  
    146146 
    147147/* This enum contains some "magic" used by sensors_read_dynamic_chip() from 
    148    lib/sysfs.c . All the sensor-types (in, fan, temp, misc) are a multiple of 
     148   lib/sysfs.c. All the sensor types (in, fan, temp, vid) are a multiple of 
    149149   0x100 apart, and sensor features which should not have a compute_mapping to 
    150150   the _input feature start at 0x?10. */ 
  • lm-sensors/branches/lm-sensors-3.0.0/lib/sysfs.c

    r4553 r4554  
    6767        struct dlist *attrs; 
    6868        /* room for all 3  (in, fan, temp) types, with all their subfeatures 
    69            + misc features. We use a large sparse table at first to store all 
     69           + VID. We use a large sparse table at first to store all 
    7070           found features, so that we can store them sorted at type and index 
    7171           and then later create a dense sorted table */ 
    7272        sensors_chip_feature features[MAX_SENSORS_PER_TYPE * 
    7373                SENSORS_FEATURE_MAX_SUB_FEATURES * 3 + 
    74                 SENSORS_FEATURE_MAX_SUB_FEATURES]; 
     74                MAX_SENSORS_PER_TYPE]; 
    7575        sensors_chip_feature *dyn_features; 
    7676        char *name; 
     
    106106                } 
    107107                         
    108                 /* Get N as in this is the N-th in / fan / temp sensor */ 
     108                /* Get N as in this is the N-th in / fan / temp / vid */ 
    109109                switch (type & 0xFF00) { 
    110110                        case SENSORS_FEATURE_IN: 
     
    119119                                if (i) i--; 
    120120                                break; 
    121                         case SENSORS_FEATURE_VID: /* first misc feature */ 
    122                                 i = 0
     121                        case SENSORS_FEATURE_VID: 
     122                                i = strtol(name + 3, NULL, 10)
    123123                                break; 
    124124                } 
     
    134134                /* "calculate" a place to store the feature in our sparse, 
    135135                   sorted table */ 
    136                 i = (type >> 8) * MAX_SENSORS_PER_TYPE * 
    137                         SENSORS_FEATURE_MAX_SUB_FEATURES + 
    138                         i * SENSORS_FEATURE_MAX_SUB_FEATURES + (type & 0xFF); 
     136                if (type == SENSORS_FEATURE_VID) { 
     137                        i += MAX_SENSORS_PER_TYPE * 
     138                             SENSORS_FEATURE_MAX_SUB_FEATURES * 3; 
     139                } else { 
     140                        i = (type >> 8) * MAX_SENSORS_PER_TYPE * 
     141                                SENSORS_FEATURE_MAX_SUB_FEATURES + 
     142                                i * SENSORS_FEATURE_MAX_SUB_FEATURES + 
     143                                (type & 0xFF); 
     144                } 
    139145                 
    140146                if (features[i].data.name) {                     
     
    149155                feature.data.number = i + 1; 
    150156                         
    151                 if ( (type & 0xFF00) == SENSORS_FEATURE_VID || 
    152                                 (type & 0x00FF) == 0) { 
    153                         /* misc sensor or main feature */ 
     157                if ((type & 0x00FF) == 0) { 
     158                        /* main feature */ 
    154159                        feature.data.mapping = SENSORS_NO_MAPPING; 
    155160                        feature.data.compute_mapping = SENSORS_NO_MAPPING;