Yet more library and prog/sensors stuff. LM75 data is now printed!

* Added sensors_get_algorithm_name and sensors_get_adapter_name to the
  library.
* First application of sensors_get_value is very encouraging; LM75 data is
  now printed.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@103 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Frodo Looijaard committed 1998-12-22 17:41:43 +00:00
1 parent c9d9c6c682
commit 6ad35eaa33
4 files changed
+51 -10

No files matched your search

+24 -2
View File
@@ -140,7 +140,7 @@ int sensors_get_label(sensors_chip_name name, int feature, char **result)
for (chip = NULL; (chip = sensors_for_all_config_chips(name,chip));)
for (i = 0; i < chip->labels_count; i++)
if (!strcmp(featureptr->name, chip->labels[i].name)) {
if (! (*result = strdup(chip->labels[i].name)))
if (! (*result = strdup(chip->labels[i].value)))
sensors_fatal_error("sensors_get_label","Allocating label text");
return 0;
}
@@ -182,7 +182,7 @@ int sensors_get_feature(sensors_chip_name name, int feature, double *result)
/* Set the value of a feature of a certain chip. Note that chip should not
contain wildcard values! This function will return 0 on success, and <0
on failure. */
int sensors_set_value(sensors_chip_name name, int feature, double value)
int sensors_set_feature(sensors_chip_name name, int feature, double value)
{
sensors_chip_feature *featureptr;
sensors_chip *chip;
@@ -214,3 +214,25 @@ const sensors_chip_name *sensors_get_detected_chips (int *nr)
(*nr)++;
return res;
}
const char *sensors_get_adapter_name(int bus_nr)
{
int i;
if (bus_nr == SENSORS_CHIP_NAME_BUS_ISA)
return "ISA adapter";
for (i=0; i < sensors_proc_bus_count; i++)
if (sensors_proc_bus[i].number == bus_nr)
return sensors_proc_bus[i].adapter;
return NULL;
}
const char *sensors_get_algorithm_name(int bus_nr)
{
int i;
if (bus_nr == SENSORS_CHIP_NAME_BUS_ISA)
return "ISA algorithm";
for (i=0; i < sensors_proc_bus_count; i++)
if (sensors_proc_bus[i].number == bus_nr)
return sensors_proc_bus[i].algorithm;
return NULL;
}
+8 -2
View File
@@ -60,6 +60,12 @@ extern int sensors_match_chip(sensors_chip_name chip1,
if there are wildcards. */
extern int sensors_chip_name_has_wildcards(sensors_chip_name chip);
/* These functions return the adapter and algorithm names of a bus number,
as used within the sensors_chip_name structure. If it could not be found,
it returns NULL */
extern const char *sensors_get_adapter_name(int bus_nr);
extern const char *sensors_get_algorithm_name(int bus_nr);
/* Look up the label which belongs to this chip. Note that chip should not
contain wildcard values! *result is newly allocated (free it yourself).
This function will return 0 on success, and <0 on failure. */
@@ -75,8 +81,8 @@ extern int sensors_get_feature(sensors_chip_name name, int feature,
/* Set the value of a feature of a certain chip. Note that chip should not
contain wildcard values! This function will return 0 on success, and <0
on failure. */
extern int sensors_set_value(sensors_chip_name name, int feature,
double value);
extern int sensors_set_feature(sensors_chip_name name, int feature,
double value);
/* This function returns all detected chips, one by one. To start at the
beginning of the list, use 0 for nr; NULL is returned if we are