[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.
This commit is contained in:
Michael Lettrich authored and Michal Suchanek committed 2026-04-21 13:34:11 +02:00
1 parent 68bda21952
commit 01359701a2
1 file changed
+1 -1
+1 -1
View File
@@ -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;