Added support for latest kernel i2c sysfs
This commit is contained in:
parent
c64518531d
commit
a9f8754922
23
evga-card.c
23
evga-card.c
@ -10,9 +10,10 @@
|
||||
and respond with the correct iCX3 version information */
|
||||
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];
|
||||
char dev_file[NAME_MAX];
|
||||
char i2c_devices_path[PATH_MAX];
|
||||
char device_path[PATH_MAX];
|
||||
char dev_file[PATH_MAX];
|
||||
char pci_path[PATH_MAX];
|
||||
char *pci_addr;
|
||||
|
||||
FILE *test_fd;
|
||||
@ -55,10 +56,14 @@ int find_evga_gpu_i2cs(struct card_info *infos, int max_gpus, int i2c_bus)
|
||||
continue;
|
||||
|
||||
/* Read the PCI info for the underlying device */
|
||||
pci_vendor = read_pci_id(device_path, "/device/vendor");
|
||||
pci_device = read_pci_id(device_path, "/device/device");
|
||||
pci_subsystem_vendor = read_pci_id(device_path, "/device/subsystem_vendor");
|
||||
pci_subsystem_device = read_pci_id(device_path, "/device/subsystem_device");
|
||||
strcat(device_path, "/../");
|
||||
if (realpath(device_path, pci_path) == NULL)
|
||||
continue;
|
||||
|
||||
pci_vendor = read_pci_id(pci_path, "/vendor");
|
||||
pci_device = read_pci_id(pci_path, "/device");
|
||||
pci_subsystem_vendor = read_pci_id(pci_path, "/subsystem_vendor");
|
||||
pci_subsystem_device = read_pci_id(pci_path, "/subsystem_device");
|
||||
|
||||
/* See if it's a matching device for a supported EVGA card */
|
||||
for (int i = 0; i < (sizeof(evga_pci_ids) / sizeof(struct gpu_pci_info)); i++) {
|
||||
@ -97,7 +102,7 @@ int find_evga_gpu_i2cs(struct card_info *infos, int max_gpus, int i2c_bus)
|
||||
unsigned short read_pci_id(char *device_path, char *field)
|
||||
{
|
||||
char buf[16];
|
||||
char file_path[NAME_MAX];
|
||||
char file_path[PATH_MAX];
|
||||
|
||||
strcpy(file_path, device_path);
|
||||
strcat(file_path, field);
|
||||
@ -119,7 +124,7 @@ unsigned short read_pci_id(char *device_path, char *field)
|
||||
|
||||
char *read_nvidia_pci_address(char *device_path)
|
||||
{
|
||||
char file_path[NAME_MAX];
|
||||
char file_path[PATH_MAX];
|
||||
|
||||
char *ret = calloc(16 + 1, sizeof(char)); /* assuming pci ids could look as large as 00000000:0C:00.0 */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user