diff options
-rw-r--r-- | com32/hdt/hdt-common.c | 20 | ||||
-rw-r--r-- | com32/hdt/hdt-common.h | 3 | ||||
-rw-r--r-- | com32/hdt/hdt.c | 3 | ||||
-rw-r--r-- | com32/hdt/hdt.h | 2 |
4 files changed, 24 insertions, 4 deletions
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c index 39af9483..0ff7e86d 100644 --- a/com32/hdt/hdt-common.c +++ b/com32/hdt/hdt-common.c @@ -32,6 +32,16 @@ #include <stdio.h> #include "syslinux/config.h" +void detect_parameters(int argc, char *argv[], struct s_hardware *hardware) { + for (int i = 1; i < argc; i++) { + if (!strncmp(argv[i], "modules=", 8)) { + strncpy(hardware->modules_pcimap_path,argv[i]+8, sizeof(hardware->modules_pcimap_path)); + } else if (!strncmp(argv[i], "pciids=",7 )) { + strncpy(hardware->pciids_path,argv[i]+7, sizeof(hardware->pciids_path)); + } + } +} + void detect_syslinux(struct s_hardware *hardware) { hardware->sv = syslinux_version(); switch(hardware->sv->filesystem) { @@ -63,6 +73,10 @@ void init_hardware(struct s_hardware *hardware) { memset(&hardware->cpu,0,sizeof(s_cpu)); memset(&hardware->pxe,0,sizeof(struct s_pxe)); memset(hardware->syslinux_fs,0,sizeof hardware->syslinux_fs); + memset(hardware->pciids_path,0,sizeof hardware->pciids_path); + memset(hardware->modules_pcimap_path,0,sizeof hardware->modules_pcimap_path); + strcat(hardware->pciids_path,"pci.ids"); + strcat(hardware->modules_pcimap_path,"modules.pcimap"); } /* Detecting if a DMI table exist @@ -194,16 +208,16 @@ void detect_pci(struct s_hardware *hardware) { printf("PCI: %d devices detected\n",hardware->nb_pci_devices); printf("PCI: Resolving names\n"); /* Assigning product & vendor name for each device*/ - hardware->pci_ids_return_code=get_name_from_pci_ids(hardware->pci_domain); + hardware->pci_ids_return_code=get_name_from_pci_ids(hardware->pci_domain, hardware->pciids_path); printf("PCI: Resolving class names\n"); /* Assigning class name for each device*/ - hardware->pci_ids_return_code=get_class_name_from_pci_ids(hardware->pci_domain); + hardware->pci_ids_return_code=get_class_name_from_pci_ids(hardware->pci_domain, hardware->pciids_path); printf("PCI: Resolving module names\n"); /* Detecting which kernel module should match each device */ - hardware->modules_pcimap_return_code=get_module_name_from_pci_ids(hardware->pci_domain); + hardware->modules_pcimap_return_code=get_module_name_from_pci_ids(hardware->pci_domain,hardware->modules_pcimap_path); /* we try to detect the pxe stuff to populate the PXE: field of pci devices */ detect_pxe(hardware); diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h index 5cf80603..1b27b588 100644 --- a/com32/hdt/hdt-common.h +++ b/com32/hdt/hdt-common.h @@ -96,6 +96,8 @@ struct s_hardware { char syslinux_fs[22]; struct syslinux_version *sv; + char modules_pcimap_path[255]; + char pciids_path[255]; }; char *find_argument(const char **argv, const char *argument); @@ -107,4 +109,5 @@ int detect_pxe(struct s_hardware *hardware); void init_hardware(struct s_hardware *hardware); void clear_screen(void); void detect_syslinux(struct s_hardware *hardware); +void detect_parameters(int argc, char *argv[], struct s_hardware *hardware); #endif diff --git a/com32/hdt/hdt.c b/com32/hdt/hdt.c index ec667c3c..b417d9da 100644 --- a/com32/hdt/hdt.c +++ b/com32/hdt/hdt.c @@ -52,6 +52,9 @@ int main(int argc, char *argv[]) /* Cleaning structures */ init_hardware(&hardware); + /* Detecting parameters */ + detect_parameters(argc,argv,&hardware); + /* Detecting Syslinux Version*/ detect_syslinux(&hardware); diff --git a/com32/hdt/hdt.h b/com32/hdt/hdt.h index 7bdf3f36..b8563ab5 100644 --- a/com32/hdt/hdt.h +++ b/com32/hdt/hdt.h @@ -32,7 +32,7 @@ #define PRODUCT_NAME "Hardware Detection Tool" #define AUTHOR "Erwan Velu" #define CONTACT "erwan(dot)velu(point)free(dot)fr" -#define VERSION "0.2.2" +#define VERSION "0.2.3" #define ATTR_PACKED __attribute__((packed)) |