From 01359701a22b0c3cc73daa35ed4c64b44dada1d1 Mon Sep 17 00:00:00 2001 From: Michael Lettrich Date: Fri, 25 Jul 2025 10:31:03 +0200 Subject: [PATCH] [FIX] ISA sysfs address parsing allow dashes The ISA sensor chip address is obtained by parsing the hwmon `/sysfs` device path. The regular expression extracting the device address will fail if the device name contains dashes and sets the address to 0. If multiple instances of the same board are plugged into the same system, cards can no longer be distinguished, because their addresses will be set to 0 incorrectly. This fix changes the address-parsing regular expression to recognize device names with dashes. --- lib/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index 6e93b95c..8e46ddce 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -810,7 +810,7 @@ static int classify_device(const char *dev_name, if ((!subsys || !strcmp(subsys, "platform") || !strcmp(subsys, "of_platform"))) { /* must be new ISA (platform driver) */ - if (sscanf(dev_name, "%*[a-zA-Z0-9_]%*1[.:]%d", &entry->chip.addr) == 1); + if (sscanf(dev_name, "%*[a-zA-Z0-9_-]%*1[.:]%d", &entry->chip.addr) == 1); else if (sscanf(dev_name, "%x.%*s", &entry->chip.addr) == 1); else entry->chip.addr = 0; entry->chip.bus.type = SENSORS_BUS_TYPE_ISA;