summaryrefslogtreecommitdiff
path: root/com32
diff options
context:
space:
mode:
authorerwan <erwan@laptopR1.(none)>2009-03-04 17:05:51 +0100
committererwan <erwan@laptopR1.(none)>2009-03-04 17:05:51 +0100
commitd0e228dbafe637ce74bc3391c1fb81cf720f26a1 (patch)
treebb192f2a72daa8543b47738cf29906373ff6d3ba /com32
parent43b34490e3bb7fec7de8b3bc6f8efa257cf2cefc (diff)
downloadsyslinux-d0e228dbafe637ce74bc3391c1fb81cf720f26a1.tar.gz
hdt: Adding summary in menu mode
Adding a summary in the menu mode
Diffstat (limited to 'com32')
-rw-r--r--com32/hdt/Makefile2
-rw-r--r--com32/hdt/hdt-menu-summary.c158
-rw-r--r--com32/hdt/hdt-menu.c16
-rw-r--r--com32/hdt/hdt-menu.h4
-rw-r--r--com32/hdt/hdt.h2
5 files changed, 176 insertions, 6 deletions
diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
index 246554aa..b9fd49b4 100644
--- a/com32/hdt/Makefile
+++ b/com32/hdt/Makefile
@@ -46,7 +46,7 @@ hdt.elf: hdt.o hdt-ata.o hdt-menu.o hdt-menu-pci.o hdt-menu-kernel.o \
hdt-menu-syslinux.o hdt-menu-about.o \
hdt-cli.o hdt-common.o hdt-cli-pci.o hdt-cli-dmi.o \
hdt-cli-cpu.o hdt-cli-pxe.o hdt-cli-kernel.o \
- hdt-menu-pxe.o \
+ hdt-menu-pxe.o hdt-menu-summary.o\
$(com32)/modules/cpuid.o \
$(LIBS)
$(LD) $(LDFLAGS) -o $@ $^
diff --git a/com32/hdt/hdt-menu-summary.c b/com32/hdt/hdt-menu-summary.c
new file mode 100644
index 00000000..9bbefbfe
--- /dev/null
+++ b/com32/hdt/hdt-menu-summary.c
@@ -0,0 +1,158 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2009 Erwan Velu - All Rights Reserved
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * -----------------------------------------------------------------------
+*/
+
+#include "hdt-menu.h"
+
+/* Computing Summary menu*/
+void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware) {
+ char buffer[SUBMENULEN+1];
+ char statbuffer[STATLEN+1];
+ char bank_number[10];
+
+ menu->menu = add_menu(" Summary ",-1);
+ menu->items_count=0;
+
+ set_menu_pos(SUBMENU_Y,SUBMENU_X);
+
+ snprintf(buffer,sizeof buffer,"CPU Vendor : %s",hardware->cpu.vendor);
+ snprintf(statbuffer,sizeof statbuffer,"CPU Vendor: %s",hardware->cpu.vendor);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ snprintf(buffer,sizeof buffer,"CPU Model : %s",hardware->cpu.model);
+ snprintf(statbuffer,sizeof statbuffer,"CPU Model: %s",hardware->cpu.model);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ add_item("","",OPT_SEP,"",0);
+ if (hardware->is_dmi_valid == true) {
+
+ snprintf(buffer,sizeof buffer,"System Vendor : %s",hardware->dmi.system.manufacturer);
+ snprintf(statbuffer,sizeof statbuffer,"System Vendor: %s",hardware->dmi.system.manufacturer);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ snprintf(buffer,sizeof buffer,"System Product: %s",hardware->dmi.system.product_name);
+ snprintf(statbuffer,sizeof statbuffer,"System Product Name: %s",hardware->dmi.system.product_name);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ snprintf(buffer,sizeof buffer,"System Serial : %s",hardware->dmi.system.serial);
+ snprintf(statbuffer,sizeof statbuffer,"System Serial Number: %s",hardware->dmi.system.serial);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ add_item("","",OPT_SEP,"",0);
+
+ snprintf(buffer,sizeof buffer,"Bios Version : %s",hardware->dmi.bios.version);
+ snprintf(statbuffer,sizeof statbuffer,"Bios Version: %s",hardware->dmi.bios.version);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ snprintf(buffer,sizeof buffer,"Bios Release : %s",hardware->dmi.bios.release_date);
+ snprintf(statbuffer,sizeof statbuffer,"Bios Release Date: %s",hardware->dmi.bios.release_date);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ add_item("","",OPT_SEP,"",0);
+
+ for (int i=0;i<hardware->dmi.memory_count;i++) {
+ if (hardware->dmi.memory[i].filled==true) {
+ /* When discovering the first item, let's clear the screen */
+ memset(bank_number,0,sizeof(bank_number));
+ snprintf(bank_number,sizeof(bank_number),"%d ",i);
+ if (strncmp(hardware->dmi.memory[i].size,"Free",4)) {
+ snprintf(buffer,sizeof buffer,"Mem bank %02d : %s %s@%s",
+ i,hardware->dmi.memory[i].size, hardware->dmi.memory[i].type, hardware->dmi.memory[i].speed);
+ snprintf(statbuffer,sizeof statbuffer,"Memory bank %02d : %s %s@%s",
+ i,hardware->dmi.memory[i].size, hardware->dmi.memory[i].type, hardware->dmi.memory[i].speed);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+ }
+ }
+ }
+
+ add_item("","",OPT_SEP,"",0);
+ }
+
+ snprintf(buffer,sizeof buffer,"Nb PCI Devices: %d",hardware->nb_pci_devices);
+ snprintf(statbuffer,sizeof statbuffer,"Number of PCI Devices: %d",hardware->nb_pci_devices);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ add_item("","",OPT_SEP,"",0);
+
+ if (hardware->is_pxe_valid==true) {
+ struct s_pxe *p = &hardware->pxe;
+
+ snprintf(buffer,sizeof buffer, "PXE MAC Address: %s", p->mac_addr);
+ snprintf(statbuffer,sizeof statbuffer, "PXE MAC Address: %s", p->mac_addr);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ snprintf(buffer,sizeof buffer, "PXE IP Address : %d.%d.%d.%d", p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3]);
+ snprintf(statbuffer,sizeof statbuffer, "PXE IP Address: %d.%d.%d.%d", p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3]);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ add_item("","",OPT_SEP,"",0);
+ }
+
+ if (hardware->modules_pcimap_return_code != -ENOMODULESPCIMAP) {
+ bool kmod=false;
+ struct pci_device *pci_device;
+ char kernel_modules [LINUX_KERNEL_MODULE_SIZE*MAX_KERNEL_MODULES_PER_PCI_DEVICE];
+
+ /* For every detected pci device, grab its kernel module to compute this submenu */
+ for_each_pci_func(pci_device, hardware->pci_domain) {
+ memset(kernel_modules,0,sizeof kernel_modules);
+ for (int i=0; i<pci_device->dev_info->linux_kernel_module_count;i++) {
+ if (i>0) {
+ strncat(kernel_modules," | ",3);
+ }
+ strncat(kernel_modules, pci_device->dev_info->linux_kernel_module[i],LINUX_KERNEL_MODULE_SIZE-1);
+ }
+ /* No need to add unknown kernel modules*/
+ if (strlen(kernel_modules)>0) {
+ snprintf(buffer,sizeof buffer,"%s (%s)",kernel_modules, pci_device->dev_info->class_name);
+ snprintf(statbuffer, sizeof statbuffer,"%04x:%04x %s : %s\n",
+ pci_device->vendor, pci_device->product,
+ pci_device->dev_info->vendor_name,
+ pci_device->dev_info->product_name);
+
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+ kmod=true;
+ }
+ }
+ if (kmod==true) add_item("","",OPT_SEP,"",0);
+ }
+
+ printf("MENU: Summary menu done (%d items)\n",menu->items_count);
+}
+
diff --git a/com32/hdt/hdt-menu.c b/com32/hdt/hdt-menu.c
index 0c5bfe58..7380a079 100644
--- a/com32/hdt/hdt-menu.c
+++ b/com32/hdt/hdt-menu.c
@@ -143,6 +143,7 @@ void compute_submenus(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
compute_PXE(&(hdt_menu->pxe_menu),hardware);
compute_kernel(&(hdt_menu->kernel_menu),hardware);
#endif
+ compute_summarymenu(&(hdt_menu->summary_menu),hardware);
compute_syslinuxmenu(&(hdt_menu->syslinux_menu));
compute_aboutmenu(&(hdt_menu->about_menu));
}
@@ -204,6 +205,12 @@ if (hardware->is_dmi_valid) {
hdt_menu->main_menu.items_count++;
}
}
+
+ if (hardware->is_pxe_valid == true) {
+ add_item("P<X>E","PXE Information Menu",OPT_SUBMENU,NULL,hdt_menu->pxe_menu.menu);
+ hdt_menu->main_menu.items_count++;
+ }
+
add_item("","",OPT_SEP,"",0);
#ifdef WITH_PCI
if (hardware->modules_pcimap_return_code != -ENOMODULESPCIMAP) {
@@ -211,12 +218,13 @@ if (hardware->is_dmi_valid) {
hdt_menu->main_menu.items_count++;
}
#endif
- if (hardware->is_pxe_valid == true) {
- add_item("P<X>E","PXE Information Menu",OPT_SUBMENU,NULL,hdt_menu->pxe_menu.menu);
- hdt_menu->main_menu.items_count++;
- }
add_item("<S>yslinux","Syslinux Information Menu",OPT_SUBMENU,NULL,hdt_menu->syslinux_menu.menu);
hdt_menu->main_menu.items_count++;
+ add_item("S<u>mmary","Summary Information Menu",OPT_SUBMENU,NULL,hdt_menu->summary_menu.menu);
+ hdt_menu->main_menu.items_count++;
+
+ add_item("","",OPT_SEP,"",0);
+
add_item("S<w>itch to CLI","Switch to Command Line",OPT_RUN,HDT_SWITCH_TO_CLI,0);
add_item("<A>bout","About Menu",OPT_SUBMENU,NULL,hdt_menu->about_menu.menu);
hdt_menu->main_menu.items_count++;
diff --git a/com32/hdt/hdt-menu.h b/com32/hdt/hdt-menu.h
index 725da458..19986ccf 100644
--- a/com32/hdt/hdt-menu.h
+++ b/com32/hdt/hdt-menu.h
@@ -70,6 +70,7 @@ struct s_hdt_menu {
struct s_my_menu battery_menu;
struct s_my_menu syslinux_menu;
struct s_my_menu about_menu;
+ struct s_my_menu summary_menu;
struct s_my_menu pxe_menu;
int total_menu_count; // sum of all menus we have
};
@@ -106,6 +107,9 @@ void compute_syslinuxmenu(struct s_my_menu *menu);
// About menu
void compute_aboutmenu(struct s_my_menu *menu);
+// Summary menu
+void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware);
+
//PXE menu
void compute_PXE(struct s_my_menu *menu,struct s_hardware *hardware);
diff --git a/com32/hdt/hdt.h b/com32/hdt/hdt.h
index ba847d54..7bdf3f36 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.1"
+#define VERSION "0.2.2"
#define ATTR_PACKED __attribute__((packed))