From a6a42ea881e803995a3103b0af95f75570db9627 Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Sun, 1 Mar 2009 11:15:59 +0100 Subject: [PATCH] hdt: Bump version 0.2.1 Adding pxe menu in menu mode --- com32/hdt/Makefile | 1 + com32/hdt/hdt-cli-dmi.c | 2 +- com32/hdt/hdt-cli-kernel.c | 1 - com32/hdt/hdt-menu-pxe.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++ com32/hdt/hdt-menu.c | 11 +++++- com32/hdt/hdt-menu.h | 4 ++ com32/hdt/hdt.h | 2 +- 7 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 com32/hdt/hdt-menu-pxe.c diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile index 15044d4..a8f87c9 100644 --- a/com32/hdt/Makefile +++ b/com32/hdt/Makefile @@ -44,6 +44,7 @@ all: hdt.c32 $(LIB) hdt.elf: hdt.o hdt-ata.o hdt-menu.o hdt-menu-pci.o hdt-menu-kernel.o \ hdt-menu-disk.o hdt-menu-dmi.o hdt-menu-processor.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\ $(com32)/modules/cpuid.o $(com32)/modules/dmi.o $(topdir)/menu/libmenu/libmenu.a $(LIB) $(C_LIBS) $(LD) $(LDFLAGS) -o $@ $^ diff --git a/com32/hdt/hdt-cli-dmi.c b/com32/hdt/hdt-cli-dmi.c index b3c486d..3981a8d 100644 --- a/com32/hdt/hdt-cli-dmi.c +++ b/com32/hdt/hdt-cli-dmi.c @@ -271,7 +271,7 @@ void show_dmi_cpu(struct s_hardware *hardware) { 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(" 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); diff --git a/com32/hdt/hdt-cli-kernel.c b/com32/hdt/hdt-cli-kernel.c index 0485ca0..62ca537 100644 --- a/com32/hdt/hdt-cli-kernel.c +++ b/com32/hdt/hdt-cli-kernel.c @@ -32,7 +32,6 @@ #include #include #include -#include void main_show_kernel(struct s_hardware *hardware,struct s_cli_mode *cli_mode) { char buffer[1024]; diff --git a/com32/hdt/hdt-menu-pxe.c b/com32/hdt/hdt-menu-pxe.c new file mode 100644 index 0000000..5ab3d8b --- /dev/null +++ b/com32/hdt/hdt-menu-pxe.c @@ -0,0 +1,99 @@ +/* ----------------------------------------------------------------------- * + * + * 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" + +/* Main Kernel Menu*/ +void compute_PXE(struct s_my_menu *menu,struct s_hardware *hardware) { + char buffer[SUBMENULEN+1]; + char infobar[STATLEN+1]; + + if (hardware->is_pxe_valid==false) return; + + menu->menu = add_menu(" PXE ",-1); + menu->items_count=0; + set_menu_pos(SUBMENU_Y,SUBMENU_X); + + struct s_pxe *p = &hardware->pxe; + + if (hardware->pci_ids_return_code == -ENOPCIIDS) { + snprintf(buffer,sizeof buffer, "PCI Vendor : %d",p->vendor_id); + snprintf(infobar,sizeof infobar,"PCI Vendor : %d",p->vendor_id); + add_item(buffer,infobar,OPT_INACTIVE,NULL,0); + menu->items_count++; + + snprintf(buffer,sizeof buffer, "PCI Product : %d",p->vendor_id); + snprintf(infobar,sizeof infobar,"PCI Product : %d",p->vendor_id); + add_item(buffer,infobar,OPT_INACTIVE,NULL,0); + menu->items_count++; + + snprintf(buffer,sizeof buffer, "PCI SubVendor : %d",p->subvendor_id); + snprintf(infobar,sizeof infobar,"PCI SubVendor : %d",p->subvendor_id); + add_item(buffer,infobar,OPT_INACTIVE,NULL,0); + menu->items_count++; + + snprintf(buffer,sizeof buffer, "PCI SubProduct : %d",p->subproduct_id); + snprintf(infobar,sizeof infobar,"PCI SubProduct : %d",p->subproduct_id); + add_item(buffer,infobar,OPT_INACTIVE,NULL,0); + menu->items_count++; + + snprintf(buffer,sizeof buffer, "PCI Revision : %d",p->rev); + snprintf(infobar,sizeof infobar,"PCI Revision : %d",p->rev); + add_item(buffer,infobar,OPT_INACTIVE,NULL,0); + menu->items_count++; + + snprintf(buffer,sizeof buffer, "PCI Bus Pos. : %02x:%02x.%02x",p->pci_bus,p->pci_dev, p->pci_func); + snprintf(infobar,sizeof infobar,"PCI Bus Pos. : %02x:%02x.%02x",p->pci_bus,p->pci_dev, p->pci_func); + add_item(buffer,infobar,OPT_INACTIVE,NULL,0); + menu->items_count++; + + } else { + + snprintf(buffer,sizeof buffer, "Manufacturer : %s", p->pci_device->dev_info->vendor_name); + snprintf(infobar,sizeof infobar,"Manufacturer : %s", p->pci_device->dev_info->vendor_name); + add_item(buffer,infobar,OPT_INACTIVE,NULL,0); + menu->items_count++; + + snprintf(buffer,sizeof buffer, "Product : %s", p->pci_device->dev_info->product_name); + snprintf(infobar,sizeof infobar,"Product : %s", p->pci_device->dev_info->product_name); + add_item(buffer,infobar,OPT_INACTIVE,NULL,0); + menu->items_count++; + } + + snprintf(buffer,sizeof buffer, "MAC Address : %s", p->mac_addr); + snprintf(infobar,sizeof infobar, "MAC Address : %s", p->mac_addr); + add_item(buffer,infobar,OPT_INACTIVE,NULL,0); + menu->items_count++; + + snprintf(buffer,sizeof buffer, "IP Address : %d.%d.%d.%d", p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3]); + snprintf(infobar,sizeof infobar, "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,infobar,OPT_INACTIVE,NULL,0); + menu->items_count++; + + printf("MENU: PXE menu done (%d items)\n",menu->items_count); +} diff --git a/com32/hdt/hdt-menu.c b/com32/hdt/hdt-menu.c index 6512900..0c5bfe5 100644 --- a/com32/hdt/hdt-menu.c +++ b/com32/hdt/hdt-menu.c @@ -140,6 +140,7 @@ void compute_submenus(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware) compute_disks(hdt_menu,hardware->disk_info); #ifdef WITH_PCI compute_PCI(hdt_menu,hardware); + compute_PXE(&(hdt_menu->pxe_menu),hardware); compute_kernel(&(hdt_menu->kernel_menu),hardware); #endif compute_syslinuxmenu(&(hdt_menu->syslinux_menu)); @@ -205,9 +206,15 @@ if (hardware->is_dmi_valid) { } add_item("","",OPT_SEP,"",0); #ifdef WITH_PCI - add_item("ernel Modules","Kernel Modules Menu",OPT_SUBMENU,NULL,hdt_menu->kernel_menu.menu); - hdt_menu->main_menu.items_count++; + if (hardware->modules_pcimap_return_code != -ENOMODULESPCIMAP) { + add_item("ernel Modules","Kernel Modules Menu",OPT_SUBMENU,NULL,hdt_menu->kernel_menu.menu); + hdt_menu->main_menu.items_count++; + } #endif + if (hardware->is_pxe_valid == true) { + add_item("PE","PXE Information Menu",OPT_SUBMENU,NULL,hdt_menu->pxe_menu.menu); + hdt_menu->main_menu.items_count++; + } add_item("yslinux","Syslinux Information Menu",OPT_SUBMENU,NULL,hdt_menu->syslinux_menu.menu); hdt_menu->main_menu.items_count++; add_item("Sitch to CLI","Switch to Command Line",OPT_RUN,HDT_SWITCH_TO_CLI,0); diff --git a/com32/hdt/hdt-menu.h b/com32/hdt/hdt-menu.h index 9c61459..725da45 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 pxe_menu; int total_menu_count; // sum of all menus we have }; @@ -105,6 +106,9 @@ void compute_syslinuxmenu(struct s_my_menu *menu); // About menu void compute_aboutmenu(struct s_my_menu *menu); +//PXE menu +void compute_PXE(struct s_my_menu *menu,struct s_hardware *hardware); + int start_menu_mode(struct s_hardware *hardware, char *version_string); void setup_menu(char *version); void compute_main_menu(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware); diff --git a/com32/hdt/hdt.h b/com32/hdt/hdt.h index a9436b1..ba847d5 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.0" +#define VERSION "0.2.1" #define ATTR_PACKED __attribute__((packed)) -- 2.7.4