char available_dmi_commands[1024];
memset(available_dmi_commands, 0, sizeof(available_dmi_commands));
- if (hardware->dmi.base_board.filled == true) {
- strncat(available_dmi_commands, CLI_DMI_BASE_BOARD,
- sizeof(CLI_DMI_BASE_BOARD) - 1);
- strncat(available_dmi_commands, " ", 1);
- }
- if (hardware->dmi.battery.filled == true) {
- strncat(available_dmi_commands, CLI_DMI_BATTERY,
- sizeof(CLI_DMI_BATTERY) - 1);
- strncat(available_dmi_commands, " ", 1);
- }
- if (hardware->dmi.bios.filled == true) {
- strncat(available_dmi_commands, CLI_DMI_BIOS,
- sizeof(CLI_DMI_BIOS) - 1);
- strncat(available_dmi_commands, " ", 1);
- }
- if (hardware->dmi.chassis.filled == true) {
- strncat(available_dmi_commands, CLI_DMI_CHASSIS,
- sizeof(CLI_DMI_CHASSIS) - 1);
- strncat(available_dmi_commands, " ", 1);
- }
- for (int i = 0; i < hardware->dmi.memory_count; i++) {
- if (hardware->dmi.memory[i].filled == true) {
- strncat(available_dmi_commands, CLI_DMI_MEMORY,
- sizeof(CLI_DMI_MEMORY) - 1);
- strncat(available_dmi_commands, " bank<bank_number> ",
- 19);
- break;
- }
- }
- if (hardware->dmi.processor.filled == true) {
- strncat(available_dmi_commands, CLI_DMI_PROCESSOR,
- sizeof(CLI_DMI_PROCESSOR) - 1);
- strncat(available_dmi_commands, " ", 1);
- }
- if (hardware->dmi.system.filled == true) {
- strncat(available_dmi_commands, CLI_DMI_SYSTEM,
- sizeof(CLI_DMI_SYSTEM) - 1);
- strncat(available_dmi_commands, " ", 1);
- }
- if (hardware->dmi.ipmi.filled == true) {
- strncat(available_dmi_commands, CLI_DMI_IPMI,
- sizeof(CLI_DMI_IPMI) - 1);
- strncat(available_dmi_commands, " ", 1);
- }
-
- printf("Available DMI modules: %s\n", available_dmi_commands);
-}
-
-static void show_dmi_help(int argc, char** argv,
- struct s_hardware *hardware)
-{
- more_printf("Show supports the following commands : \n");
- more_printf(" %s\n", CLI_SHOW_LIST);
- more_printf(" <module_name>\n");
- more_printf(" -\n");
- show_dmi_modules(0, NULL, hardware);
+ printf("Available DMI modules on your system:\n");
+ if (hardware->dmi.base_board.filled == true)
+ printf("\t%s\n", CLI_DMI_BASE_BOARD);
+ if (hardware->dmi.battery.filled == true)
+ printf("\t%s\n", CLI_DMI_BATTERY);
+ if (hardware->dmi.bios.filled == true)
+ printf("\t%s\n", CLI_DMI_BIOS);
+ if (hardware->dmi.chassis.filled == true)
+ printf("\t%s\n", CLI_DMI_CHASSIS);
+ for (int i = 0; i < hardware->dmi.memory_count; i++) {
+ if (hardware->dmi.memory[i].filled == true) {
+ printf("\tbank <number>\n", CLI_DMI_MEMORY);
+ break;
+ }
+ }
+ if (hardware->dmi.processor.filled == true)
+ printf("\t%s\n", CLI_DMI_PROCESSOR);
+ if (hardware->dmi.system.filled == true)
+ printf("\t%s\n", CLI_DMI_SYSTEM);
++ if (hardware->dmi.ipmifilled == true)
++ printf("\t%s\n", CLI_DMI_IPMI);
}
-static void show_dmi_base_board(int argc, char** argv,
+static void show_dmi_base_board(int argc __unused, char** argv __unused,
struct s_hardware *hardware)
{
if (hardware->dmi.base_board.filled == false) {
}
}
}
-
-int do_exit(struct s_cli *cli)
-{
- switch (cli->mode) {
- case HDT_MODE:
- return EXIT_MODE;
- case KERNEL_MODE:
- case PXE_MODE:
- case SYSLINUX_MODE:
- case PCI_MODE:
- case DMI_MODE:
- case VESA_MODE:
- case CPU_MODE:
- return HDT_MODE;
- case EXIT_MODE:
- return EXIT_MODE; /* should not happen */
- }
- return HDT_MODE;
-}
-
-static void main_show_summary(struct s_hardware *hardware)
-{
- detect_pci(hardware); /* pxe is detected in the pci */
- detect_dmi(hardware);
- cpu_detect(hardware);
- clear_screen();
- main_show_cpu(hardware);
- if (hardware->is_dmi_valid) {
- 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(" Serial : %s\n",
- hardware->dmi.system.serial);
- more_printf("Bios\n");
- more_printf(" Version : %s\n", hardware->dmi.bios.version);
- more_printf(" Release : %s\n",
- hardware->dmi.bios.release_date);
-
- int argc = 2;
- char *argv[2] = { "0", "0" };
- show_dmi_memory_modules(argc, argv, hardware);
- if (hardware->dmi.ipmi.filled==true) {
- more_printf("IPMI baseboard v%u.%u present\n",
- hardware->dmi.ipmi.major_specification_version,
- hardware->dmi.ipmi.minor_specification_version);
- }
- }
- main_show_pci(hardware);
-
- if (hardware->is_pxe_valid)
- main_show_pxe(hardware);
-
- main_show_kernel(hardware);
-}
-
-void show_main_help(struct s_hardware *hardware)
-{
- more_printf("Show supports the following commands : \n");
- more_printf(" %s\n", CLI_SUMMARY);
- more_printf(" %s\n", CLI_PCI);
- more_printf(" %s\n", CLI_DMI);
- more_printf(" %s\n", CLI_CPU);
- more_printf(" %s\n", CLI_KERNEL);
- more_printf(" %s\n", CLI_SYSLINUX);
- more_printf(" %s\n", CLI_VESA);
- more_printf(" %s\n", CLI_HDT);
- if (hardware->sv->filesystem == SYSLINUX_FS_PXELINUX)
- more_printf(" %s\n", CLI_PXE);
-}
-
-void main_show_hdt(struct s_hardware *hardware)
-{
- more_printf("HDT\n");
- more_printf(" Product : %s\n", PRODUCT_NAME);
- more_printf(" Version : %s\n", VERSION);
- more_printf(" Author : %s\n", AUTHOR);
- more_printf(" Contact : %s\n", CONTACT);
- char *contributors[NB_CONTRIBUTORS] = CONTRIBUTORS;
- for (int c=0; c<NB_CONTRIBUTORS; c++) {
- more_printf(" Contributor : %s\n", contributors[c]);
- }
-}
-
-
-void main_show(char *item, struct s_hardware *hardware)
-{
- if (!strncmp(item, CLI_SUMMARY, sizeof(CLI_SUMMARY))) {
- main_show_summary(hardware);
- return;
- }
- if (!strncmp(item, CLI_PCI, sizeof(CLI_PCI))) {
- main_show_pci(hardware);
- return;
- }
- if (!strncmp(item, CLI_DMI, sizeof(CLI_DMI))) {
- main_show_dmi(hardware);
- return;
- }
- if (!strncmp(item, CLI_CPU, sizeof(CLI_CPU))) {
- main_show_cpu(hardware);
- return;
- }
- if (!strncmp(item, CLI_PXE, sizeof(CLI_PXE))) {
- main_show_pxe(hardware);
- return;
- }
- if (!strncmp(item, CLI_SYSLINUX, sizeof(CLI_SYSLINUX))) {
- main_show_syslinux(hardware);
- return;
- }
- if (!strncmp(item, CLI_KERNEL, sizeof(CLI_KERNEL))) {
- main_show_kernel(hardware);
- return;
- }
- if (!strncmp(item, CLI_VESA, sizeof(CLI_VESA))) {
- main_show_vesa(hardware);
- return;
- }
- if (!strncmp(item, CLI_HDT, sizeof(CLI_HDT))) {
- main_show_hdt(hardware);
- return;
- }
- show_main_help(hardware);
+ }
#define CLI_DMI_MEMORY_BANK "bank"
#define CLI_DMI_PROCESSOR "cpu"
#define CLI_DMI_SYSTEM "system"
-#define CLI_DMI_LIST CLI_SHOW_LIST
+ #define CLI_DMI_IPMI "ipmi"
+#define CLI_DMI_LIST CLI_SHOW_LIST
- #define CLI_DMI_MAX_MODULES 9
+ #define CLI_DMI_MAX_MODULES 10
-void main_show_dmi(struct s_hardware *hardware);
-void handle_dmi_commands(char *cli_line, struct s_hardware *hardware);
+void main_show_dmi(int argc, char **argv, struct s_hardware *hardware);
void show_dmi_memory_modules(int argc, char** argv, struct s_hardware *hardware);
// PCI STUFF