- Timestamp:
- 09/23/07 14:00:59 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/branches/lm-sensors-3.0.0/prog/sensors/chips.c
r4822 r4831 31 31 void print_chip_raw(const sensors_chip_name *name) 32 32 { 33 int a ;34 const sensors_feature_data * data;33 int a, b; 34 const sensors_feature_data *feature, *sub; 35 35 char *label; 36 36 double val; 37 37 38 38 a = 0; 39 while ((data = sensors_get_all_features(name, &a))) { 40 if (!(label = sensors_get_label(name, data->number))) { 41 printf("ERROR: Can't get feature `%s' label!\n", 42 data->name); 43 continue; 44 } 45 if (data->flags & SENSORS_MODE_R) { 46 if (sensors_get_value(name, data->number, &val)) 47 printf("ERROR: Can't get feature `%s' data!\n", 48 data->name); 49 else if (data->mapping != SENSORS_NO_MAPPING) 50 printf(" %s: %.2f\n", label, val); 51 else 52 printf("%s: %.2f (%s)\n", label, val, 53 data->name); 54 } else 55 printf("(%s)\n", label); 56 free(label); 39 while ((feature = sensors_get_features(name, &a))) { 40 b = 0; 41 while ((sub = sensors_get_all_subfeatures(name, feature->number, 42 &b))) { 43 if (!(label = sensors_get_label(name, sub->number))) { 44 printf("ERROR: Can't get feature `%s' label!\n", 45 sub->name); 46 continue; 47 } 48 if (sub->flags & SENSORS_MODE_R) { 49 if (sensors_get_value(name, sub->number, &val)) 50 printf("ERROR: Can't get feature `%s' " 51 "data!\n", sub->name); 52 else if (sub->mapping != SENSORS_NO_MAPPING) 53 printf(" %s: %.2f\n", label, val); 54 else 55 printf("%s: %.2f (%s)\n", label, val, 56 sub->name); 57 } else 58 printf("(%s)\n", label); 59 free(label); 60 } 57 61 } 58 62 } … … 71 75 static void sensors_get_available_features(const sensors_chip_name *name, 72 76 const sensors_feature_data *feature, 73 int i,short *has_features,77 short *has_features, 74 78 double *feature_vals, int size, 75 79 int first_val) 76 80 { 77 81 const sensors_feature_data *iter; 78 79 while ((iter = sensors_get_all_features(name, &i)) && 80 iter->mapping == feature->number) {82 int i = 0; 83 84 while ((iter = sensors_get_all_subfeatures(name, feature->number, &i))) { 81 85 int indx, err; 82 86 … … 105 109 106 110 i = 0; 107 while ((iter = sensors_get_all_features(name, &i))) { 108 if (iter->mapping != SENSORS_NO_MAPPING) 109 continue; 111 while ((iter = sensors_get_features(name, &i))) { 110 112 if ((label = sensors_get_label(name, iter->number)) && 111 113 strlen(label) > max_size) … … 142 144 #define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] 143 145 static void print_chip_temp(const sensors_chip_name *name, 144 const sensors_feature_data *feature, int i,146 const sensors_feature_data *feature, 145 147 int label_size) 146 148 { … … 164 166 } 165 167 166 sensors_get_available_features(name, feature, i,has_features,168 sensors_get_available_features(name, feature, has_features, 167 169 feature_vals, size, 168 170 SENSORS_FEATURE_TEMP); … … 280 282 #define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN - 1] 281 283 static void print_chip_in(const sensors_chip_name *name, 282 const sensors_feature_data *feature, int i,284 const sensors_feature_data *feature, 283 285 int label_size) 284 286 { … … 300 302 } 301 303 302 sensors_get_available_features(name, feature, i,has_features,304 sensors_get_available_features(name, feature, has_features, 303 305 feature_vals, size, SENSORS_FEATURE_IN); 304 306 … … 345 347 #define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN - 1] 346 348 static void print_chip_fan(const sensors_chip_name *name, 347 const sensors_feature_data *feature, int i,349 const sensors_feature_data *feature, 348 350 int label_size) 349 351 { … … 368 370 free(label); 369 371 370 sensors_get_available_features(name, feature, i,has_features,372 sensors_get_available_features(name, feature, has_features, 371 373 feature_vals, size, SENSORS_FEATURE_FAN); 372 374 … … 433 435 434 436 i = 0; 435 while ((feature = sensors_get_all_features(name, &i))) { 436 if (feature->mapping != SENSORS_NO_MAPPING) 437 continue; 438 437 while ((feature = sensors_get_features(name, &i))) { 439 438 switch (feature->type) { 440 439 case SENSORS_FEATURE_TEMP: 441 print_chip_temp(name, feature, i,label_size);440 print_chip_temp(name, feature, label_size); 442 441 break; 443 442 case SENSORS_FEATURE_IN: 444 print_chip_in(name, feature, i,label_size);443 print_chip_in(name, feature, label_size); 445 444 break; 446 445 case SENSORS_FEATURE_FAN: 447 print_chip_fan(name, feature, i,label_size);446 print_chip_fan(name, feature, label_size); 448 447 break; 449 448 case SENSORS_FEATURE_VID:
