void show_dmi_base_board(struct s_hardware *hardware) {
+ if (hardware->dmi.base_board.filled==false) {
+ printf("Base_board module not available\n");
+ return;
+ }
clear_screen();
more_printf("Base board\n");
- more_printf(" Manufacturer %s\n",hardware->dmi.base_board.manufacturer);
- more_printf(" Product Name %s\n",hardware->dmi.base_board.product_name);
- more_printf(" Version %s\n",hardware->dmi.base_board.version);
- more_printf(" Serial %s\n",hardware->dmi.base_board.serial);
- more_printf(" Asset Tag %s\n",hardware->dmi.base_board.asset_tag);
- more_printf(" Location %s\n",hardware->dmi.base_board.location);
- more_printf(" Type %s\n",hardware->dmi.base_board.type);
- for (int i=0;i<=BASE_BOARD_NB_ELEMENTS; i++) {
+ more_printf(" Manufacturer : %s\n",hardware->dmi.base_board.manufacturer);
+ more_printf(" Product Name : %s\n",hardware->dmi.base_board.product_name);
+ more_printf(" Version : %s\n",hardware->dmi.base_board.version);
+ more_printf(" Serial : %s\n",hardware->dmi.base_board.serial);
+ more_printf(" Asset Tag : %s\n",hardware->dmi.base_board.asset_tag);
+ more_printf(" Location : %s\n",hardware->dmi.base_board.location);
+ more_printf(" Type : %s\n",hardware->dmi.base_board.type);
+ for (int i=0;i<BASE_BOARD_NB_ELEMENTS; i++) {
if (((bool *)(& hardware->dmi.base_board.features))[i] == true) {
more_printf(" %s\n", base_board_features_strings[i]);
}
}
void show_dmi_system(struct s_hardware *hardware) {
+ if (hardware->dmi.system.filled==false) {
+ printf("System module not available\n");
+ return;
+ }
clear_screen();
more_printf("System\n");
- more_printf(" Manufacturer %s\n",hardware->dmi.system.manufacturer);
- more_printf(" Product Name %s\n",hardware->dmi.system.product_name);
- more_printf(" Version %s\n",hardware->dmi.system.version);
- more_printf(" Serial %s\n",hardware->dmi.system.serial);
- more_printf(" UUID %s\n",hardware->dmi.system.uuid);
- more_printf(" Wakeup Type %s\n",hardware->dmi.system.wakeup_type);
- more_printf(" SKU Number %s\n",hardware->dmi.system.sku_number);
- more_printf(" Family %s\n",hardware->dmi.system.family);
+ more_printf(" Manufacturer : %s\n",hardware->dmi.system.manufacturer);
+ more_printf(" Product Name : %s\n",hardware->dmi.system.product_name);
+ more_printf(" Version : %s\n",hardware->dmi.system.version);
+ more_printf(" Serial : %s\n",hardware->dmi.system.serial);
+ more_printf(" UUID : %s\n",hardware->dmi.system.uuid);
+ more_printf(" Wakeup Type : %s\n",hardware->dmi.system.wakeup_type);
+ more_printf(" SKU Number : %s\n",hardware->dmi.system.sku_number);
+ more_printf(" Family : %s\n",hardware->dmi.system.family);
}
void show_dmi_bios(struct s_hardware *hardware) {
+ if (hardware->dmi.bios.filled==false) {
+ printf("Bios module not available\n");
+ return;
+ }
clear_screen();
more_printf("BIOS\n");
- more_printf(" Vendor: %s\n",hardware->dmi.bios.vendor);
- more_printf(" Version: %s\n",hardware->dmi.bios.version);
- more_printf(" Release: %s\n",hardware->dmi.bios.release_date);
- more_printf(" Bios Revision %s\n",hardware->dmi.bios.bios_revision);
- more_printf(" Firmware Revision %s\n",hardware->dmi.bios.firmware_revision);
- more_printf(" Address: 0x%04X0\n",hardware->dmi.bios.address);
- more_printf(" Runtime address: %u %s\n",hardware->dmi.bios.runtime_size,hardware->dmi.bios.runtime_size_unit);
- more_printf(" Rom size: %u %s\n",hardware->dmi.bios.rom_size,hardware->dmi.bios.rom_size_unit);
+ more_printf(" Vendor : %s\n",hardware->dmi.bios.vendor);
+ more_printf(" Version : %s\n",hardware->dmi.bios.version);
+ more_printf(" Release : %s\n",hardware->dmi.bios.release_date);
+ more_printf(" Bios Revision : %s\n",hardware->dmi.bios.bios_revision);
+ more_printf(" Firmware Revision : %s\n",hardware->dmi.bios.firmware_revision);
+ more_printf(" Address : 0x%04X0\n",hardware->dmi.bios.address);
+ more_printf(" Runtime address : %u %s\n",hardware->dmi.bios.runtime_size,hardware->dmi.bios.runtime_size_unit);
+ more_printf(" Rom size : %u %s\n",hardware->dmi.bios.rom_size,hardware->dmi.bios.rom_size_unit);
+
+ for (int i=0;i<BIOS_CHAR_NB_ELEMENTS; i++) {
+ if (((bool *)(& hardware->dmi.bios.characteristics))[i] == true) {
+ more_printf(" %s\n", bios_charac_strings[i]);
+ }
+ }
+ for (int i=0;i<BIOS_CHAR_X1_NB_ELEMENTS; i++) {
+ if (((bool *)(& hardware->dmi.bios.characteristics_x1))[i] == true) {
+ more_printf(" %s\n", bios_charac_x1_strings[i]);
+ }
+ }
+
+ for (int i=0;i<BIOS_CHAR_X2_NB_ELEMENTS; i++) {
+ if (((bool *)(& hardware->dmi.bios.characteristics_x2))[i] == true) {
+ more_printf(" %s\n", bios_charac_x2_strings[i]);
+ }
+ }
+
}
void show_dmi_chassis(struct s_hardware *hardware) {
+ if (hardware->dmi.chassis.filled==false) {
+ printf("Chassis module not available\n");
+ return;
+ }
clear_screen();
more_printf("Chassis\n");
- more_printf(" Manufacturer %s\n",hardware->dmi.chassis.manufacturer);
- more_printf(" Type %s\n",hardware->dmi.chassis.type);
- more_printf(" Lock %s\n",hardware->dmi.chassis.lock);
- more_printf(" Version %s\n",hardware->dmi.chassis.version);
- more_printf(" Serial %s\n",hardware->dmi.chassis.serial);
- more_printf(" Asset Tag %s\n",hardware->dmi.chassis.asset_tag);
- more_printf(" Boot up state %s\n",hardware->dmi.chassis.boot_up_state);
- more_printf(" Power supply state %s\n",hardware->dmi.chassis.power_supply_state);
- more_printf(" Thermal state %s\n",hardware->dmi.chassis.thermal_state);
- more_printf(" Security Status %s\n",hardware->dmi.chassis.security_status);
- more_printf(" OEM Information %s\n",hardware->dmi.chassis.oem_information);
- more_printf(" Height %u\n",hardware->dmi.chassis.height);
- more_printf(" NB Power Cords %u\n",hardware->dmi.chassis.nb_power_cords);
+ more_printf(" Manufacturer : %s\n",hardware->dmi.chassis.manufacturer);
+ more_printf(" Type : %s\n",hardware->dmi.chassis.type);
+ more_printf(" Lock : %s\n",hardware->dmi.chassis.lock);
+ more_printf(" Version : %s\n",hardware->dmi.chassis.version);
+ more_printf(" Serial : %s\n",hardware->dmi.chassis.serial);
+ more_printf(" Asset Tag : %s\n",hardware->dmi.chassis.asset_tag);
+ more_printf(" Boot up state : %s\n",hardware->dmi.chassis.boot_up_state);
+ more_printf(" Power supply state : %s\n",hardware->dmi.chassis.power_supply_state);
+ more_printf(" Thermal state : %s\n",hardware->dmi.chassis.thermal_state);
+ more_printf(" Security Status : %s\n",hardware->dmi.chassis.security_status);
+ more_printf(" OEM Information : %s\n",hardware->dmi.chassis.oem_information);
+ more_printf(" Height : %u\n",hardware->dmi.chassis.height);
+ more_printf(" NB Power Cords : %u\n",hardware->dmi.chassis.nb_power_cords);
}
void show_dmi_cpu(struct s_hardware *hardware) {
+ if (hardware->dmi.processor.filled==false) {
+ printf("Processor module not available\n");
+ return;
+ }
clear_screen();
more_printf("CPU\n");
- more_printf(" Socket Designation %s\n",hardware->dmi.processor.socket_designation);
- more_printf(" Type %s\n",hardware->dmi.processor.type);
- more_printf(" Family %s\n",hardware->dmi.processor.family);
- more_printf(" Manufacturer %s\n",hardware->dmi.processor.manufacturer);
- more_printf(" Version %s\n",hardware->dmi.processor.version);
- more_printf(" External Clock %u\n",hardware->dmi.processor.external_clock);
- more_printf(" Max Speed %u\n",hardware->dmi.processor.max_speed);
- more_printf(" Current Speed %u\n",hardware->dmi.processor.current_speed);
- more_printf(" Cpu Type %u\n",hardware->dmi.processor.signature.type);
- more_printf(" Cpu Family %u\n",hardware->dmi.processor.signature.family);
- more_printf(" Cpu Model %u\n",hardware->dmi.processor.signature.model);
- more_printf(" Cpu Stepping %u\n",hardware->dmi.processor.signature.stepping);
- more_printf(" Cpu Minor Stepping %u\n",hardware->dmi.processor.signature.minor_stepping);
+ more_printf(" Socket Designation : %s\n",hardware->dmi.processor.socket_designation);
+ more_printf(" Type : %s\n",hardware->dmi.processor.type);
+ more_printf(" Family : %s\n",hardware->dmi.processor.family);
+ more_printf(" Manufacturer : %s\n",hardware->dmi.processor.manufacturer);
+ more_printf(" Version : %s\n",hardware->dmi.processor.version);
+ more_printf(" External Clock : %u\n",hardware->dmi.processor.external_clock);
+ more_printf(" Max Speed : %u\n",hardware->dmi.processor.max_speed);
+ more_printf(" Current Speed : %u\n",hardware->dmi.processor.current_speed);
+ more_printf(" Cpu Type : %u\n",hardware->dmi.processor.signature.type);
+ more_printf(" Cpu Family : %u\n",hardware->dmi.processor.signature.family);
+ more_printf(" Cpu Model : %u\n",hardware->dmi.processor.signature.model);
+ more_printf(" Cpu Stepping : %u\n",hardware->dmi.processor.signature.stepping);
+ more_printf(" Cpu Minor Stepping : %u\n",hardware->dmi.processor.signature.minor_stepping);
//more_printf(" Voltage %f\n",hardware->dmi.processor.voltage);
- more_printf(" Status %s\n",hardware->dmi.processor.status);
- more_printf(" Upgrade %s\n",hardware->dmi.processor.upgrade);
- more_printf(" Cache L1 Handle %s\n",hardware->dmi.processor.cache1);
- more_printf(" Cache L2 Handle %s\n",hardware->dmi.processor.cache2);
- more_printf(" Cache L3 Handle %s\n",hardware->dmi.processor.cache3);
- more_printf(" Serial %s\n",hardware->dmi.processor.serial);
- more_printf(" Part Number %s\n",hardware->dmi.processor.part_number);
- more_printf(" ID %s\n",hardware->dmi.processor.id);
+ more_printf(" Status : %s\n",hardware->dmi.processor.status);
+ more_printf(" Upgrade : %s\n",hardware->dmi.processor.upgrade);
+ more_printf(" Cache L1 Handle : %s\n",hardware->dmi.processor.cache1);
+ more_printf(" Cache L2 Handle : %s\n",hardware->dmi.processor.cache2);
+ more_printf(" Cache L3 Handle : %s\n",hardware->dmi.processor.cache3);
+ more_printf(" Serial : %s\n",hardware->dmi.processor.serial);
+ more_printf(" Part Number : %s\n",hardware->dmi.processor.part_number);
+ more_printf(" ID : %s\n",hardware->dmi.processor.id);
+ for (int i=0;i<PROCESSOR_FLAGS_ELEMENTS; i++) {
+ if (((bool *)(& hardware->dmi.processor.cpu_flags))[i] == true) {
+ more_printf(" %s\n", cpu_flags_strings[i]);
+ }
+ }
+
}
hardware->pci_domain=NULL;
/* Cleaning structures */
- memset(&(hardware->disk_info),0,sizeof (struct diskinfo));
- memset(&(hardware->dmi),0,sizeof (s_dmi));
- memset(&(hardware->cpu),0,sizeof (s_cpu));
+ memset(hardware->disk_info,0,sizeof(hardware->disk_info));
+ memset(&hardware->dmi,0,sizeof(hardware->dmi));
+ memset(&hardware->cpu,0,sizeof(hardware->cpu));
}
/* Detecting if a DMI table exist
* if yes, let's parse it */
int detect_dmi(struct s_hardware *hardware) {
hardware->dmi_detection=true;
- if (dmi_iterate(&(hardware->dmi)) == -ENODMITABLE ) {
+ if (dmi_iterate(&hardware->dmi) == -ENODMITABLE ) {
hardware->is_dmi_valid=false;
return -ENODMITABLE;
}
- parse_dmitable(&(hardware->dmi));
+ parse_dmitable(&hardware->dmi);
hardware->is_dmi_valid=true;
return 0;
}
for (int drive = 0x80; drive < 0xff; drive++) {
if (get_disk_params(drive,hardware->disk_info) != 0)
continue;
- struct diskinfo d=hardware->disk_info[drive];
- printf(" DISK 0x%X: %s : %s %s: sectors=%d, s/t=%d head=%d : EDD=%s\n",drive,d.aid.model,d.host_bus_type,d.interface_type, d.sectors, d.sectors_per_track,d.heads,d.edd_version);
+ struct diskinfo *d=&hardware->disk_info[drive];
+ printf(" DISK 0x%X: %s : %s %s: sectors=%d, s/t=%d head=%d : EDD=%s\n",drive,d->aid.model,d->host_bus_type,d->interface_type, d->sectors, d->sectors_per_track,d-<heads,d->edd_version);
}
}
void cpu_detect(struct s_hardware *hardware) {
hardware->cpu_detection=true;
- detect_cpu(&(hardware->cpu));
+ detect_cpu(&hardware->cpu);
}
/* Find the last instance of a particular command line argument
(which should include the final =; do not use for boolean arguments) */
-char *find_argument(char **argv, const char *argument)
+char *find_argument(const char **argv, const char *argument)
{
int la = strlen(argument);
- char **arg;
+ const char **arg;
char *ptr = NULL;
for (arg = argv; *arg; arg++) {