Dear Maintainer,
we have found an issue in libsensors that occurs when parsing the chip
address of ISA sensors resulting in an incorrect ISA address.
The ISA sensor chip address of a sensor is obtained by parsing the
"device" symlink of an hwmon device. The regular expression extracting
the device address will fail if the "device" symlink 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, as
they all will be incorrectly be assigned an address of 0.
Example:
const char* dev_name = "ucsi-source-psy-USBC000:001";
int addr = -1;
/* current regex */
if (sscanf(dev_name, "%*[a-zA-Z0-9_]%*1[.:]%d", &addr) != 1)
addr= 0;
printf("addr: %d\n", addr); /* prints 0 */
addr = -1;
/* proposed regex */
if (sscanf(dev_name, "%*[a-zA-Z0-9_-]%*1[.:]%d", &addr) != 1)
addr= 0;
printf("addr: %d\n", addr); /* prints 1 */
We propose to add dashes to the regular expression, so that device
names with dashes will be correctly recognized, and provide it as a
patch. Note that we already opened an issue upstream at
https://github.com/lm-sensors/lm-sensors/pull/529
It seems though, that the package is abandoned for a few years now. It
would be great if we could at least fix things in Debian.
Kind regards