On Linux include both the I2C/SMBus bus name and device path in the device_name

This commit is contained in:
Michal Malý
2025-11-30 10:24:53 +01:00
parent 77ff2a367c
commit 61d3bc0e98
2 changed files with 3 additions and 2 deletions

View File

@@ -232,7 +232,7 @@ bool i2c_smbus_linux_detect()
}
bus = new i2c_smbus_linux();
strcpy(bus->device_name, device_string);
snprintf(bus->device_name, sizeof(bus->device_name), "%s (%s)", device_string, device_path);
bus->handle = test_fd;
bus->pci_device = pci_device;
bus->pci_vendor = pci_vendor;

View File

@@ -30,7 +30,8 @@ inline bool is_amd_gpu_i2c_bus(const i2c_smbus_interface *bus)
size_t idx = 0;
while((name = RECOGNIZED_I2C_BUS_NAMES[idx++]) != nullptr)
{
if(std::strcmp(name, bus->device_name) == 0)
const char *pos = std::strstr(bus->device_name, name);
if(pos == bus->device_name)
{
return true;
}