Add support for hardware monitoring chips on SPI buses.

SPI bus statements in the configuration file are not yet supported, as
SPI buses don't have a name attribute yet, it's not possible to identify
them and thus no substitution is possible.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4689 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2007-08-19 15:07:05 +00:00
1 parent f1cc941e29
commit 5524486161
5 files changed
+19 -3

No files matched your search

+9 -3
View File
@@ -106,15 +106,18 @@ int sensors_parse_chip_name(const char *name, sensors_chip_name *res)
res->bus.type = SENSORS_BUS_TYPE_ISA;
else if (!strncmp(name, "pci", dash - name))
res->bus.type = SENSORS_BUS_TYPE_PCI;
else if (!strncmp(name, "spi", dash - name))
res->bus.type = SENSORS_BUS_TYPE_SPI;
else
goto ERROR;
name = dash + 1;
/* Some bus types (i2c) have an additional bus number. For these, the
next part is either a "*" (any bus of that type) or a decimal
number. */
/* Some bus types (i2c, spi) have an additional bus number.
For these, the next part is either a "*" (any bus of that type)
or a decimal number. */
switch (res->bus.type) {
case SENSORS_BUS_TYPE_I2C:
case SENSORS_BUS_TYPE_SPI:
if (!strncmp(name, "*-", 2)) {
res->bus.nr = SENSORS_BUS_NR_ANY;
name += 2;
@@ -162,6 +165,9 @@ int sensors_snprintf_chip_name(char *str, size_t size,
case SENSORS_BUS_TYPE_I2C:
return snprintf(str, size, "%s-i2c-%hd-%02x", chip->prefix,
chip->bus.nr, chip->addr);
case SENSORS_BUS_TYPE_SPI:
return snprintf(str, size, "%s-spi-%hd-%x", chip->prefix,
chip->bus.nr, chip->addr);
}
return -SENSORS_ERR_CHIP_NAME;