Changeset 4643
- Timestamp:
- 07/24/07 10:19:59 (6 years ago)
- Location:
- lm-sensors/branches/lm-sensors-3.0.0
- Files:
-
- 5 modified
-
lib/access.c (modified) (2 diffs)
-
lib/libsensors.3 (modified) (2 diffs)
-
lib/sensors.h (modified) (1 diff)
-
prog/sensors/chips.c (modified) (1 diff)
-
prog/sensors/chips_generic.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/branches/lm-sensors-3.0.0/lib/access.c
r4642 r4643 334 334 } 335 335 336 /* nr 1-1 is the last main feature found; nr2-1 is the last subfeature found */336 /* nr-1 is the last feature returned */ 337 337 const sensors_feature_data *sensors_get_all_features(sensors_chip_name name, 338 int *nr 1, int *nr2)338 int *nr) 339 339 { 340 340 sensors_chip_feature *feature_list; … … 344 344 if (sensors_match_chip(sensors_proc_chips[i].chip, name)) { 345 345 feature_list = sensors_proc_chips[i].feature; 346 if (!*nr1 && !*nr2) { /* Return the first entry */ 347 *nr1 = *nr2 = 1; 348 return &feature_list->data; 349 } 350 for ((*nr2)++; feature_list[*nr2 - 1].data.name; (*nr2)++) 351 if (feature_list[*nr2 - 1].data.mapping == 352 feature_list[*nr1 - 1].data.number) 353 return &((feature_list + *nr2 - 1)->data); 354 for ((*nr1)++; 355 feature_list[*nr1 - 1].data.name 356 && (feature_list[*nr1 - 1].data.mapping != 357 SENSORS_NO_MAPPING); (*nr1)++) ; 358 *nr2 = *nr1; 359 if (!feature_list[*nr1 - 1].data.name) 346 if (!feature_list[*nr].data.name) 360 347 return NULL; 361 return & ((feature_list + *nr1 - 1)->data);348 return &feature_list[(*nr)++].data; 362 349 } 363 350 return NULL; -
lm-sensors/branches/lm-sensors-3.0.0/lib/libsensors.3
r4629 r4643 50 50 .B const sensors_chip_name *sensors_get_detected_chips(int *nr); 51 51 .B const sensors_feature_data *sensors_get_all_features 52 \fB(sensors_chip_name name, int *nr 1,int *nr2);\fP52 \fB(sensors_chip_name name, int *nr);\fP 53 53 .B const char *libsensors_version; 54 54 .fi … … 134 134 135 135 \fBconst sensors_feature_data *sensors_get_all_features 136 (sensors_chip_name name, int *nr 1,int *nr2);\fP136 (sensors_chip_name name, int *nr);\fP 137 137 .br 138 This returns all features of a specific chip. They are returned in bunches: everything with the same mapping is returned just after each other, with the master feature in front (that feature does not map to itself, but has SENSORS_NO_MAPPING as mapping field). nr1 and nr2 are two internally used variables. Set both to zero to start again at the begin of the list. If no more features are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. 138 This returns all features of a specific chip. They are returned in bunches: 139 everything with the same mapping is returned just after each other, with 140 the master feature in front (that feature does not map to itself, but 141 has SENSORS_NO_MAPPING as mapping field). nr is an internally used variable. 142 Set it to zero to start again at the begin of the list. If no more features 143 are found NULL is returned. Do not try to change the returned structure; you 144 will corrupt internal data structures. 139 145 140 146 \fBconst char *libsensors_version;\fP -
lm-sensors/branches/lm-sensors-3.0.0/lib/sensors.h
r4629 r4643 180 180 bunches: everything with the same mapping is returned just after each 181 181 other, with the master feature in front (that feature does not map to 182 itself, but has SENSORS_NO_MAPPING as mapping field). nr 1 and nr2 are183 two internally used variables. Set bothto zero to start again at the182 itself, but has SENSORS_NO_MAPPING as mapping field). nr is 183 an internally used variable. Set it to zero to start again at the 184 184 begin of the list. If no more features are found NULL is returned. 185 185 Do not try to change the returned structure; you will corrupt internal 186 186 data structures. */ 187 187 extern const sensors_feature_data *sensors_get_all_features 188 (sensors_chip_name name, int *nr 1,int *nr2);188 (sensors_chip_name name, int *nr); 189 189 190 190 #ifdef __cplusplus -
lm-sensors/branches/lm-sensors-3.0.0/prog/sensors/chips.c
r4578 r4643 119 119 void print_unknown_chip(const sensors_chip_name *name) 120 120 { 121 int a, b,valid;121 int a, valid; 122 122 const sensors_feature_data *data; 123 123 char *label; 124 124 double val; 125 125 126 a =b=0;127 while((data=sensors_get_all_features(*name, &a,&b))) {126 a = 0; 127 while((data=sensors_get_all_features(*name, &a))) { 128 128 if (sensors_get_label_and_valid(*name,data->number,&label,&valid)) { 129 129 printf("ERROR: Can't get feature `%s' data!\n",data->name); -
lm-sensors/branches/lm-sensors-3.0.0/prog/sensors/chips_generic.c
r4639 r4643 36 36 static void sensors_get_available_features(const sensors_chip_name *name, 37 37 const sensors_feature_data *feature, 38 int i, int j,38 int i, 39 39 short *has_features, 40 40 double *feature_vals, … … 44 44 const sensors_feature_data *iter; 45 45 46 while((iter = sensors_get_all_features(*name, &i , &j)) &&46 while((iter = sensors_get_all_features(*name, &i)) && 47 47 iter->mapping == feature->number) { 48 48 int indx; … … 63 63 static int sensors_get_label_size(const sensors_chip_name *name) 64 64 { 65 int i, j,valid;65 int i, valid; 66 66 const sensors_feature_data *iter; 67 67 char *label; 68 68 unsigned int max_size = 11; /* Initialised to 11 as minumum label-width */ 69 69 70 i = j =0;71 while((iter = sensors_get_all_features(*name, &i , &j))) {70 i = 0; 71 while((iter = sensors_get_all_features(*name, &i))) { 72 72 if (!sensors_get_label_and_valid(*name, iter->number, &label, &valid) && 73 73 valid && strlen(label) > max_size) … … 90 90 static void print_generic_chip_temp(const sensors_chip_name *name, 91 91 const sensors_feature_data *feature, 92 int i, int j, intlabel_size)92 int i, int label_size) 93 93 { 94 94 double val, max, min; … … 114 114 } 115 115 116 sensors_get_available_features(name, feature, i, j, has_features,116 sensors_get_available_features(name, feature, i, has_features, 117 117 feature_vals, size, SENSORS_FEATURE_TEMP); 118 118 … … 208 208 static void print_generic_chip_in(const sensors_chip_name *name, 209 209 const sensors_feature_data *feature, 210 int i, int j, intlabel_size)210 int i, int label_size) 211 211 { 212 212 const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; … … 232 232 } 233 233 234 sensors_get_available_features(name, feature, i, j,has_features, feature_vals,234 sensors_get_available_features(name, feature, i, has_features, feature_vals, 235 235 size, SENSORS_FEATURE_IN); 236 236 … … 275 275 static void print_generic_chip_fan(const sensors_chip_name *name, 276 276 const sensors_feature_data *feature, 277 int i, int j, intlabel_size)277 int i, int label_size) 278 278 { 279 279 char *label; … … 309 309 printf("%4.0f RPM", val); 310 310 311 sensors_get_available_features(name, feature, i, j,has_features, feature_vals,311 sensors_get_available_features(name, feature, i, has_features, feature_vals, 312 312 size, SENSORS_FEATURE_FAN); 313 313 … … 333 333 { 334 334 const sensors_feature_data *feature; 335 int i, j,label_size;335 int i, label_size; 336 336 337 337 label_size = sensors_get_label_size(name); 338 338 339 i = j =0;340 while((feature = sensors_get_all_features(*name, &i , &j))) {339 i = 0; 340 while((feature = sensors_get_all_features(*name, &i))) { 341 341 if (feature->mapping != SENSORS_NO_MAPPING) 342 342 continue; … … 344 344 switch (feature->type) { 345 345 case SENSORS_FEATURE_TEMP: 346 print_generic_chip_temp(name, feature, i, j,label_size); break;346 print_generic_chip_temp(name, feature, i, label_size); break; 347 347 case SENSORS_FEATURE_IN: 348 print_generic_chip_in(name, feature, i, j,label_size); break;348 print_generic_chip_in(name, feature, i, label_size); break; 349 349 case SENSORS_FEATURE_FAN: 350 print_generic_chip_fan(name, feature, i, j,label_size); break;350 print_generic_chip_fan(name, feature, i, label_size); break; 351 351 case SENSORS_FEATURE_VID: 352 352 print_vid_info(name, feature->number, label_size); break;
