Added --i2c command line option
This commit is contained in:
+10
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
/* Search all i2c device files for ones are on a PCI device of a supported GPU,
|
||||
and respond with the correct iCX3 version information */
|
||||
int find_evga_gpu_i2cs(struct card_info *infos, int max_gpus)
|
||||
int find_evga_gpu_i2cs(struct card_info *infos, int max_gpus, int i2c_bus)
|
||||
{
|
||||
char i2c_devices_path[NAME_MAX];
|
||||
char device_path[NAME_MAX];
|
||||
@@ -20,6 +20,7 @@ int find_evga_gpu_i2cs(struct card_info *infos, int max_gpus)
|
||||
struct dirent *ent;
|
||||
|
||||
int num_gpus = 0;
|
||||
int current_i2c_bus = -1;
|
||||
unsigned short pci_vendor, pci_device, pci_subsystem_vendor, pci_subsystem_device = 0;
|
||||
|
||||
/* Start looking for I2C adapters in /sys/bus/i2c/devices/ */
|
||||
@@ -37,6 +38,14 @@ int find_evga_gpu_i2cs(struct card_info *infos, int max_gpus)
|
||||
if(strncmp(ent->d_name, "i2c-", 4) != 0)
|
||||
continue;
|
||||
|
||||
/* Only probe the specific device given (if provided) */
|
||||
if (i2c_bus >= 0) {
|
||||
sscanf(ent->d_name, "i2c-%i", ¤t_i2c_bus);
|
||||
if (current_i2c_bus != i2c_bus)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
strcpy(device_path, i2c_devices_path);
|
||||
strcat(device_path, ent->d_name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user