struct card_info { char *card_name; /* The 'nice' name of the card */ char *pci_id; /* PCI bus address in domain:bus:device.function format. May be shortened (e.g. c:00.0) */ char *pci_dev_path; /* Path to the PCI device file */ void *bar0_mmap; /* Mmap of the PCI BAR0 */ unsigned short pci_device_id; /* The device ID of the card, i.e. corresponds to the NVIDIA model number */ char *i2c_dev_path; /* Path to the i2c device file */ int i2c_fd; /* File descriptor for the i2c device file, for re-use */ int product_id; /* EVGA internal product ID, as reported by the iCX3 controller */ void *nvml_device; /* Pointer to nvmlDevice_t for use in NVML calls */ }; struct gpu_pci_info { char *card_name; unsigned short vendor_id; unsigned short device_id; unsigned short subvendor_id; unsigned short subdevice_id; }; unsigned short read_pci_id(char *device_path, char *field); char *read_nvidia_pci_address(char *device_path);