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

master
Michal Malý 5 months ago
parent 77ff2a367c
commit 61d3bc0e98

@ -232,7 +232,7 @@ bool i2c_smbus_linux_detect()
} }
bus = new i2c_smbus_linux(); 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->handle = test_fd;
bus->pci_device = pci_device; bus->pci_device = pci_device;
bus->pci_vendor = pci_vendor; bus->pci_vendor = pci_vendor;

@ -30,7 +30,8 @@ inline bool is_amd_gpu_i2c_bus(const i2c_smbus_interface *bus)
size_t idx = 0; size_t idx = 0;
while((name = RECOGNIZED_I2C_BUS_NAMES[idx++]) != nullptr) 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; return true;
} }

Loading…
Cancel
Save