Changeset 103
- Timestamp:
- 12/22/98 18:41:43 (14 years ago)
- Location:
- lm-sensors/trunk
- Files:
-
- 4 modified
-
lib/access.c (modified) (3 diffs)
-
lib/sensors.h (modified) (2 diffs)
-
prog/sensors/Module.mk (modified) (2 diffs)
-
prog/sensors/main.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/lib/access.c
r102 r103 141 141 for (i = 0; i < chip->labels_count; i++) 142 142 if (!strcmp(featureptr->name, chip->labels[i].name)) { 143 if (! (*result = strdup(chip->labels[i]. name)))143 if (! (*result = strdup(chip->labels[i].value))) 144 144 sensors_fatal_error("sensors_get_label","Allocating label text"); 145 145 return 0; … … 183 183 contain wildcard values! This function will return 0 on success, and <0 184 184 on failure. */ 185 int sensors_set_ value(sensors_chip_name name, int feature, double value)185 int sensors_set_feature(sensors_chip_name name, int feature, double value) 186 186 { 187 187 sensors_chip_feature *featureptr; … … 215 215 return res; 216 216 } 217 218 const char *sensors_get_adapter_name(int bus_nr) 219 { 220 int i; 221 if (bus_nr == SENSORS_CHIP_NAME_BUS_ISA) 222 return "ISA adapter"; 223 for (i=0; i < sensors_proc_bus_count; i++) 224 if (sensors_proc_bus[i].number == bus_nr) 225 return sensors_proc_bus[i].adapter; 226 return NULL; 227 } 228 229 const char *sensors_get_algorithm_name(int bus_nr) 230 { 231 int i; 232 if (bus_nr == SENSORS_CHIP_NAME_BUS_ISA) 233 return "ISA algorithm"; 234 for (i=0; i < sensors_proc_bus_count; i++) 235 if (sensors_proc_bus[i].number == bus_nr) 236 return sensors_proc_bus[i].algorithm; 237 return NULL; 238 } -
lm-sensors/trunk/lib/sensors.h
r102 r103 61 61 extern int sensors_chip_name_has_wildcards(sensors_chip_name chip); 62 62 63 /* These functions return the adapter and algorithm names of a bus number, 64 as used within the sensors_chip_name structure. If it could not be found, 65 it returns NULL */ 66 extern const char *sensors_get_adapter_name(int bus_nr); 67 extern const char *sensors_get_algorithm_name(int bus_nr); 68 63 69 /* Look up the label which belongs to this chip. Note that chip should not 64 70 contain wildcard values! *result is newly allocated (free it yourself). … … 76 82 contain wildcard values! This function will return 0 on success, and <0 77 83 on failure. */ 78 extern int sensors_set_ value(sensors_chip_name name, int feature,79 double value);84 extern int sensors_set_feature(sensors_chip_name name, int feature, 85 double value); 80 86 81 87 /* This function returns all detected chips, one by one. To start at the -
lm-sensors/trunk/prog/sensors/Module.mk
r99 r103 24 24 # defined value verbatim into the command-list of rules... 25 25 PROGSENSORSTARGETS := $(MODULE_DIR)/sensors 26 PROGSENSORSSOURCES := $(MODULE_DIR)/main.c 26 PROGSENSORSSOURCES := $(MODULE_DIR)/main.c $(MODULE_DIR)/chips.c 27 27 28 28 # Include all dependency files. We use '.rd' to indicate this will create … … 31 31 32 32 $(PROGSENSORSTARGETS): $(PROGSENSORSSOURCES:.c=.ro) lib/$(LIBSHBASENAME) 33 $(CC) -o $@ $ ^-Llib -lsensors33 $(CC) -o $@ $(PROGSENSORSSOURCES:.c=.ro) -Llib -lsensors 34 34 35 35 all-prog-sensors: $(PROGSENSORSTARGETS) -
lm-sensors/trunk/prog/sensors/main.c
r102 r103 26 26 #include "lib/sensors.h" 27 27 #include "lib/error.h" 28 #include "chips.h" 28 29 29 30 #define PROGRAM "sensors" … … 122 123 int chip_nr; 123 124 const sensors_chip_name *chip; 125 const char *algo,*adap; 124 126 125 127 struct option long_opts[] = { … … 164 166 165 167 /* Here comes the real code... */ 166 printf("Detected chips:\n"); 167 for (chip_nr = 0; (chip = sensors_get_detected_chips(&chip_nr));) 168 for (chip_nr = 0; (chip = sensors_get_detected_chips(&chip_nr));) { 168 169 if (chip->bus == SENSORS_CHIP_NAME_BUS_ISA) 169 printf(" %s-isa-%04x\n",chip->prefix,chip->addr);170 printf("%s-isa-%04x\n",chip->prefix,chip->addr); 170 171 else 171 printf(" %s-i2c-%d-%02x\n",chip->prefix,chip->bus,chip->addr); 172 printf("%s-i2c-%d-%02x\n",chip->prefix,chip->bus,chip->addr); 173 adap = sensors_get_adapter_name(chip->bus); 174 if (adap) 175 printf("Adapter: %s\n",adap); 176 algo = sensors_get_algorithm_name(chip->bus); 177 if (algo) 178 printf("Algorithm: %s\n",algo); 179 if (!algo || !adap) 180 printf(" ERROR: Can't get adapter or algorithm?!?\n"); 181 if (!strcmp(chip->prefix,"lm75")) 182 print_lm75(chip); 183 printf("\n"); 184 } 172 185 exit(0); 173 186 }
