From 6e2c2a4d69c07e85e8297311427c2cb4ee9f8121 Mon Sep 17 00:00:00 2001 From: "Mark D. Studebaker" Date: Sun, 16 Nov 2003 19:54:38 +0000 Subject: [PATCH] correctly mark ISA chips with special ISA bus number git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2061 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/proc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/proc.c b/lib/proc.c index 4b6620ae..cb25830b 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -121,6 +121,7 @@ int sensors_read_proc_chips(void) if ((f = fopen(n, "r")) != NULL) { char x[120]; fscanf(f, "%[a-zA-z0-9_]", x); + fclose(f); /* HACK */ strcat(x, "-*"); if ((res = sensors_parse_chip_name(x, &entry.name))) { char em[NAME_MAX + 20]; @@ -131,8 +132,16 @@ int sensors_read_proc_chips(void) } entry.name.busname = strdup(dirname); sscanf(de->d_name, "%x-%x", &entry.name.bus, &entry.name.addr); + /* find out if ISA or not */ + sprintf(n, "%s/class/i2c-adapter/i2c-%d/device/name", + sysfsmount, entry.name.bus); + if ((f = fopen(n, "r")) != NULL) { + fgets(x, 5, f); + fclose(f); + if(!strncmp(x, "ISA ", 4)) + entry.name.bus = SENSORS_CHIP_NAME_BUS_ISA; + } add_proc_chips(&entry); - fclose(f); } } closedir(dir); @@ -192,7 +201,6 @@ int sensors_read_proc_bus(void) strcpy(dirname, n); strcat(n, "/device/name"); -printf("opening %s\n", n); if ((f = fopen(n, "r")) != NULL) { char x[120]; fgets(x, 120, f); @@ -208,7 +216,6 @@ printf("opening %s\n", n); entry.algorithm = "Dummy bus algorithm"; } else entry.algorithm = "Unavailable from sysfs"; -printf("adding bus adap %s algo %s number %d\n", entry.adapter, entry.algorithm, entry.number); add_proc_bus(&entry); } }