mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-09-03 15:55:15 +00:00
libsensors: Drop support for algorithm names.
I2C algorithms no longer have names in Linux 2.6, and anyway they are implementation details user-space doesn't care about. No third party application is known to have ever used this particular feature of libsensors. "sensord" and "sensors" no longer do. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4208 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -4,6 +4,7 @@ lm_sensors CHANGES file
|
|||||||
SVN HEAD
|
SVN HEAD
|
||||||
Library: Add support for the pc87247 driver (fans only)
|
Library: Add support for the pc87247 driver (fans only)
|
||||||
Probe for busses before chips
|
Probe for busses before chips
|
||||||
|
Drop support for algorithm names
|
||||||
Man page sensors.1: Update (option -c) and clean up
|
Man page sensors.1: Update (option -c) and clean up
|
||||||
Module icspll: Delete. It was useless and dangerous.
|
Module icspll: Delete. It was useless and dangerous.
|
||||||
Program sensord: Add pc87247 support (fans only)
|
Program sensord: Add pc87247 support (fans only)
|
||||||
|
14
lib/access.c
14
lib/access.c
@@ -317,20 +317,10 @@ const char *sensors_get_adapter_name(int bus_nr)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function is deprecated and will be dropped soon. */
|
||||||
const char *sensors_get_algorithm_name(int bus_nr)
|
const char *sensors_get_algorithm_name(int bus_nr)
|
||||||
{
|
{
|
||||||
int i;
|
return "No longer available";
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nr1-1 is the last main feature found; nr2-1 is the last subfeature found */
|
/* nr1-1 is the last main feature found; nr2-1 is the last subfeature found */
|
||||||
|
@@ -134,6 +134,7 @@ input: /* empty */
|
|||||||
;
|
;
|
||||||
|
|
||||||
line: bus_statement EOL
|
line: bus_statement EOL
|
||||||
|
| busalgo_statement EOL
|
||||||
| label_statement EOL
|
| label_statement EOL
|
||||||
| set_statement EOL
|
| set_statement EOL
|
||||||
| chip_statement EOL
|
| chip_statement EOL
|
||||||
@@ -142,12 +143,22 @@ line: bus_statement EOL
|
|||||||
| error EOL
|
| error EOL
|
||||||
;
|
;
|
||||||
|
|
||||||
bus_statement: BUS i2cbus_name adapter_name algorithm_name
|
bus_statement: BUS i2cbus_name adapter_name
|
||||||
{ sensors_bus new_el;
|
{ sensors_bus new_el;
|
||||||
new_el.lineno = $1;
|
new_el.lineno = $1;
|
||||||
new_el.number = $2;
|
new_el.number = $2;
|
||||||
new_el.adapter = $3;
|
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);
|
bus_add_el(&new_el);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
@@ -111,11 +111,10 @@ typedef struct sensors_chip {
|
|||||||
} sensors_chip;
|
} sensors_chip;
|
||||||
|
|
||||||
/* Config file bus declaration: the i2c bus number, combined with adapter
|
/* Config file bus declaration: the i2c bus number, combined with adapter
|
||||||
and algorithm names */
|
name */
|
||||||
typedef struct sensors_bus {
|
typedef struct sensors_bus {
|
||||||
int number;
|
int number;
|
||||||
char *adapter;
|
char *adapter;
|
||||||
char *algorithm;
|
|
||||||
int lineno;
|
int lineno;
|
||||||
} sensors_bus;
|
} sensors_bus;
|
||||||
|
|
||||||
|
@@ -103,7 +103,6 @@ void free_chip_name(sensors_chip_name name)
|
|||||||
void free_bus(sensors_bus bus)
|
void free_bus(sensors_bus bus)
|
||||||
{
|
{
|
||||||
free(bus.adapter);
|
free(bus.adapter);
|
||||||
free(bus.algorithm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_chip(sensors_chip chip)
|
void free_chip(sensors_chip chip)
|
||||||
|
@@ -24,9 +24,9 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" References consulted:
|
.\" References consulted:
|
||||||
.\" libsensors source code
|
.\" libsensors source code
|
||||||
.TH libsensors 3 "December 30, 1998" "" "Linux Programmer's Manual"
|
.TH libsensors 3 "October 2006" "" "Linux Programmer's Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libsensors \- publically accessible functions provided by the sensors library
|
libsensors \- publicly accessible functions provided by the sensors library
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
.B #include <sensors/sensors.h>
|
.B #include <sensors/sensors.h>
|
||||||
@@ -39,7 +39,6 @@ libsensors \- publically accessible functions provided by the sensors library
|
|||||||
\fBsensors_chip_name chip2);\fP
|
\fBsensors_chip_name chip2);\fP
|
||||||
.B int sensors_chip_name_has_wildcards(sensors_chip_name chip);
|
.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_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,
|
.B int sensors_get_label(sensors_chip_name name, int feature,
|
||||||
\fBchar **result);\fP
|
\fBchar **result);\fP
|
||||||
.B int sensors_get_feature(sensors_chip_name name, int feature,
|
.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);
|
.B const char *sensors_get_adapter_name(int bus_nr);
|
||||||
.br
|
.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);
|
.B const char *sensors_get_algorithm_name(int bus_nr);
|
||||||
.br
|
.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,
|
\fBint sensors_get_label(sensors_chip_name name, int feature,
|
||||||
char **result);\fP
|
char **result);\fP
|
||||||
|
@@ -94,8 +94,7 @@ int sensors_read_proc_bus(void)
|
|||||||
line[strlen(line)-1] = '\0';
|
line[strlen(line)-1] = '\0';
|
||||||
if (! (border = rindex(line,'\t')))
|
if (! (border = rindex(line,'\t')))
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
if (! (entry.algorithm = strdup(border+1)))
|
/* Skip algorithm name */
|
||||||
goto FAT_ERROR;
|
|
||||||
*border='\0';
|
*border='\0';
|
||||||
if (! (border = rindex(line,'\t')))
|
if (! (border = rindex(line,'\t')))
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
@@ -109,7 +108,6 @@ int sensors_read_proc_bus(void)
|
|||||||
goto ERROR;
|
goto ERROR;
|
||||||
if (sensors_parse_i2cbus_name(line,&entry.number))
|
if (sensors_parse_i2cbus_name(line,&entry.number))
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
sensors_strip_of_spaces(entry.algorithm);
|
|
||||||
sensors_strip_of_spaces(entry.adapter);
|
sensors_strip_of_spaces(entry.adapter);
|
||||||
sensors_add_proc_bus(&entry);
|
sensors_add_proc_bus(&entry);
|
||||||
lineno++;
|
lineno++;
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" References consulted:
|
.\" References consulted:
|
||||||
.\" sensors.conf.eg by Frodo Looijaard
|
.\" 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
|
.SH NAME
|
||||||
sensors.conf \- libsensors configuration file
|
sensors.conf \- libsensors configuration file
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ accompanied by an example line. Please ignore line wrap\-arounds.
|
|||||||
.SS BUS STATEMENT
|
.SS BUS STATEMENT
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
bus "i2c\-0" "SMBus PIIX4 adapter at e800" "Non\-I2C SMBus adapter"
|
bus "i2c\-0" "SMBus PIIX4 adapter at e800"
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
A
|
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
|
followed by a number. As there is a dash in this argument, it must
|
||||||
always be quoted.
|
always be quoted.
|
||||||
|
|
||||||
The second and third arguments are the
|
The second argument is the adapter name, it must match exactly the
|
||||||
description texts. They must be exactly match the texts as they appear in
|
adapter name as it appears in
|
||||||
.IR /proc/bus/i2c ,
|
.I /proc/bus/i2c
|
||||||
except for trailing spaces, which are removed both from the /proc
|
(2.4 kernel)
|
||||||
entries and the arguments. The adapter description comes first, followed
|
or
|
||||||
by the algorithm description.
|
.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
|
The
|
||||||
.I bus
|
.I bus
|
||||||
|
@@ -68,10 +68,12 @@ extern int sensors_match_chip(sensors_chip_name chip1,
|
|||||||
if there are wildcards. */
|
if there are wildcards. */
|
||||||
extern int sensors_chip_name_has_wildcards(sensors_chip_name chip);
|
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,
|
as used within the sensors_chip_name structure. If it could not be found,
|
||||||
it returns NULL */
|
it returns NULL */
|
||||||
extern const char *sensors_get_adapter_name(int bus_nr);
|
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);
|
extern const char *sensors_get_algorithm_name(int bus_nr);
|
||||||
|
|
||||||
/* Look up the label which belongs to this chip. Note that chip should not
|
/* Look up the label which belongs to this chip. Note that chip should not
|
||||||
|
@@ -207,15 +207,9 @@ int sensors_read_sysfs_bus(void)
|
|||||||
|
|
||||||
if (!strncmp(entry.adapter, "ISA ", 4)) {
|
if (!strncmp(entry.adapter, "ISA ", 4)) {
|
||||||
entry.number = SENSORS_CHIP_NAME_BUS_ISA;
|
entry.number = SENSORS_CHIP_NAME_BUS_ISA;
|
||||||
entry.algorithm = strdup("ISA bus algorithm");
|
|
||||||
} else if (sscanf(clsdev->name, "i2c-%d", &entry.number) != 1) {
|
} else if (sscanf(clsdev->name, "i2c-%d", &entry.number) != 1) {
|
||||||
entry.number = SENSORS_CHIP_NAME_BUS_DUMMY;
|
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);
|
sensors_add_proc_bus(&entry);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user