diff --git a/CHANGES b/CHANGES index 33f9d1eb..e53399b6 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ lm_sensors CHANGES file SVN HEAD Library: Add support for the pc87247 driver (fans only) Probe for busses before chips + Drop support for algorithm names Man page sensors.1: Update (option -c) and clean up Module icspll: Delete. It was useless and dangerous. Program sensord: Add pc87247 support (fans only) diff --git a/lib/access.c b/lib/access.c index b8e97d20..1e03f2ec 100644 --- a/lib/access.c +++ b/lib/access.c @@ -317,20 +317,10 @@ const char *sensors_get_adapter_name(int bus_nr) return NULL; } +/* This function is deprecated and will be dropped soon. */ const char *sensors_get_algorithm_name(int bus_nr) { - int i; - - if (bus_nr == SENSORS_CHIP_NAME_BUS_ISA) - return "ISA algorithm"; - if (bus_nr == SENSORS_CHIP_NAME_BUS_PCI) - return "PCI algorithm"; - if (bus_nr == SENSORS_CHIP_NAME_BUS_DUMMY) - return "Dummy 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; + return "No longer available"; } /* nr1-1 is the last main feature found; nr2-1 is the last subfeature found */ diff --git a/lib/conf-parse.y b/lib/conf-parse.y index ee22e7af..5ae50e58 100644 --- a/lib/conf-parse.y +++ b/lib/conf-parse.y @@ -134,6 +134,7 @@ input: /* empty */ ; line: bus_statement EOL + | busalgo_statement EOL | label_statement EOL | set_statement EOL | chip_statement EOL @@ -142,16 +143,26 @@ line: bus_statement EOL | error EOL ; -bus_statement: BUS i2cbus_name adapter_name algorithm_name +bus_statement: BUS i2cbus_name adapter_name { sensors_bus new_el; new_el.lineno = $1; new_el.number = $2; new_el.adapter = $3; - new_el.algorithm = $4; bus_add_el(&new_el); } ; +/* for compatibility, deprecated */ +busalgo_statement: BUS i2cbus_name adapter_name algorithm_name + { sensors_bus new_el; + new_el.lineno = $1; + new_el.number = $2; + new_el.adapter = $3; + free($4); + bus_add_el(&new_el); + } +; + label_statement: LABEL function_name string { sensors_label new_el; check_current_chip(); diff --git a/lib/data.h b/lib/data.h index 1f75ff9b..ac4c652b 100644 --- a/lib/data.h +++ b/lib/data.h @@ -111,11 +111,10 @@ typedef struct sensors_chip { } sensors_chip; /* Config file bus declaration: the i2c bus number, combined with adapter - and algorithm names */ + name */ typedef struct sensors_bus { int number; char *adapter; - char *algorithm; int lineno; } sensors_bus; diff --git a/lib/init.c b/lib/init.c index bbf4d768..a62d609b 100644 --- a/lib/init.c +++ b/lib/init.c @@ -103,7 +103,6 @@ void free_chip_name(sensors_chip_name name) void free_bus(sensors_bus bus) { free(bus.adapter); - free(bus.algorithm); } void free_chip(sensors_chip chip) diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 6aba6d5e..ae8a71ea 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -24,9 +24,9 @@ .\" .\" References consulted: .\" libsensors source code -.TH libsensors 3 "December 30, 1998" "" "Linux Programmer's Manual" +.TH libsensors 3 "October 2006" "" "Linux Programmer's Manual" .SH NAME -libsensors \- publically accessible functions provided by the sensors library +libsensors \- publicly accessible functions provided by the sensors library .SH SYNOPSIS .nf .B #include @@ -39,7 +39,6 @@ libsensors \- publically accessible functions provided by the sensors library \fBsensors_chip_name chip2);\fP .B int sensors_chip_name_has_wildcards(sensors_chip_name chip); .B const char *sensors_get_adapter_name(int bus_nr); -.B const char *sensors_get_algorithm_name(int bus_nr); .B int sensors_get_label(sensors_chip_name name, int feature, \fBchar **result);\fP .B int sensors_get_feature(sensors_chip_name name, int feature, @@ -79,9 +78,14 @@ Check whether the chip name is an 'absolute' name, which can only match one chip .B const char *sensors_get_adapter_name(int bus_nr); .br +This function returns the adapter name of a bus number, as used within the +sensors_chip_name structure. If it could not be found, it returns NULL. + .B const char *sensors_get_algorithm_name(int bus_nr); .br -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 +This function used to return the algorithm name of a bus number. +It is now deprecated and returns an arbitrary string. It will be dropped +in a later version of the library so you should stop using it. \fBint sensors_get_label(sensors_chip_name name, int feature, char **result);\fP diff --git a/lib/proc.c b/lib/proc.c index 26b1353e..d3f0ce8b 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -94,8 +94,7 @@ int sensors_read_proc_bus(void) line[strlen(line)-1] = '\0'; if (! (border = rindex(line,'\t'))) goto ERROR; - if (! (entry.algorithm = strdup(border+1))) - goto FAT_ERROR; + /* Skip algorithm name */ *border='\0'; if (! (border = rindex(line,'\t'))) goto ERROR; @@ -109,7 +108,6 @@ int sensors_read_proc_bus(void) goto ERROR; if (sensors_parse_i2cbus_name(line,&entry.number)) goto ERROR; - sensors_strip_of_spaces(entry.algorithm); sensors_strip_of_spaces(entry.adapter); sensors_add_proc_bus(&entry); lineno++; diff --git a/lib/sensors.conf.5 b/lib/sensors.conf.5 index f5b80ded..6de5905b 100644 --- a/lib/sensors.conf.5 +++ b/lib/sensors.conf.5 @@ -23,7 +23,7 @@ .\" .\" References consulted: .\" sensors.conf.eg by Frodo Looijaard -.TH sensors.conf 5 "February 8, 1999" "" "Linux Programmer's Manual" +.TH sensors.conf 5 "October 2006" "" "Linux Programmer's Manual" .SH NAME sensors.conf \- libsensors configuration file @@ -124,7 +124,7 @@ accompanied by an example line. Please ignore line wrap\-arounds. .SS BUS STATEMENT .RS -bus "i2c\-0" "SMBus PIIX4 adapter at e800" "Non\-I2C SMBus adapter" +bus "i2c\-0" "SMBus PIIX4 adapter at e800" .RE A @@ -139,12 +139,18 @@ The first argument is the bus number. It is the literal text followed by a number. As there is a dash in this argument, it must always be quoted. -The second and third arguments are the -description texts. They must be exactly match the texts as they appear in -.IR /proc/bus/i2c , -except for trailing spaces, which are removed both from the /proc -entries and the arguments. The adapter description comes first, followed -by the algorithm description. +The second argument is the adapter name, it must match exactly the +adapter name as it appears in +.I /proc/bus/i2c +(2.4 kernel) +or +.I /sys/class/i2c-adapter/i2c-*/device/name +(2.6 kernel). +It should always be quoted as well as it will most certainly contain +spaces or dashes. + +There used to be a third argument, the algorithm name. For compatibility +reasons, the parser still accepts this third argument, but ignores it. The .I bus diff --git a/lib/sensors.h b/lib/sensors.h index a9df87e8..c0ec7481 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -68,10 +68,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, +/* This function returns the adapter name 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); + +/* This function is deprecated and will be dropped soon. */ extern const char *sensors_get_algorithm_name(int bus_nr); /* Look up the label which belongs to this chip. Note that chip should not diff --git a/lib/sysfs.c b/lib/sysfs.c index c040a26b..20177a31 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -207,15 +207,9 @@ int sensors_read_sysfs_bus(void) if (!strncmp(entry.adapter, "ISA ", 4)) { entry.number = SENSORS_CHIP_NAME_BUS_ISA; - entry.algorithm = strdup("ISA bus algorithm"); } else if (sscanf(clsdev->name, "i2c-%d", &entry.number) != 1) { entry.number = SENSORS_CHIP_NAME_BUS_DUMMY; - entry.algorithm = strdup("Dummy bus algorithm"); - } else - entry.algorithm = strdup("Unavailable from sysfs"); - - if (!entry.algorithm) - sensors_fatal_error(__FUNCTION__, "out of memory"); + } sensors_add_proc_bus(&entry); }