diff options
-rw-r--r-- | com32/include/sys/pci.h | 6 | ||||
-rw-r--r-- | com32/lib/pci/scan.c | 12 | ||||
-rw-r--r-- | com32/modules/pcitest.c | 6 |
3 files changed, 12 insertions, 12 deletions
diff --git a/com32/include/sys/pci.h b/com32/include/sys/pci.h index 374ccf89..fad7250c 100644 --- a/com32/include/sys/pci.h +++ b/com32/include/sys/pci.h @@ -131,8 +131,8 @@ struct pci_domain *pci_scan(void); void free_pci_domain(struct pci_domain *domain); struct match * find_pci_device(const struct pci_domain *pci_domain, struct match *list); -int get_name_from_pci_ids(struct pci_domain *pci_domain); -int get_module_name_from_pci_ids(struct pci_domain *pci_domain); -int get_class_name_from_pci_ids(struct pci_domain *pci_domain); +int get_name_from_pci_ids(struct pci_domain *pci_domain, char *pciids_path); +int get_module_name_from_pci_ids(struct pci_domain *pci_domain, char *modules_pcimap_path); +int get_class_name_from_pci_ids(struct pci_domain *pci_domain, char *pciids_path); #endif /* _SYS_PCI_H */ diff --git a/com32/lib/pci/scan.c b/com32/lib/pci/scan.c index 598ca9b4..cfd9e654 100644 --- a/com32/lib/pci/scan.c +++ b/com32/lib/pci/scan.c @@ -73,7 +73,7 @@ static int hex_to_int(char *hexa) /* Try to match any pci device to the appropriate kernel module */ /* it uses the modules.pcimap from the boot device */ -int get_module_name_from_pci_ids(struct pci_domain *domain) +int get_module_name_from_pci_ids(struct pci_domain *domain, char *modules_pcimap_path) { char line[MAX_LINE]; char module_name[21]; // the module name field is 21 char long @@ -100,7 +100,7 @@ int get_module_name_from_pci_ids(struct pci_domain *domain) } /* Opening the modules.pcimap (of a linux kernel) from the boot device */ - f=fopen("modules.pcimap", "r"); + f=fopen(modules_pcimap_path, "r"); if (!f) return -ENOMODULESPCIMAP; @@ -161,7 +161,7 @@ int get_module_name_from_pci_ids(struct pci_domain *domain) /* Try to match any pci device to the appropriate class name */ /* it uses the pci.ids from the boot device */ -int get_class_name_from_pci_ids(struct pci_domain *domain) +int get_class_name_from_pci_ids(struct pci_domain *domain, char *pciids_path) { char line[MAX_LINE]; char class_name[PCI_CLASS_NAME_SIZE]; @@ -185,7 +185,7 @@ int get_class_name_from_pci_ids(struct pci_domain *domain) } /* Opening the pci.ids from the boot device */ - f = fopen("pci.ids","r"); + f = fopen(pciids_path,"r"); if (!f) return -ENOPCIIDS; @@ -251,7 +251,7 @@ int get_class_name_from_pci_ids(struct pci_domain *domain) /* Try to match any pci device to the appropriate vendor and product name */ /* it uses the pci.ids from the boot device */ -int get_name_from_pci_ids(struct pci_domain *domain) +int get_name_from_pci_ids(struct pci_domain *domain, char *pciids_path) { char line[MAX_LINE]; char vendor[PCI_VENDOR_NAME_SIZE]; @@ -282,7 +282,7 @@ int get_name_from_pci_ids(struct pci_domain *domain) } /* Opening the pci.ids from the boot device */ - f = fopen("pci.ids","r"); + f = fopen(pciids_path,"r"); if (!f) return -ENOPCIIDS; diff --git a/com32/modules/pcitest.c b/com32/modules/pcitest.c index 2c716110..00647535 100644 --- a/com32/modules/pcitest.c +++ b/com32/modules/pcitest.c @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) printf("PCI: Looking for device name\n"); /* Assigning product & vendor name for each device*/ - return_code=get_name_from_pci_ids(pci_domain); + return_code=get_name_from_pci_ids(pci_domain,"pci.ids"); if (return_code == -ENOPCIIDS) { printf("PCI: ERROR !\n"); printf("PCI: Unable to open pci.ids in the same directory as pcitest.c32.\n"); @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) printf("PCI: Resolving class names\n"); /* Assigning class name for each device*/ - return_code=get_class_name_from_pci_ids(pci_domain); + return_code=get_class_name_from_pci_ids(pci_domain,"pci.ids"); if (return_code == -ENOPCIIDS) { printf("PCI: ERROR !\n"); printf("PCI: Unable to open pci.ids in the same directory as pcitest.c32.\n"); @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) printf("PCI: Looking for Kernel modules\n"); /* Detecting which kernel module should match each device */ - return_code=get_module_name_from_pci_ids(pci_domain); + return_code=get_module_name_from_pci_ids(pci_domain,"modules.pcimap"); if (return_code == -ENOMODULESPCIMAP) { printf("PCI: ERROR !\n"); printf("PCI: Unable to open modules.pcimap in the same directory as pcitest.c32.\n"); |