Fix SPDDetector only scanning bus 0 on Linux
This commit is contained in:
parent
9e6a2eb94c
commit
2c4b159901
6 changed files with 18 additions and 10 deletions
|
|
@ -28,6 +28,7 @@ i2c_smbus_interface::i2c_smbus_interface()
|
|||
this->pci_vendor = -1;
|
||||
this->pci_subsystem_device = -1;
|
||||
this->pci_subsystem_vendor = -1;
|
||||
this->bus_id = -1;
|
||||
i2c_smbus_thread_running = true;
|
||||
i2c_smbus_thread = new std::thread(&i2c_smbus_interface::i2c_smbus_thread_function, this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ public:
|
|||
int pci_subsystem_device;
|
||||
int pci_subsystem_vendor;
|
||||
|
||||
int bus_id;
|
||||
|
||||
i2c_smbus_interface();
|
||||
virtual ~i2c_smbus_interface();
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ bool i2c_smbus_linux_detect()
|
|||
char path[1024];
|
||||
char buff[100];
|
||||
unsigned short pci_device, pci_vendor, pci_subsystem_device, pci_subsystem_vendor;
|
||||
unsigned short port_id;
|
||||
unsigned short port_id, bus_id;
|
||||
char *ptr;
|
||||
|
||||
// Start looking for I2C adapters in /sys/bus/i2c/devices/
|
||||
|
|
@ -125,10 +125,14 @@ bool i2c_smbus_linux_detect()
|
|||
pci_subsystem_vendor = 0;
|
||||
pci_subsystem_device = 0;
|
||||
port_id = 0;
|
||||
bus_id = 0;
|
||||
|
||||
// Get port ID for Nvidia GPUs
|
||||
sscanf(device_string, "NVIDIA i2c adapter %hu at", &port_id);
|
||||
|
||||
// Get the Linux Bus ID
|
||||
sscanf(ent->d_name, "i2c-%hu", &bus_id);
|
||||
|
||||
// Get device path
|
||||
strcpy(path, driver_path);
|
||||
strcat(path, ent->d_name);
|
||||
|
|
@ -233,6 +237,7 @@ bool i2c_smbus_linux_detect()
|
|||
bus->pci_subsystem_device = pci_subsystem_device;
|
||||
bus->pci_subsystem_vendor = pci_subsystem_vendor;
|
||||
bus->port_id = port_id;
|
||||
bus->bus_id = bus_id;
|
||||
ResourceManager::get()->RegisterI2CBus(bus);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue