Changeset 4679
- Timestamp:
- 08/16/07 19:49:50 (1 year ago)
- Files:
-
- lm-sensors/trunk/lib/data.c (modified) (10 diffs)
- lm-sensors/trunk/lib/sensors.h (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lm-sensors/trunk/lib/data.c
r4098 r4679 64 64 address, and '10dd' any hexadecimal isa address. 65 65 66 If '*' is used in prefixes, together with dashes, ambig ious parses are66 If '*' is used in prefixes, together with dashes, ambiguous parses are 67 67 introduced. In that case, the prefix is kept as small as possible. 68 68 … … 82 82 /* Play it safe */ 83 83 res->busname = NULL; 84 84 85 85 if (! name) 86 86 sensors_fatal_error("sensors_parse_chip_name","Allocating new name"); … … 90 90 if ((part3 = strrchr(name,'-'))) 91 91 *part3++ = '\0'; 92 if ((part2 = strrchr(name,'-'))) 92 if ((part2 = strrchr(name,'-'))) 93 93 *part2++ = '\0'; 94 94 … … 100 100 res->addr = SENSORS_CHIP_NAME_ADDR_ANY; 101 101 goto SUCCES; 102 } else 102 } else 103 103 goto ERROR; 104 104 } … … 111 111 goto ERROR; 112 112 res->addr = 0; 113 for (i = 0; ; i++) { 113 for (i = 0; ; i++) { 114 114 switch (part4[i]) { 115 115 case '0': case '1': case '2': case '3': case '4': … … 155 155 goto ERROR; 156 156 res->bus = 0; 157 for (i = 0; ; i++) { 157 for (i = 0; ; i++) { 158 158 switch (part3[i]) { 159 159 case '0': case '1': case '2': case '3': case '4': … … 179 179 } else 180 180 goto ERROR; 181 181 182 182 if (!strcmp(name,"*")) 183 183 res->prefix = SENSORS_CHIP_NAME_PREFIX_ANY; 184 184 else if (! (res->prefix = strdup(name))) 185 sensors_fatal_error("sensors_parse_chip_name", "Allocating new name");185 sensors_fatal_error("sensors_parse_chip_name", "Allocating name prefix"); 186 186 goto SUCCES; 187 187 … … 211 211 return -SENSORS_ERR_BUS_NAME; 212 212 *res = 0; 213 for (i = 0; ; i++) { 213 for (i = 0; ; i++) { 214 214 switch (name[i]) { 215 215 case '0': case '1': case '2': case '3': case '4': … … 256 256 } 257 257 258 258 259 259 int sensors_substitute_busses(void) 260 260 { … … 262 262 sensors_chip_name_list *chips; 263 263 int res=0; 264 264 265 265 for(i = 0; i < sensors_config_chips_count; i++) { 266 266 lineno = sensors_config_chips[i].lineno; lm-sensors/trunk/lib/sensors.h
r4641 r4679 37 37 #endif /* __cplusplus */ 38 38 39 /* A chip name is encoded i s in this structure */39 /* A chip name is encoded in this structure */ 40 40 typedef struct sensors_chip_name { 41 41 char *prefix; … … 45 45 } sensors_chip_name; 46 46 47 /* (Re)load the configuration file and the detected chips list. If this 47 /* (Re)load the configuration file and the detected chips list. If this 48 48 returns a value unequal to zero, you are in trouble; you can not 49 49 assume anything will be initialized properly. */ … … 54 54 extern void sensors_cleanup(void); 55 55 56 /* Parse a chip name to the internal representation. Return 0 on succes , <056 /* Parse a chip name to the internal representation. Return 0 on success, <0 57 57 on error. */ 58 58 extern int sensors_parse_chip_name(const char *orig_name, … … 61 61 /* Compare two chips name descriptions, to see whether they could match. 62 62 Return 0 if it does not match, return 1 if it does match. */ 63 extern int sensors_match_chip(sensors_chip_name chip1, 63 extern int sensors_match_chip(sensors_chip_name chip1, 64 64 sensors_chip_name chip2); 65 65 … … 70 70 71 71 /* This function returns the adapter name of a bus number, 72 as used within the sensors_chip_name structure. If it could not be found, 72 as used within the sensors_chip_name structure. If it could not be found, 73 73 it returns NULL */ 74 74 extern const char *sensors_get_adapter_name(int bus_nr); … … 81 81 This function will return 0 on success, and <0 on failure. This 82 82 function takes logical mappings into account. */ 83 extern int sensors_get_label(sensors_chip_name name, int feature, 83 extern int sensors_get_label(sensors_chip_name name, int feature, 84 84 char **result); 85 85 … … 111 111 /* This function returns all detected chips, one by one. To start at the 112 112 beginning of the list, use 0 for nr; NULL is returned if we are 113 at the end of the list. Do not try to change these chip names, as 113 at the end of the list. Do not try to change these chip names, as 114 114 they point to internal structures! Do not use nr for anything else. */ 115 115 extern const sensors_chip_name *sensors_get_detected_chips(int *nr); … … 136 136 } sensors_feature_data; 137 137 138 /* This returns all features of a specific chip. They are returned in 138 /* This returns all features of a specific chip. They are returned in 139 139 bunches: everything with the same mapping is returned just after each 140 140 other, with the master feature in front (that feature does not map to … … 144 144 Do not try to change the returned structure; you will corrupt internal 145 145 data structures. */ 146 extern const sensors_feature_data *sensors_get_all_features 146 extern const sensors_feature_data *sensors_get_all_features 147 147 (sensors_chip_name name, int *nr1,int *nr2); 148 148
