2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 14:25:39 +00:00

Add a new function to libsensors doing the opposite of

sensors_parse_chip_name(). sensors_snprintf_chip_name() converts
a chip name from its internal representation to a human readable
string. So far, each user program had to reimplement this function.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4676 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2007-08-16 10:04:57 +00:00
parent 493d9b27f5
commit edb42b3c16
7 changed files with 37 additions and 14 deletions

View File

@@ -298,13 +298,8 @@ const char *sprintf_chip_name(const sensors_chip_name *name)
#define BUF_SIZE 200
static char buf[BUF_SIZE];
if (name->bus == SENSORS_CHIP_NAME_BUS_ISA)
snprintf(buf, BUF_SIZE, "%s-isa-%04x", name->prefix, name->addr);
else if (name->bus == SENSORS_CHIP_NAME_BUS_PCI)
snprintf(buf, BUF_SIZE, "%s-pci-%04x", name->prefix, name->addr);
else
snprintf(buf, BUF_SIZE, "%s-i2c-%d-%02x", name->prefix, name->bus,
name->addr);
if (sensors_snprintf_chip_name(buf, BUF_SIZE, name) < 0)
return NULL;
return buf;
}