libsensors4: Don't substitute the isa bus
PATCH 3/6 libsensors4: Don't substitute the isa bus
Don't handle the isa bus in sensors_parse_i2cbus_name(). We really don't need to, as there is a single ISA bus, there's no need for substituting anything.
--- lib/data.c | 4 ---- lib/sysfs.c | 10 ++++------ 2 files changed, 4 insertions(+), 10 deletions(-)
lib/data.c +0 -4
@@ -190,10 +190,6 @@ int sensors_parse_i2cbus_name(const char {int i; -if (!strcmp (name,"isa" )) { - *res =SENSORS_CHIP_NAME_BUS_ISA ; -return 0 ; - }if (strncmp (name,"i2c-" ,4 )) {return -SENSORS_ERR_BUS_NAME ; }
lib/sysfs.c +4 -6
@@ -374,17 +374,15 @@ int sensors_read_sysfs_bus(void) (attr = sysfs_get_device_attr(dev, "name")))) continue; +if (sscanf (clsdev->name,"i2c-%d" , &entry.number) !=1 || + entry.number =9191 )/* legacy ISA */ +continue ; +/* NB: attr->value[attr->len-1] = '\n'; chop that off */ entry.adapter =strndup (attr->value, attr->len -1 );if (!entry.adapter)sensors_fatal_error (__FUNCTION__,"out of memory" ); -if (!strncmp (entry.adapter,"ISA " ,4 )) { - entry.number =SENSORS_CHIP_NAME_BUS_ISA ; - }else if (sscanf (clsdev->name,"i2c-%d" , &entry.number) !=1 ) { -continue ; - } -sensors_add_proc_bus (&entry); }
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH 3/6] libsensors4: Don't substitute the isa
Quoted 4 lines · Jean Delvare
Don't handle the isa bus in
sensors_parse_i2cbus_name(). We really don't need to, as there is a single ISA bus, there's no need for substituting anything.
This one requires deeper knowledge of libsensors then I have.
I can still test it though :)
Regards,
Hans
Quoted 34 lines
--- lib/data.c | 4 ---- lib/sysfs.c | 10 ++++------ 2 files changed, 4 insertions(+), 10 deletions(-)lib/data.c +0
-4@@ -190,10 +190,6 @@ int sensors_parse_i2cbus_name(const char {int i; -if (!strcmp (name,"isa" )) { - *res =SENSORS_CHIP_NAME_BUS_ISA ; -return 0 ; - }if (strncmp (name,"i2c-" ,4 )) {return -SENSORS_ERR_BUS_NAME ; }lib/sysfs.c +4
-0@@ -374,17 +374,15 @@ int sensors_read_sysfs_bus(void) (attr = sysfs_get_device_attr(dev, "name")))) continue; +if (sscanf (clsdev->name,"i2c-%d" , &entry.number) !=1 || + entry.number =9191 )/* legacy ISA */ +continue ; +/* NB: attr->value[attr->len-1] = '\n'; chop that off */ entry.adapter =strndup (attr->value, attr->len -1 );if (!entry.adapter)sensors_fatal_error (__FUNCTION__,"out of memory" );
lib/sysfs.c int sensors_read_sysfs_bus(void) · line 388
Quoted 10 lines
lib/sysfs.c +0
-6-if (!strncmp (entry.adapter,"ISA " ,4 )) { - entry.number =SENSORS_CHIP_NAME_BUS_ISA ; - }else if (sscanf (clsdev->name,"i2c-%d" , &entry.number) !=1 ) { -continue ; - } -sensors_add_proc_bus (&entry); }
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH 3/6] libsensors4: Don't substitute the isa
In reply to Jean DelvareHi Hans,
Quoted 6 lines · Hans de Goede
Quoted 3 lines · Jean Delvare
Don't handle the isa bus in
sensors_parse_i2cbus_name(). We really don't need to, as there is a single ISA bus, there's no need for substituting anything.This one requires deeper knowledge of libsensors then I have.
Bus substitution is how we addressed the fact that i2c bus numbers can change across reboots. With bus statements in sensors.conf, you can give an arbitrary (and persistent) bus number to an i2c bus based on it's name. After that, whenever you refer to that bus number in the configuration file (in a chip statement), it will mean that bus, even if the current bus numbering is different. This mechanism is very useful when you have similar I2C hardware monitoring chips on different buses and each needs a specific configuration.
This bus substitution mechanism would also presumably be useful for other bus types where several buses can exist on the system (w1, spi), but for ISA, there can really be only one isa bus, so there's no risk of bus number changing across reboot.
Not too sure about the PCI bus. So far I assumed that there was only one, but it seems that on big systems there can be several.
As a side note, the i2c bus number substitution is only done for the configuration file at the moment. If you want to specify a chip name on sensors' command line, you still must use the bus numbers of the running system. This should probably be changed. I'll create a ticket for this.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors