summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--com32/hdt/Makefile10
-rw-r--r--com32/hdt/hdt-ata.c225
-rw-r--r--com32/hdt/hdt-ata.h69
-rw-r--r--com32/hdt/hdt-cli-cpu.c244
-rw-r--r--com32/hdt/hdt-cli-dmi.c669
-rw-r--r--com32/hdt/hdt-cli-kernel.c203
-rw-r--r--com32/hdt/hdt-cli-pci.c441
-rw-r--r--com32/hdt/hdt-cli-pxe.c100
-rw-r--r--com32/hdt/hdt-cli-syslinux.c48
-rw-r--r--com32/hdt/hdt-cli-vesa.c91
-rw-r--r--com32/hdt/hdt-cli.c420
-rw-r--r--com32/hdt/hdt-cli.h69
-rw-r--r--com32/hdt/hdt-common.c456
-rw-r--r--com32/hdt/hdt-common.h94
-rw-r--r--com32/hdt/hdt-menu-about.c27
-rw-r--r--com32/hdt/hdt-menu-disk.c193
-rw-r--r--com32/hdt/hdt-menu-dmi.c540
-rw-r--r--com32/hdt/hdt-menu-kernel.c86
-rw-r--r--com32/hdt/hdt-menu-pci.c211
-rw-r--r--com32/hdt/hdt-menu-processor.c294
-rw-r--r--com32/hdt/hdt-menu-pxe.c159
-rw-r--r--com32/hdt/hdt-menu-summary.c251
-rw-r--r--com32/hdt/hdt-menu-syslinux.c67
-rw-r--r--com32/hdt/hdt-menu-vesa.c106
-rw-r--r--com32/hdt/hdt-menu.c316
-rw-r--r--com32/hdt/hdt-menu.h85
-rw-r--r--com32/hdt/hdt.c38
-rw-r--r--com32/hdt/hdt.h4
-rw-r--r--com32/include/sys/pci.h4
-rw-r--r--com32/lib/pci/scan.c36
-rw-r--r--com32/lib/sys/vesa/vesa.h2
31 files changed, 3344 insertions, 2214 deletions
diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
index 58715071..d6766f34 100644
--- a/com32/hdt/Makefile
+++ b/com32/hdt/Makefile
@@ -17,6 +17,8 @@
topdir = ../..
include $(topdir)/MCONFIG.embedded
+MODULES = hdt.c32
+
INCLUDES = -I$(com32)/include -I$(com32)/cmenu/libmenu -I$(com32)/gplinclude
LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc)
@@ -30,7 +32,7 @@ LIBS = $(LIB) $(com32)/cmenu/libmenu/libmenu.a \
LDFLAGS = -m elf_i386 -T $(com32)/lib/com32.ld
-all: hdt.c32 $(LIB)
+all: $(MODULES) $(LIB)
.PRECIOUS: %.o
%.o: %.S
@@ -49,8 +51,8 @@ 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-cli-syslinux.o \
- hdt-menu-pxe.o hdt-menu-summary.o\
+ hdt-cli-syslinux.o hdt-cli-vesa.o\
+ hdt-menu-pxe.o hdt-menu-summary.o hdt-menu-vesa.o\
$(LIBS)
$(LD) $(LDFLAGS) -o $@ $^
@@ -68,6 +70,8 @@ $(LIB):
tidy dist:
rm -f *.o *.a *.lst *.elf
+install: all
+
# Don't specify *.com since mdiskchk.com can't be built using Linux tools
clean: tidy
rm -f *.o *.c32 *.c~ *.h~ Makefile~
diff --git a/com32/hdt/hdt-ata.c b/com32/hdt/hdt-ata.c
index a5000609..4e3ea438 100644
--- a/com32/hdt/hdt-ata.c
+++ b/com32/hdt/hdt-ata.c
@@ -24,11 +24,13 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <console.h>
+
#include "com32io.h"
#include "hdt-ata.h"
@@ -47,24 +49,23 @@
* LOCKING:
* caller.
*/
-
-void ata_id_string(const uint16_t *id, unsigned char *s,
- unsigned int ofs, unsigned int len)
+void ata_id_string(const uint16_t * id, unsigned char *s,
+ unsigned int ofs, unsigned int len)
{
- unsigned int c;
+ unsigned int c;
- while (len > 0) {
- c = id[ofs] >> 8;
- *s = c;
- s++;
+ while (len > 0) {
+ c = id[ofs] >> 8;
+ *s = c;
+ s++;
- c = id[ofs] & 0xff;
- *s = c;
- s++;
+ c = id[ofs] & 0xff;
+ *s = c;
+ s++;
- ofs++;
- len -= 2;
- }
+ ofs++;
+ len -= 2;
+ }
}
/**
@@ -81,43 +82,44 @@ void ata_id_string(const uint16_t *id, unsigned char *s,
* LOCKING:
* caller.
*/
-void ata_id_c_string(const uint16_t *id, unsigned char *s,
- unsigned int ofs, unsigned int len)
+void ata_id_c_string(const uint16_t * id, unsigned char *s,
+ unsigned int ofs, unsigned int len)
{
- unsigned char *p;
+ unsigned char *p;
- //WARN_ON(!(len & 1));
+ //WARN_ON(!(len & 1));
- ata_id_string(id, s, ofs, len - 1);
+ ata_id_string(id, s, ofs, len - 1);
- p = s + strnlen(s, len - 1);
- while (p > s && p[-1] == ' ')
- p--;
- *p = '\0';
+ p = s + strnlen(s, len - 1);
+ while (p > s && p[-1] == ' ')
+ p--;
+ *p = '\0';
}
#endif
-/*
+/**
* Call int 13h, but with retry on failure. Especially floppies need this.
*/
-int int13_retry(const com32sys_t *inreg, com32sys_t *outreg)
+int int13_retry(const com32sys_t * inreg, com32sys_t * outreg)
{
- int retry = 6; /* Number of retries */
+ int retry = 6; /* Number of retries */
com32sys_t tmpregs;
- if ( !outreg ) outreg = &tmpregs;
+ if (!outreg)
+ outreg = &tmpregs;
- while ( retry-- ) {
+ while (retry--) {
__intcall(0x13, inreg, outreg);
- if ( !(outreg->eflags.l & EFLAGS_CF) )
- return 0; /* CF=0, OK */
+ if (!(outreg->eflags.l & EFLAGS_CF))
+ return 0; /* CF=0, OK */
}
- return -1; /* Error */
+ return -1; /* Error */
}
/* Display CPU registers for debugging purposes */
-void printregs(const com32sys_t *r)
+void printregs(const com32sys_t * r)
{
printf("eflags = %08x ds = %04x es = %04x fs = %04x gs = %04x\n"
"eax = %08x ebx = %08x ecx = %08x edx = %08x\n"
@@ -127,10 +129,10 @@ void printregs(const com32sys_t *r)
r->ebp.l, r->esi.l, r->edi.l, r->_unused_esp.l);
}
-/* Try to get information for a given disk*/
+/* Try to get information for a given disk */
int get_disk_params(int disk, struct diskinfo *disk_info)
{
- static com32sys_t getparm, parm, getebios, ebios, inreg,outreg;
+ static com32sys_t getparm, parm, getebios, ebios, inreg, outreg;
struct device_parameter dp;
#ifdef ATA
struct ata_identify_device aid;
@@ -141,114 +143,133 @@ int get_disk_params(int disk, struct diskinfo *disk_info)
disk_info[disk].disk = disk;
disk_info[disk].ebios = disk_info[disk].cbios = 0;
- /* Sending int 13h func 41h to query EBIOS information*/
- memset(&getebios, 0, sizeof (com32sys_t));
- memset(&ebios, 0, sizeof (com32sys_t));
+ /* Sending int 13h func 41h to query EBIOS information */
+ memset(&getebios, 0, sizeof(com32sys_t));
+ memset(&ebios, 0, sizeof(com32sys_t));
/* Get EBIOS support */
getebios.eax.w[0] = 0x4100;
getebios.ebx.w[0] = 0x55aa;
getebios.edx.b[0] = disk;
- getebios.eflags.b[0] = 0x3; /* CF set */
+ getebios.eflags.b[0] = 0x3; /* CF set */
__intcall(0x13, &getebios, &ebios);
/* Detecting EDD support */
- if ( !(ebios.eflags.l & EFLAGS_CF) &&
- ebios.ebx.w[0] == 0xaa55 &&
- (ebios.ecx.b[0] & 1) ) {
+ if (!(ebios.eflags.l & EFLAGS_CF) &&
+ ebios.ebx.w[0] == 0xaa55 && (ebios.ecx.b[0] & 1)) {
disk_info[disk].ebios = 1;
- switch(ebios.eax.b[1]) {
- case 32: strlcpy(disk_info[disk].edd_version,"1.0",3); break;
- case 33: strlcpy(disk_info[disk].edd_version,"1.1",3); break;
- case 48: strlcpy(disk_info[disk].edd_version,"3.0",3); break;
- default: strlcpy(disk_info[disk].edd_version,"0",1); break;
+ switch (ebios.eax.b[1]) {
+ case 32:
+ strlcpy(disk_info[disk].edd_version, "1.0", 3);
+ break;
+ case 33:
+ strlcpy(disk_info[disk].edd_version, "1.1", 3);
+ break;
+ case 48:
+ strlcpy(disk_info[disk].edd_version, "3.0", 3);
+ break;
+ default:
+ strlcpy(disk_info[disk].edd_version, "0", 1);
+ break;
}
}
/* Get disk parameters -- really only useful for
- hard disks, but if we have a partitioned floppy
- it's actually our best chance... */
- memset(&getparm, 0, sizeof (com32sys_t));
- memset(&parm, 0, sizeof (com32sys_t));
+ * hard disks, but if we have a partitioned floppy
+ * it's actually our best chance...
+ */
+ memset(&getparm, 0, sizeof(com32sys_t));
+ memset(&parm, 0, sizeof(com32sys_t));
getparm.eax.b[1] = 0x08;
getparm.edx.b[0] = disk;
__intcall(0x13, &getparm, &parm);
- if ( parm.eflags.l & EFLAGS_CF )
+ if (parm.eflags.l & EFLAGS_CF)
return disk_info[disk].ebios ? 0 : -1;
- disk_info[disk].heads = parm.edx.b[1]+1;
+ disk_info[disk].heads = parm.edx.b[1] + 1;
disk_info[disk].sectors_per_track = parm.ecx.b[0] & 0x3f;
- if ( disk_info[disk].sectors_per_track == 0 ) {
+ if (disk_info[disk].sectors_per_track == 0) {
disk_info[disk].sectors_per_track = 1;
} else {
- disk_info[disk].cbios = 1; /* Valid geometry */
- }
+ disk_info[disk].cbios = 1; /* Valid geometry */
+ }
/* FIXME: memset to 0 make it fails
* memset(__com32.cs_bounce, 0, sizeof(struct device_pairameter)); */
- memset(&dp, 0, sizeof(struct device_parameter));
- memset(&inreg, 0, sizeof(com32sys_t));
+ memset(&dp, 0, sizeof(struct device_parameter));
+ memset(&inreg, 0, sizeof(com32sys_t));
- /* Requesting Extended Read Drive Parameters via int13h func 48h*/
- inreg.esi.w[0] = OFFS(__com32.cs_bounce);
- inreg.ds = SEG(__com32.cs_bounce);
- inreg.eax.w[0] = 0x4800;
- inreg.edx.b[0] = disk;
+ /* Requesting Extended Read Drive Parameters via int13h func 48h */
+ inreg.esi.w[0] = OFFS(__com32.cs_bounce);
+ inreg.ds = SEG(__com32.cs_bounce);
+ inreg.eax.w[0] = 0x4800;
+ inreg.edx.b[0] = disk;
- __intcall(0x13, &inreg, &outreg);
+ __intcall(0x13, &inreg, &outreg);
/* Saving bounce buffer before anything corrupt it */
- memcpy(&dp, __com32.cs_bounce, sizeof (struct device_parameter));
+ memcpy(&dp, __com32.cs_bounce, sizeof(struct device_parameter));
- if ( outreg.eflags.l & EFLAGS_CF) {
- printf("Disk 0x%X doesn't supports EDD 3.0\n",disk);
- return -1;
+ if (outreg.eflags.l & EFLAGS_CF) {
+ printf("Disk 0x%X doesn't supports EDD 3.0\n", disk);
+ return -1;
}
- /* Copying result to the disk_info structure
- * host_bus_type, interface_type, sectors & cylinders */
- snprintf(disk_info[disk].host_bus_type,sizeof disk_info[disk].host_bus_type,"%c%c%c%c",dp.host_bus_type[0],dp.host_bus_type[1],dp.host_bus_type[2],dp.host_bus_type[3]);
- snprintf(disk_info[disk].interface_type,sizeof disk_info[disk].interface_type,"%c%c%c%c%c%c%c%c",dp.interface_type[0],dp.interface_type[1],dp.interface_type[2],dp.interface_type[3],dp.interface_type[4],dp.interface_type[5],dp.interface_type[6],dp.interface_type[7]);
- disk_info[disk].sectors=dp.sectors;
- disk_info[disk].cylinders=dp.cylinders;
-
- /*FIXME: we have to find a way to grab the model & fw
- * We do put dummy data until we found a solution */
- snprintf(disk_info[disk].aid.model,sizeof disk_info[disk].aid.model,"0x%X",disk);
- snprintf(disk_info[disk].aid.fw_rev,sizeof disk_info[disk].aid.fw_rev,"%s","N/A");
- snprintf(disk_info[disk].aid.serial_no,sizeof disk_info[disk].aid.serial_no,"%s","N/A");
+ /* Copying result to the disk_info structure
+ * host_bus_type, interface_type, sectors & cylinders */
+ snprintf(disk_info[disk].host_bus_type,
+ sizeof disk_info[disk].host_bus_type, "%c%c%c%c",
+ dp.host_bus_type[0], dp.host_bus_type[1], dp.host_bus_type[2],
+ dp.host_bus_type[3]);
+ snprintf(disk_info[disk].interface_type,
+ sizeof disk_info[disk].interface_type, "%c%c%c%c%c%c%c%c",
+ dp.interface_type[0], dp.interface_type[1],
+ dp.interface_type[2], dp.interface_type[3],
+ dp.interface_type[4], dp.interface_type[5],
+ dp.interface_type[6], dp.interface_type[7]);
+ disk_info[disk].sectors = dp.sectors;
+ disk_info[disk].cylinders = dp.cylinders;
+
+ /*FIXME: we have to find a way to grab the model & fw
+ * We do put dummy data until we found a solution */
+ snprintf(disk_info[disk].aid.model, sizeof disk_info[disk].aid.model,
+ "0x%X", disk);
+ snprintf(disk_info[disk].aid.fw_rev, sizeof disk_info[disk].aid.fw_rev,
+ "%s", "N/A");
+ snprintf(disk_info[disk].aid.serial_no,
+ sizeof disk_info[disk].aid.serial_no, "%s", "N/A");
/* Useless stuff before I figure how to send ata packets */
#ifdef ATA
- memset(__com32.cs_bounce, 0, sizeof(struct device_parameter));
- memset(&aid, 0, sizeof(struct ata_identify_device));
- memset(&inreg, 0, sizeof inreg);
- inreg.ebx.w[0] = OFFS(__com32.cs_bounce+1024);
- inreg.es = SEG(__com32.cs_bounce+1024);
- inreg.eax.w[0] = 0x2500;
- inreg.edx.b[0] = disk;
-
- __intcall(0x13,&inreg, &outreg);
-
- memcpy(&aid, __com32.cs_bounce, sizeof (struct ata_identify_device));
-
- if ( outreg.eflags.l & EFLAGS_CF) {
- printf("Disk 0x%X: Failed to Identify Device\n",disk);
- //FIXME
- return 0;
+ memset(__com32.cs_bounce, 0, sizeof(struct device_parameter));
+ memset(&aid, 0, sizeof(struct ata_identify_device));
+ memset(&inreg, 0, sizeof inreg);
+ inreg.ebx.w[0] = OFFS(__com32.cs_bounce + 1024);
+ inreg.es = SEG(__com32.cs_bounce + 1024);
+ inreg.eax.w[0] = 0x2500;
+ inreg.edx.b[0] = disk;
+
+ __intcall(0x13, &inreg, &outreg);
+
+ memcpy(&aid, __com32.cs_bounce, sizeof(struct ata_identify_device));
+
+ if (outreg.eflags.l & EFLAGS_CF) {
+ printf("Disk 0x%X: Failed to Identify Device\n", disk);
+ //FIXME
+ return 0;
}
// ata_id_c_string(aid, disk_info[disk].fwrev, ATA_ID_FW_REV, sizeof(disk_info[disk].fwrev));
// ata_id_c_string(aid, disk_info[disk].model, ATA_ID_PROD, sizeof(disk_info[disk].model));
char buff[sizeof(struct ata_identify_device)];
- memcpy(buff,&aid, sizeof (struct ata_identify_device));
- for (int j=0;j<sizeof(struct ata_identify_device);j++)
- printf ("model=|%c|\n",buff[j]);
- printf ("Disk 0x%X : %s %s %s\n",disk, aid.model, aid.fw_rev,aid.serial_no);
+ memcpy(buff, &aid, sizeof(struct ata_identify_device));
+ for (int j = 0; j < sizeof(struct ata_identify_device); j++)
+ printf("model=|%c|\n", buff[j]);
+ printf("Disk 0x%X : %s %s %s\n", disk, aid.model, aid.fw_rev,
+ aid.serial_no);
#endif
-return 0;
+ return 0;
}
-
diff --git a/com32/hdt/hdt-ata.h b/com32/hdt/hdt-ata.h
index 7236c549..fee4d598 100644
--- a/com32/hdt/hdt-ata.h
+++ b/com32/hdt/hdt-ata.h
@@ -24,20 +24,20 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#ifndef DEFINE_HDT_ATA_H
#define DEFINE_HDT_ATA_H
+#include <com32io.h>
#include "hdt.h"
-#include <com32io.h>
struct ata_identify_device {
unsigned short words000_009[10];
- unsigned char serial_no[20];
+ unsigned char serial_no[20];
unsigned short words020_022[3];
- unsigned char fw_rev[8];
- unsigned char model[40];
+ unsigned char fw_rev[8];
+ unsigned char model[40];
unsigned short words047_079[33];
unsigned short major_rev_num;
unsigned short minor_rev_num;
@@ -52,8 +52,8 @@ struct ata_identify_device {
struct diskinfo {
int disk;
- int ebios; /* EBIOS supported on this disk */
- int cbios; /* CHS geometry is valid */
+ int ebios; /* EBIOS supported on this disk */
+ int cbios; /* CHS geometry is valid */
int heads;
int sectors_per_track;
int sectors;
@@ -82,39 +82,40 @@ struct ebios_dapa {
// DWORD=32
// QWORD=64
struct device_parameter {
- uint16_t len;
- uint16_t info;
- uint32_t cylinders;
- uint32_t heads;
- uint32_t sectors_per_track;
- uint64_t sectors;
- uint16_t bytes_per_sector;
- uint32_t dpte_pointer;
- uint16_t device_path_information;
- uint8_t device_path_lenght;
- uint8_t device_path_reserved;
- uint16_t device_path_reserved_2;
- uint8_t host_bus_type[4];
- uint8_t interface_type[8];
- uint64_t interace_path;
- uint64_t device_path[2];
- uint8_t reserved;
- uint8_t cheksum;
+ uint16_t len;
+ uint16_t info;
+ uint32_t cylinders;
+ uint32_t heads;
+ uint32_t sectors_per_track;
+ uint64_t sectors;
+ uint16_t bytes_per_sector;
+ uint32_t dpte_pointer;
+ uint16_t device_path_information;
+ uint8_t device_path_lenght;
+ uint8_t device_path_reserved;
+ uint16_t device_path_reserved_2;
+ uint8_t host_bus_type[4];
+ uint8_t interface_type[8];
+ uint64_t interace_path;
+ uint64_t device_path[2];
+ uint8_t reserved;
+ uint8_t cheksum;
} ATTR_PACKED;
-
/* Useless stuff until I manage how to send ata packets */
#ifdef ATA
enum {
- ATA_ID_FW_REV = 23,
- ATA_ID_PROD = 27,
- ATA_ID_FW_REV_LEN = 8,
- ATA_ID_PROD_LEN = 40,
+ ATA_ID_FW_REV = 23,
+ ATA_ID_PROD = 27,
+ ATA_ID_FW_REV_LEN = 8,
+ ATA_ID_PROD_LEN = 40,
};
-void ata_id_c_string(const uint16_t *id, unsigned char *s, unsigned int ofs, unsigned int len);
-void ata_id_string(const uint16_t *id, unsigned char *s, unsigned int ofs, unsigned int len);
-int int13_retry(const com32sys_t *inreg, com32sys_t *outreg);
-void printregs(const com32sys_t *r);
+void ata_id_c_string(const uint16_t * id, unsigned char *s, unsigned int ofs,
+ unsigned int len);
+void ata_id_string(const uint16_t * id, unsigned char *s, unsigned int ofs,
+ unsigned int len);
+int int13_retry(const com32sys_t * inreg, com32sys_t * outreg);
+void printregs(const com32sys_t * r);
#endif
int get_disk_params(int disk, struct diskinfo *disk_info);
diff --git a/com32/hdt/hdt-cli-cpu.c b/com32/hdt/hdt-cli-cpu.c
index edeef24a..cfd66ef7 100644
--- a/com32/hdt/hdt-cli-cpu.c
+++ b/com32/hdt/hdt-cli-cpu.c
@@ -24,128 +24,172 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
-#include "hdt-cli.h"
-#include "hdt-common.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
+#include "hdt-cli.h"
+#include "hdt-common.h"
+void show_cpu(struct s_hardware *hardware)
+{
+ char buffer[81];
+ char buffer1[81];
+ clear_screen();
+ more_printf("CPU\n");
+ more_printf("Vendor : %s\n", hardware->cpu.vendor);
+ more_printf("Model : %s\n", hardware->cpu.model);
+ more_printf("Vendor ID : %d\n", hardware->cpu.vendor_id);
+ more_printf("Family ID : %d\n", hardware->cpu.family);
+ more_printf("Model ID : %d\n", hardware->cpu.model_id);
+ more_printf("Stepping : %d\n", hardware->cpu.stepping);
+ more_printf("FSB : %d MHz\n",
+ hardware->dmi.processor.external_clock);
+ more_printf("Cur. Speed: %d MHz\n",
+ hardware->dmi.processor.current_speed);
+ more_printf("Max Speed : %d MHz\n", hardware->dmi.processor.max_speed);
+ more_printf("Upgrade : %s\n", hardware->dmi.processor.upgrade);
+ if (hardware->cpu.flags.smp) {
+ more_printf("SMP : yes\n");
+ } else {
+ more_printf("SMP : no\n");
+ }
+ if (hardware->cpu.flags.lm) {
+ more_printf("x86_64 : yes\n");
+ } else {
+ more_printf("x86_64 : no\n");
+ }
-void show_cpu(struct s_hardware *hardware) {
- char buffer[81];
- char buffer1[81];
- clear_screen();
- more_printf("CPU\n");
- more_printf("Vendor : %s\n",hardware->cpu.vendor);
- more_printf("Model : %s\n",hardware->cpu.model);
- more_printf("Vendor ID : %d\n",hardware->cpu.vendor_id);
- more_printf("Family ID : %d\n",hardware->cpu.family);
- more_printf("Model ID : %d\n",hardware->cpu.model_id);
- more_printf("Stepping : %d\n",hardware->cpu.stepping);
- more_printf("FSB : %d MHz\n",hardware->dmi.processor.external_clock);
- more_printf("Cur. Speed: %d MHz\n",hardware->dmi.processor.current_speed);
- more_printf("Max Speed : %d MHz\n",hardware->dmi.processor.max_speed);
- more_printf("Upgrade : %s\n", hardware->dmi.processor.upgrade);
- if (hardware->cpu.flags.smp) {
- more_printf("SMP : yes\n");
- } else {
- more_printf("SMP : no\n");
- }
- if (hardware->cpu.flags.lm) {
- more_printf("x86_64 : yes\n");
- } else {
- more_printf("x86_64 : no\n");
- }
-
- memset(buffer,0,sizeof(buffer));
- memset(buffer1,0,sizeof(buffer1));
- if (hardware->cpu.flags.fpu) strcat(buffer1,"fpu ");
- if (hardware->cpu.flags.vme) strcat(buffer1,"vme ");
- if (hardware->cpu.flags.de) strcat(buffer1,"de ");
- if (hardware->cpu.flags.pse) strcat(buffer1,"pse ");
- if (hardware->cpu.flags.tsc) strcat(buffer1,"tsc ");
- if (hardware->cpu.flags.msr) strcat(buffer1,"msr ");
- if (hardware->cpu.flags.pae) strcat(buffer1,"pae ");
-if (hardware->cpu.flags.mce) strcat(buffer1,"mce ");
- if (hardware->cpu.flags.cx8) strcat(buffer1,"cx8 ");
- if (hardware->cpu.flags.apic) strcat(buffer1,"apic ");
- if (hardware->cpu.flags.sep) strcat(buffer1,"sep ");
- if (hardware->cpu.flags.mtrr) strcat(buffer1,"mtrr ");
- if (hardware->cpu.flags.pge) strcat(buffer1,"pge ");
- if (hardware->cpu.flags.mca) strcat(buffer1,"mca ");
- snprintf(buffer,sizeof buffer,"Flags : %s\n",buffer1);
- more_printf(buffer);
+ memset(buffer, 0, sizeof(buffer));
+ memset(buffer1, 0, sizeof(buffer1));
+ if (hardware->cpu.flags.fpu)
+ strcat(buffer1, "fpu ");
+ if (hardware->cpu.flags.vme)
+ strcat(buffer1, "vme ");
+ if (hardware->cpu.flags.de)
+ strcat(buffer1, "de ");
+ if (hardware->cpu.flags.pse)
+ strcat(buffer1, "pse ");
+ if (hardware->cpu.flags.tsc)
+ strcat(buffer1, "tsc ");
+ if (hardware->cpu.flags.msr)
+ strcat(buffer1, "msr ");
+ if (hardware->cpu.flags.pae)
+ strcat(buffer1, "pae ");
+ if (hardware->cpu.flags.mce)
+ strcat(buffer1, "mce ");
+ if (hardware->cpu.flags.cx8)
+ strcat(buffer1, "cx8 ");
+ if (hardware->cpu.flags.apic)
+ strcat(buffer1, "apic ");
+ if (hardware->cpu.flags.sep)
+ strcat(buffer1, "sep ");
+ if (hardware->cpu.flags.mtrr)
+ strcat(buffer1, "mtrr ");
+ if (hardware->cpu.flags.pge)
+ strcat(buffer1, "pge ");
+ if (hardware->cpu.flags.mca)
+ strcat(buffer1, "mca ");
+ snprintf(buffer, sizeof buffer, "Flags : %s\n", buffer1);
+ more_printf(buffer);
- memset(buffer,0,sizeof(buffer));
- memset(buffer1,0,sizeof(buffer1));
- if (hardware->cpu.flags.cmov) strcat(buffer1,"cmov ");
- if (hardware->cpu.flags.pat) strcat(buffer1,"pat ");
- if (hardware->cpu.flags.pse_36) strcat(buffer1,"pse_36 ");
- if (hardware->cpu.flags.psn) strcat(buffer1,"psn ");
- if (hardware->cpu.flags.clflsh) strcat(buffer1,"clflsh ");
- if (hardware->cpu.flags.dts) strcat(buffer1,"dts ");
- if (hardware->cpu.flags.acpi) strcat(buffer1,"acpi ");
- if (hardware->cpu.flags.mmx) strcat(buffer1,"mmx ");
- if (hardware->cpu.flags.sse) strcat(buffer1,"sse ");
- if (hardware->cpu.flags.sse2) strcat(buffer1,"sse2 ");
- if (hardware->cpu.flags.ss) strcat(buffer1,"ss ");
- snprintf(buffer,sizeof buffer,"Flags : %s\n",buffer1);
- more_printf(buffer);
+ memset(buffer, 0, sizeof(buffer));
+ memset(buffer1, 0, sizeof(buffer1));
+ if (hardware->cpu.flags.cmov)
+ strcat(buffer1, "cmov ");
+ if (hardware->cpu.flags.pat)
+ strcat(buffer1, "pat ");
+ if (hardware->cpu.flags.pse_36)
+ strcat(buffer1, "pse_36 ");
+ if (hardware->cpu.flags.psn)
+ strcat(buffer1, "psn ");
+ if (hardware->cpu.flags.clflsh)
+ strcat(buffer1, "clflsh ");
+ if (hardware->cpu.flags.dts)
+ strcat(buffer1, "dts ");
+ if (hardware->cpu.flags.acpi)
+ strcat(buffer1, "acpi ");
+ if (hardware->cpu.flags.mmx)
+ strcat(buffer1, "mmx ");
+ if (hardware->cpu.flags.sse)
+ strcat(buffer1, "sse ");
+ if (hardware->cpu.flags.sse2)
+ strcat(buffer1, "sse2 ");
+ if (hardware->cpu.flags.ss)
+ strcat(buffer1, "ss ");
+ snprintf(buffer, sizeof buffer, "Flags : %s\n", buffer1);
+ more_printf(buffer);
- memset(buffer,0,sizeof(buffer));
- memset(buffer1,0,sizeof(buffer1));
- if (hardware->cpu.flags.htt) strcat(buffer1,"ht ");
- if (hardware->cpu.flags.acc) strcat(buffer1,"acc ");
- if (hardware->cpu.flags.syscall) strcat(buffer1,"syscall ");
- if (hardware->cpu.flags.mp) strcat(buffer1,"mp ");
- if (hardware->cpu.flags.nx) strcat(buffer1,"nx ");
- if (hardware->cpu.flags.mmxext) strcat(buffer1,"mmxext ");
- if (hardware->cpu.flags.lm) strcat(buffer1,"lm ");
- if (hardware->cpu.flags.nowext) strcat(buffer1,"3dnowext ");
- if (hardware->cpu.flags.now) strcat(buffer1,"3dnow! ");
- snprintf(buffer,sizeof buffer,"Flags : %s\n",buffer1);
- more_printf(buffer);
+ memset(buffer, 0, sizeof(buffer));
+ memset(buffer1, 0, sizeof(buffer1));
+ if (hardware->cpu.flags.htt)
+ strcat(buffer1, "ht ");
+ if (hardware->cpu.flags.acc)
+ strcat(buffer1, "acc ");
+ if (hardware->cpu.flags.syscall)
+ strcat(buffer1, "syscall ");
+ if (hardware->cpu.flags.mp)
+ strcat(buffer1, "mp ");
+ if (hardware->cpu.flags.nx)
+ strcat(buffer1, "nx ");
+ if (hardware->cpu.flags.mmxext)
+ strcat(buffer1, "mmxext ");
+ if (hardware->cpu.flags.lm)
+ strcat(buffer1, "lm ");
+ if (hardware->cpu.flags.nowext)
+ strcat(buffer1, "3dnowext ");
+ if (hardware->cpu.flags.now)
+ strcat(buffer1, "3dnow! ");
+ snprintf(buffer, sizeof buffer, "Flags : %s\n", buffer1);
+ more_printf(buffer);
}
-void show_cpu_help() {
- more_printf("Show supports the following commands : %s\n",CLI_CPU);
+static void show_cpu_help()
+{
+ more_printf("Show supports the following commands : %s\n", CLI_CPU);
}
-void cpu_show(char *item, struct s_hardware *hardware) {
- if ( !strncmp(item, CLI_CPU, sizeof(CLI_CPU) - 1) ) {
- show_cpu(hardware);
- return;
- }
- show_cpu_help();
+static void cpu_show(char *item, struct s_hardware *hardware)
+{
+ if (!strncmp(item, CLI_CPU, sizeof(CLI_CPU) - 1)) {
+ show_cpu(hardware);
+ return;
+ }
+ show_cpu_help();
}
-void handle_cpu_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware) {
- if ( !strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1) ) {
- cpu_show(strstr(cli_line,"show")+ sizeof(CLI_SHOW), hardware);
+void handle_cpu_commands(char *cli_line, struct s_hardware *hardware)
+{
+ if (!strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1)) {
+ cpu_show(strstr(cli_line, "show") + sizeof(CLI_SHOW), hardware);
return;
- }
+ }
}
-void main_show_cpu(struct s_hardware *hardware,struct s_cli_mode *cli_mode) {
+void main_show_cpu(struct s_hardware *hardware)
+{
cpu_detect(hardware);
detect_dmi(hardware);
more_printf("CPU\n");
more_printf(" Manufacturer : %s \n", hardware->cpu.vendor);
more_printf(" Product : %s \n", hardware->cpu.model);
- if ((hardware->cpu.flags.lm == false) && (hardware->cpu.flags.smp==false)) {
- more_printf(" Features : %d MhZ : x86 32bits\n", hardware->dmi.processor.current_speed);
- } else if ((hardware->cpu.flags.lm == false) && (hardware->cpu.flags.smp==true)) {
- more_printf(" Features : %d MhZ : x86 32bits SMP\n", hardware->dmi.processor.current_speed);
- } else if ((hardware->cpu.flags.lm == true) && (hardware->cpu.flags.smp==false)) {
- more_printf(" Features : %d MhZ : x86_64 64bits\n", hardware->dmi.processor.current_speed);
- } else {
- more_printf(" Features : %d MhZ : x86_64 64bits SMP\n", hardware->dmi.processor.current_speed);
- }
-
+ if ((hardware->cpu.flags.lm == false)
+ && (hardware->cpu.flags.smp == false)) {
+ more_printf(" Features : %d MhZ : x86 32bits\n",
+ hardware->dmi.processor.current_speed);
+ } else if ((hardware->cpu.flags.lm == false)
+ && (hardware->cpu.flags.smp == true)) {
+ more_printf(" Features : %d MhZ : x86 32bits SMP\n",
+ hardware->dmi.processor.current_speed);
+ } else if ((hardware->cpu.flags.lm == true)
+ && (hardware->cpu.flags.smp == false)) {
+ more_printf(" Features : %d MhZ : x86_64 64bits\n",
+ hardware->dmi.processor.current_speed);
+ } else {
+ more_printf(" Features : %d MhZ : x86_64 64bits SMP\n",
+ hardware->dmi.processor.current_speed);
+ }
}
-
-
diff --git a/com32/hdt/hdt-cli-dmi.c b/com32/hdt/hdt-cli-dmi.c
index c9820657..0fe0845b 100644
--- a/com32/hdt/hdt-cli-dmi.c
+++ b/com32/hdt/hdt-cli-dmi.c
@@ -24,7 +24,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#include "hdt-cli.h"
#include "hdt-common.h"
@@ -33,328 +33,419 @@
#include <stdlib.h>
#include <errno.h>
-void show_dmi_help(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(hardware);
-}
-
+static void show_dmi_modules(struct s_hardware *hardware)
+{
+ char available_dmi_commands[1024];
+ memset(available_dmi_commands, 0, sizeof(available_dmi_commands));
-void dmi_show(char *item, struct s_hardware *hardware) {
- if ( !strncmp(item, CLI_DMI_BASE_BOARD, sizeof(CLI_DMI_BASE_BOARD) - 1) ) {
- show_dmi_base_board(hardware);
- return;
- }
- if ( !strncmp(item, CLI_DMI_SYSTEM, sizeof(CLI_DMI_SYSTEM) - 1) ) {
- show_dmi_system(hardware);
- return;
- }
- if ( !strncmp(item, CLI_DMI_BIOS, sizeof(CLI_DMI_BIOS) - 1) ) {
- show_dmi_bios(hardware);
- return;
- }
- if ( !strncmp(item, CLI_DMI_CHASSIS, sizeof(CLI_DMI_CHASSIS) - 1) ) {
- show_dmi_chassis(hardware);
- return;
- }
- if ( !strncmp(item, CLI_DMI_PROCESSOR, sizeof(CLI_DMI_PROCESSOR) - 1) ) {
- show_dmi_cpu(hardware);
- return;
- }
- if ( !strncmp(item, CLI_DMI_MEMORY, sizeof(CLI_DMI_MEMORY) - 1) ) {
- show_dmi_memory_modules(hardware,true,true);
- return;
- }
- if ( !strncmp(item, CLI_DMI_MEMORY_BANK, sizeof(CLI_DMI_MEMORY_BANK) - 1) ) {
- show_dmi_memory_bank(hardware,item+ sizeof(CLI_DMI_MEMORY_BANK)-1);
- return;
- }
- if ( !strncmp(item, CLI_SHOW_LIST, sizeof(CLI_SHOW_LIST) - 1) ) {
- show_dmi_modules(hardware);
- return;
- }
- if ( !strncmp(item, CLI_DMI_BATTERY, sizeof(CLI_DMI_BATTERY) - 1) ) {
- show_dmi_battery(hardware);
- return;
- }
+ 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);
+ }
+ printf("Available DMI modules: %s\n", available_dmi_commands);
+}
- show_dmi_help(hardware);
+static void show_dmi_help(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(hardware);
}
-void handle_dmi_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware) {
- if ( !strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1) ) {
- dmi_show(strstr(cli_line,"show")+ sizeof(CLI_SHOW), hardware);
+static 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++) {
+ if (((bool *) (&hardware->dmi.base_board.features))[i] == true) {
+ more_printf(" %s\n", base_board_features_strings[i]);
+ }
+ }
}
-void show_dmi_modules(struct s_hardware *hardware) {
- 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);
- }
- printf("Available DMI modules: %s\n",available_dmi_commands);
+static 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);
}
-void main_show_dmi(struct s_hardware *hardware,struct s_cli_mode *cli_mode) {
+static 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);
- detect_dmi(hardware);
+ 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]);
+ }
+ }
- if (hardware->is_dmi_valid==false) {
- printf("No valid DMI table found, exiting.\n");
- do_exit(cli_mode);
- return;
- }
- printf("DMI Table version %d.%d found\n",hardware->dmi.dmitable.major_version,hardware->dmi.dmitable.minor_version);
+ 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]);
+ }
+ }
- show_dmi_modules(hardware);
}
+static 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);
+}
-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++) {
- if (((bool *)(& hardware->dmi.base_board.features))[i] == true) {
- more_printf(" %s\n", base_board_features_strings[i]);
- }
- }
+static void show_dmi_battery(struct s_hardware *hardware)
+{
+ if (hardware->dmi.battery.filled == false) {
+ printf("Battery module not available\n");
+ return;
+ }
+ clear_screen();
+ more_printf("Battery \n");
+ more_printf(" Vendor : %s\n",
+ hardware->dmi.battery.manufacturer);
+ more_printf(" Manufacture Date : %s\n",
+ hardware->dmi.battery.manufacture_date);
+ more_printf(" Serial : %s\n", hardware->dmi.battery.serial);
+ more_printf(" Name : %s\n", hardware->dmi.battery.name);
+ more_printf(" Chemistry : %s\n",
+ hardware->dmi.battery.chemistry);
+ more_printf(" Design Capacity : %s\n",
+ hardware->dmi.battery.design_capacity);
+ more_printf(" Design Voltage : %s\n",
+ hardware->dmi.battery.design_voltage);
+ more_printf(" SBDS : %s\n", hardware->dmi.battery.sbds);
+ more_printf(" SBDS Manuf. Date : %s\n",
+ hardware->dmi.battery.sbds_manufacture_date);
+ more_printf(" SBDS Chemistry : %s\n",
+ hardware->dmi.battery.sbds_chemistry);
+ more_printf(" Maximum Error : %s\n",
+ hardware->dmi.battery.maximum_error);
+ more_printf(" OEM Info : %s\n",
+ hardware->dmi.battery.oem_info);
}
-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);
+static 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(" 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);
+ 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]);
+ }
+ }
}
-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);
+static void show_dmi_memory_bank(struct s_hardware *hardware, const char *item)
+{
+ long bank = strtol(item, (char **)NULL, 10);
+ if (errno == ERANGE) {
+ printf("This bank number is incorrect\n");
+ return;
+ }
- 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]);
+ if ((bank >= hardware->dmi.memory_count) || (bank < 0)) {
+ printf("Bank %d number doesn't exists\n", bank);
+ return;
}
- }
- 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]);
+ if (hardware->dmi.memory[bank].filled == false) {
+ printf("Bank %d doesn't contain any information\n", bank);
+ return;
}
- }
- 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]);
+ printf("Memory Bank %d\n", bank);
+ more_printf(" Form Factor : %s\n",
+ hardware->dmi.memory[bank].form_factor);
+ more_printf(" Type : %s\n", hardware->dmi.memory[bank].type);
+ more_printf(" Type Detail : %s\n",
+ hardware->dmi.memory[bank].type_detail);
+ more_printf(" Speed : %s\n", hardware->dmi.memory[bank].speed);
+ more_printf(" Size : %s\n", hardware->dmi.memory[bank].size);
+ more_printf(" Device Set : %s\n",
+ hardware->dmi.memory[bank].device_set);
+ more_printf(" Device Loc. : %s\n",
+ hardware->dmi.memory[bank].device_locator);
+ more_printf(" Bank Locator : %s\n",
+ hardware->dmi.memory[bank].bank_locator);
+ more_printf(" Total Width : %s\n",
+ hardware->dmi.memory[bank].total_width);
+ more_printf(" Data Width : %s\n",
+ hardware->dmi.memory[bank].data_width);
+ more_printf(" Error : %s\n", hardware->dmi.memory[bank].error);
+ more_printf(" Vendor : %s\n",
+ hardware->dmi.memory[bank].manufacturer);
+ more_printf(" Serial : %s\n", hardware->dmi.memory[bank].serial);
+ more_printf(" Asset Tag : %s\n",
+ hardware->dmi.memory[bank].asset_tag);
+ more_printf(" Part Number : %s\n",
+ hardware->dmi.memory[bank].part_number);
+}
+
+void dmi_show(char *item, struct s_hardware *hardware)
+{
+ if (!strncmp(item, CLI_DMI_BASE_BOARD, sizeof(CLI_DMI_BASE_BOARD) - 1)) {
+ show_dmi_base_board(hardware);
+ return;
+ }
+ if (!strncmp(item, CLI_DMI_SYSTEM, sizeof(CLI_DMI_SYSTEM) - 1)) {
+ show_dmi_system(hardware);
+ return;
+ }
+ if (!strncmp(item, CLI_DMI_BIOS, sizeof(CLI_DMI_BIOS) - 1)) {
+ show_dmi_bios(hardware);
+ return;
+ }
+ if (!strncmp(item, CLI_DMI_CHASSIS, sizeof(CLI_DMI_CHASSIS) - 1)) {
+ show_dmi_chassis(hardware);
+ return;
+ }
+ if (!strncmp(item, CLI_DMI_PROCESSOR, sizeof(CLI_DMI_PROCESSOR) - 1)) {
+ show_dmi_cpu(hardware);
+ return;
+ }
+ if (!strncmp(item, CLI_DMI_MEMORY, sizeof(CLI_DMI_MEMORY) - 1)) {
+ show_dmi_memory_modules(hardware, true, true);
+ return;
+ }
+ if (!strncmp
+ (item, CLI_DMI_MEMORY_BANK, sizeof(CLI_DMI_MEMORY_BANK) - 1)) {
+ show_dmi_memory_bank(hardware,
+ item + sizeof(CLI_DMI_MEMORY_BANK) - 1);
+ return;
+ }
+ if (!strncmp(item, CLI_SHOW_LIST, sizeof(CLI_SHOW_LIST) - 1)) {
+ show_dmi_modules(hardware);
+ return;
+ }
+ if (!strncmp(item, CLI_DMI_BATTERY, sizeof(CLI_DMI_BATTERY) - 1)) {
+ show_dmi_battery(hardware);
+ return;
}
- }
+ show_dmi_help(hardware);
}
-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);
+void handle_dmi_commands(char *cli_line, struct s_hardware *hardware)
+{
+ if (!strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1)) {
+ dmi_show(strstr(cli_line, "show") + sizeof(CLI_SHOW), hardware);
+ return;
+ }
}
-void show_dmi_battery(struct s_hardware *hardware) {
- if (hardware->dmi.battery.filled==false) {
- printf("Battery module not available\n");
- return;
- }
- clear_screen();
- more_printf("Battery \n");
- more_printf(" Vendor : %s\n",hardware->dmi.battery.manufacturer);
- more_printf(" Manufacture Date : %s\n",hardware->dmi.battery.manufacture_date);
- more_printf(" Serial : %s\n",hardware->dmi.battery.serial);
- more_printf(" Name : %s\n",hardware->dmi.battery.name);
- more_printf(" Chemistry : %s\n",hardware->dmi.battery.chemistry);
- more_printf(" Design Capacity : %s\n",hardware->dmi.battery.design_capacity);
- more_printf(" Design Voltage : %s\n",hardware->dmi.battery.design_voltage);
- more_printf(" SBDS : %s\n",hardware->dmi.battery.sbds);
- more_printf(" SBDS Manuf. Date : %s\n",hardware->dmi.battery.sbds_manufacture_date);
- more_printf(" SBDS Chemistry : %s\n",hardware->dmi.battery.sbds_chemistry);
- more_printf(" Maximum Error : %s\n",hardware->dmi.battery.maximum_error);
- more_printf(" OEM Info : %s\n",hardware->dmi.battery.oem_info);
-}
+void main_show_dmi(struct s_hardware *hardware)
+{
-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(" 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);
- 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]);
- }
- }
+ detect_dmi(hardware);
+ if (hardware->is_dmi_valid == false) {
+ printf("No valid DMI table found, exiting.\n");
+ return;
+ }
+ printf("DMI Table version %d.%d found\n",
+ hardware->dmi.dmitable.major_version,
+ hardware->dmi.dmitable.minor_version);
+
+ show_dmi_modules(hardware);
}
-void show_dmi_memory_modules(struct s_hardware *hardware, bool clear, bool show_free_banks) {
- char bank_number[10];
- char available_dmi_commands[1024];
- memset(available_dmi_commands,0,sizeof(available_dmi_commands));
+void show_dmi_memory_modules(struct s_hardware *hardware, bool clear,
+ bool show_free_banks)
+{
+ char bank_number[10];
+ char available_dmi_commands[1024];
+ memset(available_dmi_commands, 0, sizeof(available_dmi_commands));
- if (hardware->dmi.memory_count <=0) {
- printf("No memory module found\n");
- return;
- }
+ if (hardware->dmi.memory_count <= 0) {
+ printf("No memory module found\n");
+ return;
+ }
- if (clear) clear_screen();
- more_printf("Memory Banks\n");
- 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 */
- strncat(available_dmi_commands,CLI_DMI_MEMORY_BANK,sizeof(CLI_DMI_MEMORY_BANK)-1);
- memset(bank_number,0,sizeof(bank_number));
- snprintf(bank_number,sizeof(bank_number),"%d ",i);
- strncat(available_dmi_commands,bank_number,sizeof(bank_number));
- if (show_free_banks==false) {
- if (strncmp(hardware->dmi.memory[i].size,"Free",4))
- printf(" bank %02d : %s %s@%s\n",i,hardware->dmi.memory[i].size, hardware->dmi.memory[i].type, hardware->dmi.memory[i].speed);
- } else {
- printf(" bank %02d : %s %s@%s\n",i,hardware->dmi.memory[i].size, hardware->dmi.memory[i].type, hardware->dmi.memory[i].speed);
- }
+ if (clear)
+ clear_screen();
+ more_printf("Memory Banks\n");
+ 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 */
+ strncat(available_dmi_commands, CLI_DMI_MEMORY_BANK,
+ sizeof(CLI_DMI_MEMORY_BANK) - 1);
+ memset(bank_number, 0, sizeof(bank_number));
+ snprintf(bank_number, sizeof(bank_number), "%d ", i);
+ strncat(available_dmi_commands, bank_number,
+ sizeof(bank_number));
+ if (show_free_banks == false) {
+ if (strncmp
+ (hardware->dmi.memory[i].size, "Free", 4))
+ printf(" bank %02d : %s %s@%s\n",
+ i, hardware->dmi.memory[i].size,
+ hardware->dmi.memory[i].type,
+ hardware->dmi.memory[i].speed);
+ } else {
+ printf(" bank %02d : %s %s@%s\n", i,
+ hardware->dmi.memory[i].size,
+ hardware->dmi.memory[i].type,
+ hardware->dmi.memory[i].speed);
+ }
}
- }
- //printf("Type 'show bank<bank_number>' for more details.\n");
-}
-
-void show_dmi_memory_bank(struct s_hardware *hardware, const char *item) {
- long bank = strtol(item,(char **) NULL,10);
- if (errno == ERANGE) {
- printf("This bank number is incorrect\n");
- return;
- }
- if ((bank>=hardware->dmi.memory_count) || (bank<0)) {
- printf("Bank %d number doesn't exists\n",bank);
- return;
- }
-
- if (hardware->dmi.memory[bank].filled==false) {
- printf("Bank %d doesn't contain any information\n",bank);
- return;
- }
- printf("Memory Bank %d\n",bank);
- more_printf(" Form Factor : %s\n",hardware->dmi.memory[bank].form_factor);
- more_printf(" Type : %s\n",hardware->dmi.memory[bank].type);
- more_printf(" Type Detail : %s\n",hardware->dmi.memory[bank].type_detail);
- more_printf(" Speed : %s\n",hardware->dmi.memory[bank].speed);
- more_printf(" Size : %s\n",hardware->dmi.memory[bank].size);
- more_printf(" Device Set : %s\n",hardware->dmi.memory[bank].device_set);
- more_printf(" Device Loc. : %s\n",hardware->dmi.memory[bank].device_locator);
- more_printf(" Bank Locator : %s\n",hardware->dmi.memory[bank].bank_locator);
- more_printf(" Total Width : %s\n",hardware->dmi.memory[bank].total_width);
- more_printf(" Data Width : %s\n",hardware->dmi.memory[bank].data_width);
- more_printf(" Error : %s\n",hardware->dmi.memory[bank].error);
- more_printf(" Vendor : %s\n",hardware->dmi.memory[bank].manufacturer);
- more_printf(" Serial : %s\n",hardware->dmi.memory[bank].serial);
- more_printf(" Asset Tag : %s\n",hardware->dmi.memory[bank].asset_tag);
- more_printf(" Part Number : %s\n",hardware->dmi.memory[bank].part_number);
+ }
+ //printf("Type 'show bank<bank_number>' for more details.\n");
}
diff --git a/com32/hdt/hdt-cli-kernel.c b/com32/hdt/hdt-cli-kernel.c
index b5c453f1..5b0df1d2 100644
--- a/com32/hdt/hdt-cli-kernel.c
+++ b/com32/hdt/hdt-cli-kernel.c
@@ -24,124 +24,147 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
-#include "hdt-cli.h"
-#include "hdt-common.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
-void main_show_kernel(struct s_hardware *hardware,struct s_cli_mode *cli_mode) {
- char buffer[1024];
- struct pci_device *pci_device;
- bool found=false;
- char kernel_modules [LINUX_KERNEL_MODULE_SIZE*MAX_KERNEL_MODULES_PER_PCI_DEVICE];
+#include "hdt-cli.h"
+#include "hdt-common.h"
+
+void main_show_kernel(struct s_hardware *hardware)
+{
+ char buffer[1024];
+ struct pci_device *pci_device;
+ bool found = false;
+ char kernel_modules[LINUX_KERNEL_MODULE_SIZE *
+ MAX_KERNEL_MODULES_PER_PCI_DEVICE];
- memset(buffer,0,sizeof(buffer));
+ memset(buffer, 0, sizeof(buffer));
- detect_pci(hardware);
- more_printf("Kernel modules\n");
+ detect_pci(hardware);
+ more_printf("Kernel modules\n");
// more_printf(" PCI device no: %d \n", p->pci_device_pos);
- if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) {
- more_printf(" modules.pcimap is missing\n");
- return;
- }
+ if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) {
+ more_printf(" modules.pcimap is missing\n");
+ return;
+ }
/* For every detected pci device, compute its submenu */
- for_each_pci_func(pci_device, hardware->pci_domain) {
- memset(kernel_modules,0,sizeof kernel_modules);
-
- for (int kmod=0; kmod<pci_device->dev_info->linux_kernel_module_count;kmod++) {
- if (kmod>0) {
- strncat(kernel_modules," | ",3);
- }
- strncat(kernel_modules, pci_device->dev_info->linux_kernel_module[kmod],LINUX_KERNEL_MODULE_SIZE-1);
- }
-
- if ((pci_device->dev_info->linux_kernel_module_count>0) && (!strstr(buffer,kernel_modules))) {
- found=true;
- if (pci_device->dev_info->linux_kernel_module_count>1) strncat(buffer,"(",1);
- strncat(buffer, kernel_modules, sizeof(kernel_modules));
- if (pci_device->dev_info->linux_kernel_module_count>1) strncat(buffer,")",1);
- strncat(buffer," # ", 3);
- }
-
- }
- if (found ==true) {
- strncat(buffer,"\n",1);
- more_printf(buffer);
- }
+ for_each_pci_func(pci_device, hardware->pci_domain) {
+ memset(kernel_modules, 0, sizeof kernel_modules);
+
+ for (int kmod = 0;
+ kmod < pci_device->dev_info->linux_kernel_module_count;
+ kmod++) {
+ if (kmod > 0) {
+ strncat(kernel_modules, " | ", 3);
+ }
+ strncat(kernel_modules,
+ pci_device->dev_info->linux_kernel_module[kmod],
+ LINUX_KERNEL_MODULE_SIZE - 1);
+ }
+
+ if ((pci_device->dev_info->linux_kernel_module_count > 0)
+ && (!strstr(buffer, kernel_modules))) {
+ found = true;
+ if (pci_device->dev_info->linux_kernel_module_count > 1)
+ strncat(buffer, "(", 1);
+ strncat(buffer, kernel_modules, sizeof(kernel_modules));
+ if (pci_device->dev_info->linux_kernel_module_count > 1)
+ strncat(buffer, ")", 1);
+ strncat(buffer, " # ", 3);
+ }
+
+ }
+ if (found == true) {
+ strncat(buffer, "\n", 1);
+ more_printf(buffer);
+ }
}
-void show_kernel_modules(struct s_hardware *hardware) {
- int i=1;
- struct pci_device *pci_device;
- char kernel_modules [LINUX_KERNEL_MODULE_SIZE*MAX_KERNEL_MODULES_PER_PCI_DEVICE];
- bool nopciids=false;
- bool nomodulespcimap=false;
- char first_line[81];
- char second_line[81];
- char modules[MAX_PCI_CLASSES][256];
- char category_name[MAX_PCI_CLASSES][256];
-
- detect_pci(hardware);
- memset(&modules,0,sizeof(modules));
-
- if (hardware->pci_ids_return_code == -ENOPCIIDS) {
- nopciids=true;
+static void show_kernel_modules(struct s_hardware *hardware)
+{
+ struct pci_device *pci_device;
+ char kernel_modules[LINUX_KERNEL_MODULE_SIZE *
+ MAX_KERNEL_MODULES_PER_PCI_DEVICE];
+ bool nopciids = false;
+ bool nomodulespcimap = false;
+ char modules[MAX_PCI_CLASSES][256];
+ char category_name[MAX_PCI_CLASSES][256];
+
+ detect_pci(hardware);
+ memset(&modules, 0, sizeof(modules));
+
+ if (hardware->pci_ids_return_code == -ENOPCIIDS) {
+ nopciids = true;
more_printf(" Missing pci.ids, we can't compute the list\n");
return;
}
- if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) {
- nomodulespcimap=true;
- more_printf(" Missing modules.pcimap, we can't compute the list\n");
+ if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) {
+ nomodulespcimap = true;
+ more_printf
+ (" Missing modules.pcimap, we can't compute the list\n");
return;
- }
-
- clear_screen();
-
- for_each_pci_func(pci_device, hardware->pci_domain) {
- memset(kernel_modules,0,sizeof kernel_modules);
-
- for (int kmod=0; kmod<pci_device->dev_info->linux_kernel_module_count;kmod++) {
- strncat(kernel_modules, pci_device->dev_info->linux_kernel_module[kmod],LINUX_KERNEL_MODULE_SIZE-1);
- strncat(kernel_modules," ",1);
- }
+ }
- if ((pci_device->dev_info->linux_kernel_module_count>0) && (!strstr(modules[pci_device->class[2]],kernel_modules))) {
- strncat(modules[pci_device->class[2]], kernel_modules, sizeof(kernel_modules));
- snprintf(category_name[pci_device->class[2]], sizeof(category_name[pci_device->class[2]]),"%s",pci_device->dev_info->category_name);
- }
+ clear_screen();
+
+ for_each_pci_func(pci_device, hardware->pci_domain) {
+ memset(kernel_modules, 0, sizeof kernel_modules);
+
+ for (int kmod = 0;
+ kmod < pci_device->dev_info->linux_kernel_module_count;
+ kmod++) {
+ strncat(kernel_modules,
+ pci_device->dev_info->linux_kernel_module[kmod],
+ LINUX_KERNEL_MODULE_SIZE - 1);
+ strncat(kernel_modules, " ", 1);
+ }
+
+ if ((pci_device->dev_info->linux_kernel_module_count > 0)
+ && (!strstr(modules[pci_device->class[2]], kernel_modules)))
+ {
+ strncat(modules[pci_device->class[2]], kernel_modules,
+ sizeof(kernel_modules));
+ snprintf(category_name[pci_device->class[2]],
+ sizeof(category_name[pci_device->class[2]]),
+ "%s", pci_device->dev_info->category_name);
+ }
}
- /* print the found items */
- for (int i=0; i<MAX_PCI_CLASSES;i++) {
- if (strlen(category_name[i])>1) {
- more_printf("%s : %s\n",category_name[i], modules[i]);
- }
+ /* Print the found items */
+ for (int i = 0; i < MAX_PCI_CLASSES; i++) {
+ if (strlen(category_name[i]) > 1) {
+ more_printf("%s : %s\n", category_name[i], modules[i]);
+ }
}
}
-void show_kernel_help() {
- more_printf("Show supports the following commands : %s\n",CLI_SHOW_LIST);
+static void show_kernel_help()
+{
+ more_printf("Show supports the following commands : %s\n",
+ CLI_SHOW_LIST);
}
-void kernel_show(char *item, struct s_hardware *hardware) {
- if ( !strncmp(item, CLI_SHOW_LIST, sizeof(CLI_SHOW_LIST) - 1) ) {
- show_kernel_modules(hardware);
- return;
- }
- show_kernel_help();
+void kernel_show(char *item, struct s_hardware *hardware)
+{
+ if (!strncmp(item, CLI_SHOW_LIST, sizeof(CLI_SHOW_LIST) - 1)) {
+ show_kernel_modules(hardware);
+ return;
+ }
+ show_kernel_help();
}
-void handle_kernel_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware) {
- if ( !strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1) ) {
- kernel_show(strstr(cli_line,"show")+ sizeof(CLI_SHOW), hardware);
+void handle_kernel_commands(char *cli_line, struct s_hardware *hardware)
+{
+ if (!strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1)) {
+ kernel_show(strstr(cli_line, "show") + sizeof(CLI_SHOW),
+ hardware);
return;
- }
+ }
}
-
diff --git a/com32/hdt/hdt-cli-pci.c b/com32/hdt/hdt-cli-pci.c
index 554c2ce5..31cfe771 100644
--- a/com32/hdt/hdt-cli-pci.c
+++ b/com32/hdt/hdt-cli-pci.c
@@ -24,218 +24,285 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
-#include "hdt-cli.h"
-#include "hdt-common.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-void show_pci_device(struct s_hardware *hardware, const char *item) {
- int i=0;
- struct pci_device *pci_device=NULL, *temp_pci_device;
- long pcidev = strtol(item,(char **) NULL,10);
- bool nopciids=false;
- bool nomodulespcimap=false;
- char kernel_modules [LINUX_KERNEL_MODULE_SIZE*MAX_KERNEL_MODULES_PER_PCI_DEVICE];
- int bus=0,slot=0,func=0;
-
- if (errno == ERANGE) {
- printf("This PCI device number is incorrect\n");
- return;
- }
- if ((pcidev > hardware->nb_pci_devices) || (pcidev<=0)) {
- printf("PCI device %d doesn't exists\n",pcidev);
- return;
- }
-
- if (hardware->pci_ids_return_code == -ENOPCIIDS) {
- nopciids=true;
- }
-
- if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) {
- nomodulespcimap=true;
- }
-
- for_each_pci_func(temp_pci_device, hardware->pci_domain) {
- i++;
- if (i==pcidev) {
- bus=__pci_bus;
- slot=__pci_slot;
- func=__pci_func;
- pci_device=temp_pci_device;
- }
- }
-
- if (pci_device == NULL) {
- printf("We were enabled to find PCI device %d\n",pcidev);
- return;
- }
-
- memset(kernel_modules,0,sizeof kernel_modules);
- for (int kmod=0; kmod<pci_device->dev_info->linux_kernel_module_count;kmod++) {
- if (kmod>0) {
- strncat(kernel_modules," | ",3);
- }
- strncat(kernel_modules, pci_device->dev_info->linux_kernel_module[kmod],LINUX_KERNEL_MODULE_SIZE-1);
- }
- if (pci_device->dev_info->linux_kernel_module_count==0) strlcpy(kernel_modules,"unknown",7);
-
- clear_screen();
- printf("PCI Device %d\n",pcidev);
-
- if (nopciids == false) {
- more_printf("Vendor Name : %s\n", pci_device->dev_info->vendor_name);
- more_printf("Product Name : %s\n", pci_device->dev_info->product_name);
- more_printf("Class Name : %s\n", pci_device->dev_info->class_name);
- }
-
- if (nomodulespcimap == false) {
- more_printf("Kernel module : %s\n", kernel_modules);
- }
-
- more_printf("Vendor ID : %04x\n",pci_device->vendor);
- more_printf("Product ID : %04x\n",pci_device->product);
- more_printf("SubVendor ID : %04x\n",pci_device->sub_vendor);
- more_printf("SubProduct ID : %04x\n",pci_device->sub_product);
- more_printf("Class ID : %02x.%02x.%02x\n",pci_device->class[2], pci_device->class[1],pci_device->class[0]);
- more_printf("Revision : %02x\n",pci_device->revision);
- more_printf("PCI Bus : %02d\n",bus);
- more_printf("PCI Slot : %02d\n",slot);
- more_printf("PCI Func : %02d\n",func);
-
- if (hardware->is_pxe_valid == true) {
- more_printf("Mac Address : %s\n",hardware->pxe.mac_addr);
- if ((hardware->pxe.pci_device != NULL) && (hardware->pxe.pci_device == pci_device))
- more_printf("PXE : Current boot device\n",func);
- }
-}
+#include "hdt-cli.h"
+#include "hdt-common.h"
+
+void show_pci_device(struct s_hardware *hardware, const char *item)
+{
+ int i = 0;
+ struct pci_device *pci_device = NULL, *temp_pci_device;
+ long pcidev = strtol(item, (char **)NULL, 10);
+ bool nopciids = false;
+ bool nomodulespcimap = false;
+ char kernel_modules[LINUX_KERNEL_MODULE_SIZE *
+ MAX_KERNEL_MODULES_PER_PCI_DEVICE];
+ int bus = 0, slot = 0, func = 0;
+
+ if (errno == ERANGE) {
+ printf("This PCI device number is incorrect\n");
+ return;
+ }
+ if ((pcidev > hardware->nb_pci_devices) || (pcidev <= 0)) {
+ printf("PCI device %d doesn't exists\n", pcidev);
+ return;
+ }
+ if (hardware->pci_ids_return_code == -ENOPCIIDS) {
+ nopciids = true;
+ }
+ if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) {
+ nomodulespcimap = true;
+ }
+
+ for_each_pci_func(temp_pci_device, hardware->pci_domain) {
+ i++;
+ if (i == pcidev) {
+ bus = __pci_bus;
+ slot = __pci_slot;
+ func = __pci_func;
+ pci_device = temp_pci_device;
+ }
+ }
+
+ if (pci_device == NULL) {
+ printf("We were enabled to find PCI device %d\n", pcidev);
+ return;
+ }
+
+ memset(kernel_modules, 0, sizeof kernel_modules);
+ for (int kmod = 0;
+ kmod < pci_device->dev_info->linux_kernel_module_count; kmod++) {
+ if (kmod > 0) {
+ strncat(kernel_modules, " | ", 3);
+ }
+ strncat(kernel_modules,
+ pci_device->dev_info->linux_kernel_module[kmod],
+ LINUX_KERNEL_MODULE_SIZE - 1);
+ }
+ if (pci_device->dev_info->linux_kernel_module_count == 0)
+ strlcpy(kernel_modules, "unknown", 7);
-void show_pci_devices(struct s_hardware *hardware) {
- int i=1;
- struct pci_device *pci_device;
- char kernel_modules [LINUX_KERNEL_MODULE_SIZE*MAX_KERNEL_MODULES_PER_PCI_DEVICE];
- bool nopciids=false;
- bool nomodulespcimap=false;
- char first_line[81];
- char second_line[81];
+ clear_screen();
+ printf("PCI Device %d\n", pcidev);
- clear_screen();
- more_printf("%d PCI devices detected\n",hardware->nb_pci_devices);
+ if (nopciids == false) {
+ more_printf("Vendor Name : %s\n",
+ pci_device->dev_info->vendor_name);
+ more_printf("Product Name : %s\n",
+ pci_device->dev_info->product_name);
+ more_printf("Class Name : %s\n",
+ pci_device->dev_info->class_name);
+ }
- if (hardware->pci_ids_return_code == -ENOPCIIDS) {
- nopciids=true;
+ if (nomodulespcimap == false) {
+ more_printf("Kernel module : %s\n", kernel_modules);
}
- if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) {
- nomodulespcimap=true;
- }
+ more_printf("Vendor ID : %04x\n", pci_device->vendor);
+ more_printf("Product ID : %04x\n", pci_device->product);
+ more_printf("SubVendor ID : %04x\n", pci_device->sub_vendor);
+ more_printf("SubProduct ID : %04x\n", pci_device->sub_product);
+ more_printf("Class ID : %02x.%02x.%02x\n", pci_device->class[2],
+ pci_device->class[1], pci_device->class[0]);
+ more_printf("Revision : %02x\n", pci_device->revision);
+ if ((pci_device->dev_info->irq > 0)
+ && (pci_device->dev_info->irq < 255))
+ more_printf("IRQ : %0d\n", pci_device->dev_info->irq);
+ more_printf("Latency : %0d\n",pci_device->dev_info->latency);
+ more_printf("PCI Bus : %02d\n", bus);
+ more_printf("PCI Slot : %02d\n", slot);
+ more_printf("PCI Func : %02d\n", func);
+
+ if (hardware->is_pxe_valid == true) {
+ more_printf("Mac Address : %s\n", hardware->pxe.mac_addr);
+ if ((hardware->pxe.pci_device != NULL)
+ && (hardware->pxe.pci_device == pci_device))
+ more_printf("PXE : Current boot device\n",
+ func);
+ }
+}
+
+static void show_pci_devices(struct s_hardware *hardware)
+{
+ int i = 1;
+ struct pci_device *pci_device;
+ char kernel_modules[LINUX_KERNEL_MODULE_SIZE *
+ MAX_KERNEL_MODULES_PER_PCI_DEVICE];
+ bool nopciids = false;
+ bool nomodulespcimap = false;
+ char first_line[81];
+ char second_line[81];
+
+ clear_screen();
+ more_printf("%d PCI devices detected\n", hardware->nb_pci_devices);
+
+ if (hardware->pci_ids_return_code == -ENOPCIIDS) {
+ nopciids = true;
+ }
+ if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) {
+ nomodulespcimap = true;
+ }
/* For every detected pci device, compute its submenu */
- for_each_pci_func(pci_device, hardware->pci_domain) {
- memset(kernel_modules,0,sizeof kernel_modules);
- for (int kmod=0; kmod<pci_device->dev_info->linux_kernel_module_count;kmod++) {
- if (kmod>0) {
- strncat(kernel_modules," | ",3);
- }
- strncat(kernel_modules, pci_device->dev_info->linux_kernel_module[kmod],LINUX_KERNEL_MODULE_SIZE-1);
- }
- if (pci_device->dev_info->linux_kernel_module_count==0) strlcpy(kernel_modules,"unknown",7);
-
- if (nopciids == false) {
- snprintf(first_line,sizeof(first_line),"%02d: %s %s \n",
- i,pci_device->dev_info->vendor_name,
- pci_device->dev_info->product_name);
- if (nomodulespcimap == false)
- snprintf(second_line,sizeof(second_line)," # %-25s # Kmod: %s\n", pci_device->dev_info->class_name, kernel_modules);
- else
- snprintf(second_line,sizeof(second_line)," # %-25s # ID:%04x:%04x[%04x:%04x]\n",
- pci_device->dev_info->class_name,
- pci_device->vendor, pci_device->product,
- pci_device->sub_vendor, pci_device->sub_product);
-
- more_printf(first_line);
- more_printf(second_line);
- more_printf("\n");
- } else if (nopciids == true) {
- if (nomodulespcimap == true) {
- more_printf("%02d: %04x:%04x [%04x:%04x] \n",
- i, pci_device->vendor, pci_device->product,
- pci_device->sub_vendor, pci_device->sub_product,kernel_modules);
+ for_each_pci_func(pci_device, hardware->pci_domain) {
+ memset(kernel_modules, 0, sizeof kernel_modules);
+ for (int kmod = 0;
+ kmod < pci_device->dev_info->linux_kernel_module_count;
+ kmod++) {
+ if (kmod > 0) {
+ strncat(kernel_modules, " | ", 3);
+ }
+ strncat(kernel_modules,
+ pci_device->dev_info->linux_kernel_module[kmod],
+ LINUX_KERNEL_MODULE_SIZE - 1);
}
- else {
- more_printf("%02d: %04x:%04x [%04x:%04x] Kmod:%s\n",
- i,
- pci_device->vendor, pci_device->product,
- pci_device->sub_vendor, pci_device->sub_product,kernel_modules,
- pci_device->sub_product,kernel_modules);
+ if (pci_device->dev_info->linux_kernel_module_count == 0)
+ strlcpy(kernel_modules, "unknown", 7);
+
+ if (nopciids == false) {
+ snprintf(first_line, sizeof(first_line),
+ "%02d: %s %s \n", i,
+ pci_device->dev_info->vendor_name,
+ pci_device->dev_info->product_name);
+ if (nomodulespcimap == false)
+ snprintf(second_line, sizeof(second_line),
+ " # %-25s # Kmod: %s\n",
+ pci_device->dev_info->class_name,
+ kernel_modules);
+ else
+ snprintf(second_line, sizeof(second_line),
+ " # %-25s # ID:%04x:%04x[%04x:%04x]\n",
+ pci_device->dev_info->class_name,
+ pci_device->vendor,
+ pci_device->product,
+ pci_device->sub_vendor,
+ pci_device->sub_product);
+
+ more_printf(first_line);
+ more_printf(second_line);
+ more_printf("\n");
+ } else if (nopciids == true) {
+ if (nomodulespcimap == true) {
+ more_printf("%02d: %04x:%04x [%04x:%04x] \n",
+ i, pci_device->vendor,
+ pci_device->product,
+ pci_device->sub_vendor,
+ pci_device->sub_product);
+ } else {
+ more_printf
+ ("%02d: %04x:%04x [%04x:%04x] Kmod:%s\n", i,
+ pci_device->vendor, pci_device->product,
+ pci_device->sub_vendor,
+ pci_device->sub_product, kernel_modules,
+ pci_device->sub_product, kernel_modules);
+ }
}
- }
- i++;
- }
+ i++;
+ }
}
-void show_pci_help() {
- more_printf("Show supports the following commands : \n");
- more_printf(" %s\n",CLI_SHOW_LIST);
- more_printf(" %s <device_number>\n",CLI_PCI_DEVICE);
+
+static void show_pci_irq(struct s_hardware *hardware)
+{
+ struct pci_device *pci_device;
+ bool nopciids = false;
+
+ clear_screen();
+ more_printf("%d PCI devices detected\n", hardware->nb_pci_devices);
+ more_printf("IRQ : product\n");
+ more_printf("-------------\n");
+
+ if (hardware->pci_ids_return_code == -ENOPCIIDS) {
+ nopciids = true;
+ }
+
+ /* For every detected pci device, compute its submenu */
+ for_each_pci_func(pci_device, hardware->pci_domain) {
+ /* Only display valid IRQs */
+ if ((pci_device->dev_info->irq > 0) && (pci_device->dev_info->irq < 255)) {
+ if (nopciids == false) {
+ more_printf("%02d : %s %s \n",
+ pci_device->dev_info->irq,
+ pci_device->dev_info->vendor_name,
+ pci_device->dev_info->product_name);
+ } else {
+ more_printf("%02d : %04x:%04x [%04x:%04x] \n",
+ pci_device->dev_info->irq, pci_device->vendor,
+ pci_device->product,
+ pci_device->sub_vendor,
+ pci_device->sub_product);
+ }
+ }
+ }
}
-void pci_show(char *item, struct s_hardware *hardware) {
- if ( !strncmp(item, CLI_SHOW_LIST, sizeof(CLI_SHOW_LIST) - 1) ) {
- show_pci_devices(hardware);
- return;
- }
- if ( !strncmp(item, CLI_PCI_DEVICE, sizeof(CLI_PCI_DEVICE) - 1) ) {
- show_pci_device(hardware,item+ sizeof(CLI_PCI_DEVICE)-1);
- return;
- }
- show_pci_help();
+static void show_pci_help()
+{
+ more_printf("Show supports the following commands : \n");
+ more_printf(" %s\n", CLI_SHOW_LIST);
+ more_printf(" %s <device_number>\n", CLI_PCI_DEVICE);
+ more_printf(" %s\n",CLI_IRQ);
}
-void handle_pci_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware) {
- if ( !strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1) ) {
- pci_show(strstr(cli_line,"show")+ sizeof(CLI_SHOW), hardware);
+static void pci_show(char *item, struct s_hardware *hardware)
+{
+ if (!strncmp(item, CLI_SHOW_LIST, sizeof(CLI_SHOW_LIST) - 1)) {
+ show_pci_devices(hardware);
return;
- }
+ }
+ if (!strncmp(item, CLI_IRQ, sizeof(CLI_IRQ) - 1)) {
+ show_pci_irq(hardware);
+ return;
+ }
+ if (!strncmp(item, CLI_PCI_DEVICE, sizeof(CLI_PCI_DEVICE) - 1)) {
+ show_pci_device(hardware, item + sizeof(CLI_PCI_DEVICE) - 1);
+ return;
+ }
+ show_pci_help();
}
-
-void cli_detect_pci(struct s_hardware *hardware) {
- bool error=false;
- if (hardware->pci_detection==false) {
- detect_pci(hardware);
- if (hardware->pci_ids_return_code == -ENOPCIIDS) {
- more_printf("The pci.ids file is missing, device names can't be computed.\n");
- more_printf("Please put one in same dir as hdt\n");
- error=true;
- }
- if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) {
- more_printf("The modules.pcimap file is missing, device names can't be computed.\n");
- more_printf("Please put one in same dir as hdt\n");
- error=true;
- }
- if (error == true) {
- char tempbuf[10];\
- printf("Press enter to continue\n");\
- fgets(tempbuf, sizeof(tempbuf), stdin);\
- }
- }
+void handle_pci_commands(char *cli_line, struct s_hardware *hardware)
+{
+ if (!strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1)) {
+ pci_show(strstr(cli_line, "show") + sizeof(CLI_SHOW), hardware);
+ return;
+ }
}
-void main_show_pci(struct s_hardware *hardware) {
- int i=1;
- char kernel_modules [LINUX_KERNEL_MODULE_SIZE*MAX_KERNEL_MODULES_PER_PCI_DEVICE];
- struct pci_device *pci_device;
- bool nopciids=false;
- bool nomodulespcimap=false;
- char first_line[81];
- char second_line[81];
- char third_line[81];
- cli_detect_pci(hardware);
+void cli_detect_pci(struct s_hardware *hardware)
+{
+ bool error = false;
+ if (hardware->pci_detection == false) {
+ detect_pci(hardware);
+ if (hardware->pci_ids_return_code == -ENOPCIIDS) {
+ more_printf
+ ("The pci.ids file is missing, device names can't be computed.\n");
+ more_printf("Please put one in same dir as hdt\n");
+ error = true;
+ }
+ if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) {
+ more_printf
+ ("The modules.pcimap file is missing, device names can't be computed.\n");
+ more_printf("Please put one in same dir as hdt\n");
+ error = true;
+ }
+ if (error == true) {
+ char tempbuf[10];
+ printf("Press enter to continue\n");
+ fgets(tempbuf, sizeof(tempbuf), stdin);
+ }
+ }
+}
- more_printf("PCI\n");
- more_printf(" NB Devices : %d\n",hardware->nb_pci_devices);
+void main_show_pci(struct s_hardware *hardware)
+{
+ cli_detect_pci(hardware);
+ more_printf("PCI\n");
+ more_printf(" NB Devices : %d\n", hardware->nb_pci_devices);
}
diff --git a/com32/hdt/hdt-cli-pxe.c b/com32/hdt/hdt-cli-pxe.c
index 2ad6981a..772c0dfd 100644
--- a/com32/hdt/hdt-cli-pxe.c
+++ b/com32/hdt/hdt-cli-pxe.c
@@ -24,10 +24,8 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
-#include "hdt-cli.h"
-#include "hdt-common.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -35,56 +33,68 @@
#include <syslinux/pxe.h>
#include <syslinux/config.h>
-void main_show_pxe(struct s_hardware *hardware,struct s_cli_mode *cli_mode) {
- char buffer[81];
- memset(buffer,0,sizeof(81));
- if (hardware->sv->filesystem != SYSLINUX_FS_PXELINUX) {
- more_printf("You are not currently using PXELINUX\n");
- return;
- }
+#include "hdt-cli.h"
+#include "hdt-common.h"
- detect_pxe(hardware);
- more_printf("PXE\n");
- if (hardware->is_pxe_valid==false) {
- more_printf(" No valid PXE ROM found\n");
- return;
- }
+void main_show_pxe(struct s_hardware *hardware)
+{
+ char buffer[81];
+ memset(buffer, 0, sizeof(81));
+ if (hardware->sv->filesystem != SYSLINUX_FS_PXELINUX) {
+ more_printf("You are not currently using PXELINUX\n");
+ return;
+ }
- struct s_pxe *p = &hardware->pxe;
- more_printf(" PCI device no: %d \n", p->pci_device_pos);
+ detect_pxe(hardware);
+ more_printf("PXE\n");
+ if (hardware->is_pxe_valid == false) {
+ more_printf(" No valid PXE ROM found\n");
+ return;
+ }
- if (hardware->pci_ids_return_code == -ENOPCIIDS) {
- snprintf(buffer,sizeof(buffer)," PCI ID : %04x:%04x[%04x:%04X] rev(%02x)\n",
- p->vendor_id, p->product_id, p->subvendor_id, p->subproduct_id,
- p->rev);
- snprintf(buffer,sizeof(buffer)," PCI Bus pos. : %02x:%02x.%02x\n",
- p->pci_bus,p->pci_dev, p->pci_func);
- more_printf(buffer);
- } else {
- snprintf(buffer,sizeof(buffer)," Manufacturer : %s \n", p->pci_device->dev_info->vendor_name);
- more_printf(buffer);
- snprintf(buffer,sizeof(buffer)," Product : %s \n", p->pci_device->dev_info->product_name);
- more_printf(buffer);
- }
- more_printf( " Addresses : %d.%d.%d.%d @ %s\n",p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3],p->mac_addr);
-}
+ struct s_pxe *p = &hardware->pxe;
+ more_printf(" PCI device no: %d \n", p->pci_device_pos);
-void show_pxe_help() {
- more_printf("Show supports the following commands : %s\n",CLI_SHOW_LIST);
+ if (hardware->pci_ids_return_code == -ENOPCIIDS) {
+ snprintf(buffer, sizeof(buffer),
+ " PCI ID : %04x:%04x[%04x:%04X] rev(%02x)\n",
+ p->vendor_id, p->product_id, p->subvendor_id,
+ p->subproduct_id, p->rev);
+ snprintf(buffer, sizeof(buffer),
+ " PCI Bus pos. : %02x:%02x.%02x\n", p->pci_bus,
+ p->pci_dev, p->pci_func);
+ more_printf(buffer);
+ } else {
+ snprintf(buffer, sizeof(buffer), " Manufacturer : %s \n",
+ p->pci_device->dev_info->vendor_name);
+ more_printf(buffer);
+ snprintf(buffer, sizeof(buffer), " Product : %s \n",
+ p->pci_device->dev_info->product_name);
+ more_printf(buffer);
+ }
+ more_printf(" Addresses : %d.%d.%d.%d @ %s\n", p->ip_addr[0],
+ p->ip_addr[1], p->ip_addr[2], p->ip_addr[3], p->mac_addr);
}
-void pxe_show(char *item, struct s_hardware *hardware) {
- if ( !strncmp(item, CLI_SHOW_LIST, sizeof(CLI_SHOW_LIST) - 1) ) {
- main_show_pxe(hardware,NULL);
- return;
- }
- show_pxe_help();
+static void show_pxe_help()
+{
+ more_printf("Show supports the following commands : %s\n",
+ CLI_SHOW_LIST);
}
-void handle_pxe_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware) {
- if ( !strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1) ) {
- pxe_show(strstr(cli_line,"show")+ sizeof(CLI_SHOW), hardware);
+static void pxe_show(char *item, struct s_hardware *hardware)
+{
+ if (!strncmp(item, CLI_SHOW_LIST, sizeof(CLI_SHOW_LIST) - 1)) {
+ main_show_pxe(hardware);
return;
- }
+ }
+ show_pxe_help();
}
+void handle_pxe_commands(char *cli_line, struct s_hardware *hardware)
+{
+ if (!strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1)) {
+ pxe_show(strstr(cli_line, "show") + sizeof(CLI_SHOW), hardware);
+ return;
+ }
+}
diff --git a/com32/hdt/hdt-cli-syslinux.c b/com32/hdt/hdt-cli-syslinux.c
index 1a0c1e0e..77a44f31 100644
--- a/com32/hdt/hdt-cli-syslinux.c
+++ b/com32/hdt/hdt-cli-syslinux.c
@@ -24,10 +24,8 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
-#include "hdt-cli.h"
-#include "hdt-common.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -35,31 +33,39 @@
#include <syslinux/pxe.h>
#include <syslinux/config.h>
-void main_show_syslinux(struct s_hardware *hardware,struct s_cli_mode *cli_mode) {
+#include "hdt-cli.h"
+#include "hdt-common.h"
+
+void main_show_syslinux(struct s_hardware *hardware)
+{
more_printf("SYSLINUX\n");
more_printf(" Bootloader : %s\n", hardware->syslinux_fs);
- more_printf(" Version : %s\n", hardware->sv->version_string+2);
- more_printf(" Version : %u\n",hardware->sv->version);
- more_printf(" Max API : %u\n",hardware->sv->max_api);
- more_printf(" Copyright : %s\n", hardware->sv->copyright_string+1);
+ more_printf(" Version : %s\n", hardware->sv->version_string + 2);
+ more_printf(" Version : %u\n", hardware->sv->version);
+ more_printf(" Max API : %u\n", hardware->sv->max_api);
+ more_printf(" Copyright : %s\n", hardware->sv->copyright_string + 1);
}
-void show_syslinux_help() {
- more_printf("Show supports the following commands : %s\n",CLI_SHOW_LIST);
+static void show_syslinux_help()
+{
+ more_printf("Show supports the following commands : %s\n",
+ CLI_SHOW_LIST);
}
-void syslinux_show(char *item, struct s_hardware *hardware) {
- if ( !strncmp(item, CLI_SHOW_LIST, sizeof(CLI_SHOW_LIST) - 1) ) {
- main_show_syslinux(hardware,NULL);
- return;
- }
- show_syslinux_help();
+static void syslinux_show(char *item, struct s_hardware *hardware)
+{
+ if (!strncmp(item, CLI_SHOW_LIST, sizeof(CLI_SHOW_LIST) - 1)) {
+ main_show_syslinux(hardware);
+ return;
+ }
+ show_syslinux_help();
}
-void handle_syslinux_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware) {
- if ( !strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1) ) {
- syslinux_show(strstr(cli_line,"show")+ sizeof(CLI_SHOW), hardware);
+void handle_syslinux_commands(char *cli_line, struct s_hardware *hardware)
+{
+ if (!strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1)) {
+ syslinux_show(strstr(cli_line, "show") + sizeof(CLI_SHOW),
+ hardware);
return;
- }
+ }
}
-
diff --git a/com32/hdt/hdt-cli-vesa.c b/com32/hdt/hdt-cli-vesa.c
new file mode 100644
index 00000000..507a3abf
--- /dev/null
+++ b/com32/hdt/hdt-cli-vesa.c
@@ -0,0 +1,91 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * 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-cli.h"
+#include "hdt-common.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
+void main_show_vesa(struct s_hardware *hardware) {
+ detect_vesa(hardware);
+ if (hardware->is_vesa_valid==false) {
+ more_printf("No VESA BIOS detected\n");
+ return;
+ }
+ more_printf("VESA\n");
+ more_printf(" Vesa version : %d.%d\n",hardware->vesa.major_version, hardware->vesa.minor_version);
+ more_printf(" Vendor : %s\n",hardware->vesa.vendor);
+ more_printf(" Product : %s\n",hardware->vesa.product);
+ more_printf(" Product rev. : %s\n",hardware->vesa.product_revision);
+ more_printf(" Software rev.: %s\n",hardware->vesa.software_rev);
+ more_printf(" Memory (KB) : %d\n",hardware->vesa.total_memory*64);
+ more_printf(" Modes : %d\n",hardware->vesa.vmi_count);
+}
+
+void show_vesa_modes(struct s_hardware *hardware) {
+ detect_vesa(hardware);
+ if (hardware->is_vesa_valid==false) {
+ more_printf("No VESA BIOS detected\n");
+ return;
+ }
+ clear_screen();
+ more_printf(" ResH. x ResV x Bits : vga= : Vesa Mode\n",hardware->vesa.vmi_count);
+ more_printf("----------------------------------------\n",hardware->vesa.vmi_count);
+
+ for (int i=0;i<hardware->vesa.vmi_count;i++) {
+ struct vesa_mode_info *mi=&hardware->vesa.vmi[i].mi;
+ more_printf("%5u %5u %3u %3d 0x%04x\n",
+ mi->h_res, mi->v_res, mi->bpp, hardware->vesa.vmi[i].mode+0x200,hardware->vesa.vmi[i].mode);
+ }
+}
+
+void show_vesa_help() {
+ more_printf("Show supports the following commands : %s %s\n",CLI_SHOW_LIST, CLI_MODES);
+}
+
+void vesa_show(char *item, struct s_hardware *hardware) {
+ if ( !strncmp(item, CLI_SHOW_LIST, sizeof(CLI_SHOW_LIST) - 1) ) {
+ main_show_vesa(hardware);
+ return;
+ }
+ if ( !strncmp(item, CLI_MODES, sizeof(CLI_MODES) - 1) ) {
+ show_vesa_modes(hardware);
+ return;
+ }
+ show_vesa_help();
+}
+
+void handle_vesa_commands(char *cli_line, struct s_hardware *hardware) {
+ if ( !strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1) ) {
+ vesa_show(strstr(cli_line,"show")+ sizeof(CLI_SHOW), hardware);
+ return;
+ }
+}
+
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 3f714858..7c1dc79c 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -24,231 +24,313 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
-#include "hdt-cli.h"
-#include "hdt-common.h"
#include <stdlib.h>
#include <string.h>
#include <syslinux/config.h>
-void set_mode(struct s_cli_mode *cli_mode, cli_mode_t mode, struct s_hardware *hardware) {
- switch (mode) {
+#include "hdt-cli.h"
+#include "hdt-common.h"
+
+static void set_mode(struct s_cli_mode *cli_mode, cli_mode_t mode,
+ struct s_hardware *hardware)
+{
+ switch (mode) {
case EXIT_MODE:
- cli_mode->mode=mode;
- snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ", CLI_EXIT);
- break;
+ cli_mode->mode = mode;
+ snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ",
+ CLI_EXIT);
+ break;
case HDT_MODE:
- cli_mode->mode=mode;
- snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ", CLI_HDT);
- break;
+ cli_mode->mode = mode;
+ snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ",
+ CLI_HDT);
+ break;
case PXE_MODE:
- if (hardware->sv->filesystem != SYSLINUX_FS_PXELINUX) {
- more_printf("You are not currently using PXELINUX\n");
- break;
- }
- cli_mode->mode=mode;
- snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ", CLI_PXE);
- break;
+ if (hardware->sv->filesystem != SYSLINUX_FS_PXELINUX) {
+ more_printf("You are not currently using PXELINUX\n");
+ break;
+ }
+ cli_mode->mode = mode;
+ snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ",
+ CLI_PXE);
+ break;
case KERNEL_MODE:
- detect_pci(hardware);
- cli_mode->mode=mode;
- snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ", CLI_KERNEL);
- break;
+ detect_pci(hardware);
+ cli_mode->mode = mode;
+ snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ",
+ CLI_KERNEL);
+ break;
case SYSLINUX_MODE:
- cli_mode->mode=mode;
- snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ", CLI_SYSLINUX);
- break;
+ cli_mode->mode = mode;
+ snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ",
+ CLI_SYSLINUX);
+ break;
+
+ case VESA_MODE:
+ cli_mode->mode=mode;
+ snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ", CLI_VESA);
+ break;
case PCI_MODE:
- cli_mode->mode=mode;
- snprintf(cli_mode->prompt,sizeof(cli_mode->prompt),"%s> ", CLI_PCI);
- if (!hardware->pci_detection)
- cli_detect_pci(hardware);
- break;
+ cli_mode->mode = mode;
+ snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ",
+ CLI_PCI);
+ if (!hardware->pci_detection)
+ cli_detect_pci(hardware);
+ break;
case CPU_MODE:
- cli_mode->mode=mode;
- snprintf(cli_mode->prompt,sizeof(cli_mode->prompt),"%s> ", CLI_CPU);
- if (!hardware->dmi_detection)
- detect_dmi(hardware);
- if (!hardware->cpu_detection)
- cpu_detect(hardware);
- break;
+ cli_mode->mode = mode;
+ snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ",
+ CLI_CPU);
+ if (!hardware->dmi_detection)
+ detect_dmi(hardware);
+ if (!hardware->cpu_detection)
+ cpu_detect(hardware);
+ break;
case DMI_MODE:
- detect_dmi(hardware);
- if (!hardware->is_dmi_valid) {
- printf("No valid DMI table found, exiting.\n");
- break;
- }
- cli_mode->mode=mode;
- snprintf(cli_mode->prompt,sizeof(cli_mode->prompt),"%s> ",CLI_DMI);
- break;
- }
+ detect_dmi(hardware);
+ if (!hardware->is_dmi_valid) {
+ printf("No valid DMI table found, exiting.\n");
+ break;
+ }
+ cli_mode->mode = mode;
+ snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ",
+ CLI_DMI);
+ break;
+ }
}
-void handle_hdt_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware) {
- /* hdt cli mode specific commands */
- if ( !strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1) ) {
- main_show(strstr(cli_line,"show")+ sizeof (CLI_SHOW), hardware,cli_mode);
- return;
- }
+static void handle_hdt_commands(char *cli_line, struct s_hardware *hardware)
+{
+ /* hdt cli mode specific commands */
+ if (!strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1)) {
+ main_show(strstr(cli_line, "show") + sizeof(CLI_SHOW), hardware);
+ return;
+ }
+}
+
+static void show_cli_help(struct s_cli_mode *cli_mode)
+{
+ switch (cli_mode->mode) {
+ case HDT_MODE:
+ printf
+ ("Available commands are : %s %s %s %s %s %s %s %s %s %s\n",
+ CLI_CLEAR, CLI_EXIT, CLI_HELP, CLI_SHOW, CLI_PCI, CLI_DMI,
+ CLI_PXE, CLI_KERNEL, CLI_CPU, CLI_SYSLINUX);
+ break;
+ case SYSLINUX_MODE:
+ case KERNEL_MODE:
+ case PXE_MODE:
+ case VESA_MODE:
+ case CPU_MODE:
+ case PCI_MODE:
+ case DMI_MODE:
+ printf("Available commands are : %s %s %s %s\n",
+ CLI_CLEAR, CLI_EXIT, CLI_HELP, CLI_SHOW);
+ break;
+ case EXIT_MODE: /* Should not happen */
+ break;
+ }
}
-/* Code that manage the cli mode */
-void start_cli_mode(struct s_hardware *hardware, int argc, char *argv[]) {
- char cli_line[256];
- struct s_cli_mode cli_mode;
+/* Code that manages the cli mode */
+void start_cli_mode(struct s_hardware *hardware)
+{
+ char cli_line[256];
+ struct s_cli_mode cli_mode;
- set_mode(&cli_mode,HDT_MODE,hardware);
+ set_mode(&cli_mode, HDT_MODE, hardware);
- printf("Entering CLI mode\n");
+ printf("Entering CLI mode\n");
- for (;;) {
- memset(cli_line,0,sizeof cli_line);
- printf("%s",cli_mode.prompt);
+ for (;;) {
+ memset(cli_line, 0, sizeof cli_line);
+ printf("%s", cli_mode.prompt);
- fgets(cli_line, sizeof cli_line, stdin);
- cli_line[strlen(cli_line)-1]='\0';
+ fgets(cli_line, sizeof cli_line, stdin);
/* We use sizeof BLAH - 1 to remove the last \0 */
+ cli_line[strlen(cli_line) - 1] = '\0';
- if ( !strncmp(cli_line, CLI_EXIT, sizeof(CLI_EXIT) - 1) ) {
- int mode=do_exit(&cli_mode);
- if (mode == EXIT_MODE)
- return;
- set_mode(&cli_mode,mode,hardware);
- continue;
+ if (!strncmp(cli_line, CLI_EXIT, sizeof(CLI_EXIT) - 1)) {
+ int mode = do_exit(&cli_mode);
+ if (mode == EXIT_MODE)
+ return;
+ set_mode(&cli_mode, mode, hardware);
+ continue;
}
- if ( !strncmp(cli_line, CLI_HELP, sizeof(CLI_HELP) - 1) ) {
- show_cli_help(&cli_mode);
- continue;
+ if (!strncmp(cli_line, CLI_HELP, sizeof(CLI_HELP) - 1)) {
+ show_cli_help(&cli_mode);
+ continue;
}
-
- if ( !strncmp(cli_line, CLI_PCI, sizeof(CLI_PCI) - 1) ) {
- set_mode(&cli_mode,PCI_MODE,hardware);
- continue;
+ if (!strncmp(cli_line, CLI_PCI, sizeof(CLI_PCI) - 1)) {
+ set_mode(&cli_mode, PCI_MODE, hardware);
+ continue;
}
- if ( !strncmp(cli_line, CLI_CLEAR, sizeof(CLI_CLEAR) - 1) ) {
- clear_screen();
- continue;
+ if (!strncmp(cli_line, CLI_CLEAR, sizeof(CLI_CLEAR) - 1)) {
+ clear_screen();
+ continue;
}
- if ( !strncmp(cli_line, CLI_CPU, sizeof(CLI_CPU) - 1) ) {
- set_mode(&cli_mode,CPU_MODE,hardware);
- continue;
+ if (!strncmp(cli_line, CLI_CPU, sizeof(CLI_CPU) - 1)) {
+ set_mode(&cli_mode, CPU_MODE, hardware);
+ continue;
}
- if ( !strncmp(cli_line, CLI_DMI, sizeof(CLI_DMI) - 1) ) {
- set_mode(&cli_mode,DMI_MODE,hardware);
- continue;
+ if (!strncmp(cli_line, CLI_DMI, sizeof(CLI_DMI) - 1)) {
+ set_mode(&cli_mode, DMI_MODE, hardware);
+ continue;
}
- if ( !strncmp(cli_line, CLI_PXE, sizeof(CLI_PXE) - 1) ) {
- set_mode(&cli_mode,PXE_MODE,hardware);
- continue;
+ if (!strncmp(cli_line, CLI_PXE, sizeof(CLI_PXE) - 1)) {
+ set_mode(&cli_mode, PXE_MODE, hardware);
+ continue;
}
- if ( !strncmp(cli_line, CLI_KERNEL, sizeof(CLI_KERNEL) - 1) ) {
- set_mode(&cli_mode,KERNEL_MODE,hardware);
- continue;
+ if (!strncmp(cli_line, CLI_KERNEL, sizeof(CLI_KERNEL) - 1)) {
+ set_mode(&cli_mode, KERNEL_MODE, hardware);
+ continue;
}
- if ( !strncmp(cli_line, CLI_SYSLINUX, sizeof(CLI_SYSLINUX) - 1) ) {
- set_mode(&cli_mode,SYSLINUX_MODE,hardware);
- continue;
+ if (!strncmp(cli_line, CLI_SYSLINUX, sizeof(CLI_SYSLINUX) - 1)) {
+ set_mode(&cli_mode, SYSLINUX_MODE, hardware);
+ continue;
}
- /* All commands before that line are common for all cli modes
- * the following will be specific for every mode */
- switch(cli_mode.mode) {
- case DMI_MODE: handle_dmi_commands(cli_line,&cli_mode, hardware); break;
- case PCI_MODE: handle_pci_commands(cli_line,&cli_mode, hardware); break;
- case HDT_MODE: handle_hdt_commands(cli_line,&cli_mode, hardware); break;
- case CPU_MODE: handle_cpu_commands(cli_line,&cli_mode, hardware); break;
- case PXE_MODE: handle_pxe_commands(cli_line,&cli_mode, hardware); break;
- case SYSLINUX_MODE: handle_syslinux_commands(cli_line,&cli_mode, hardware); break;
- case KERNEL_MODE: handle_kernel_commands(cli_line,&cli_mode, hardware); break;
- case EXIT_MODE: break; /* should not happend */
+ if ( !strncmp(cli_line, CLI_VESA, sizeof(CLI_VESA) - 1) ) {
+ set_mode(&cli_mode,VESA_MODE,hardware);
+ continue;
}
- }
+
+ /*
+ * All commands before that line are common for all cli modes.
+ * The following will be specific for every mode.
+ */
+ switch (cli_mode.mode) {
+ case DMI_MODE:
+ handle_dmi_commands(cli_line, hardware);
+ break;
+ case PCI_MODE:
+ handle_pci_commands(cli_line, hardware);
+ break;
+ case HDT_MODE:
+ handle_hdt_commands(cli_line, hardware);
+ break;
+ case CPU_MODE:
+ handle_cpu_commands(cli_line, hardware);
+ break;
+ case PXE_MODE:
+ handle_pxe_commands(cli_line, hardware);
+ break;
+ case VESA_MODE:
+ handle_vesa_commands(cli_line, hardware);
+ break;
+ case SYSLINUX_MODE:
+ handle_syslinux_commands(cli_line, hardware);
+ break;
+ case KERNEL_MODE:
+ handle_kernel_commands(cli_line, hardware);
+ break;
+ case EXIT_MODE:
+ break; /* should not happen */
+ }
+ }
}
-int do_exit(struct s_cli_mode *cli_mode) {
- switch (cli_mode->mode) {
- case HDT_MODE: return EXIT_MODE;
+int do_exit(struct s_cli_mode *cli_mode)
+{
+ switch (cli_mode->mode) {
+ case HDT_MODE:
+ return EXIT_MODE;
case KERNEL_MODE:
case PXE_MODE:
case SYSLINUX_MODE:
case PCI_MODE:
case DMI_MODE:
- case CPU_MODE: return HDT_MODE;
- case EXIT_MODE: return EXIT_MODE; /* should not happend */
- }
-return HDT_MODE;
-}
-
-void show_cli_help(struct s_cli_mode *cli_mode) {
-switch (cli_mode->mode) {
- case HDT_MODE:
- printf("Available commands are : %s %s %s %s %s %s %s %s %s %s\n",
- CLI_CLEAR, CLI_EXIT,CLI_HELP,CLI_SHOW, CLI_PCI,
- CLI_DMI, CLI_PXE, CLI_KERNEL, CLI_CPU, CLI_SYSLINUX);
- break;
- case SYSLINUX_MODE:
- case KERNEL_MODE:
- case PXE_MODE:
- case CPU_MODE:
- case PCI_MODE:
- case DMI_MODE:
- printf("Available commands are : %s %s %s %s\n",
- CLI_CLEAR, CLI_EXIT, CLI_HELP, CLI_SHOW);
- break;
- case EXIT_MODE: /* Should not happend*/
- break;
-}
+ case VESA_MODE:
+ case CPU_MODE:
+ return HDT_MODE;
+ case EXIT_MODE:
+ return EXIT_MODE; /* should not happen */
+ }
+ return HDT_MODE;
}
-void main_show_summary(struct s_hardware *hardware, struct s_cli_mode *cli_mode) {
- detect_pci(hardware); /* pxe is detected in the pci */
- detect_dmi(hardware);
- cpu_detect(hardware);
- clear_screen();
- main_show_cpu(hardware,cli_mode);
- if (hardware->is_dmi_valid) {
+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(" 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);
- show_dmi_memory_modules(hardware,false,false);
- }
- main_show_pci(hardware);
- if (hardware->is_pxe_valid)
- main_show_pxe(hardware,cli_mode);
- main_show_kernel(hardware,cli_mode);
+ more_printf(" Version : %s\n", hardware->dmi.bios.version);
+ more_printf(" Release : %s\n",
+ hardware->dmi.bios.release_date);
+ show_dmi_memory_modules(hardware, false, false);
+ }
+ 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) {
+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_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);
if (hardware->sv->filesystem == SYSLINUX_FS_PXELINUX)
- more_printf(" %s\n",CLI_PXE);
+ more_printf(" %s\n", CLI_PXE);
}
-void main_show(char *item, struct s_hardware *hardware, struct s_cli_mode *cli_mode) {
- if (!strncmp(item,CLI_SUMMARY, sizeof (CLI_SUMMARY))) { main_show_summary(hardware,cli_mode); 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,cli_mode); return; }
- if (!strncmp(item,CLI_CPU, sizeof (CLI_CPU))) { main_show_cpu(hardware,cli_mode); return; }
- if (!strncmp(item,CLI_PXE, sizeof (CLI_PXE))) { main_show_pxe(hardware,cli_mode); return; }
- if (!strncmp(item,CLI_SYSLINUX, sizeof (CLI_SYSLINUX))) { main_show_syslinux(hardware,cli_mode); return; }
- if (!strncmp(item,CLI_KERNEL, sizeof (CLI_KERNEL))) { main_show_kernel(hardware,cli_mode); return; }
- show_main_help(hardware);
+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;
+ }
+
+ show_main_help(hardware);
}
diff --git a/com32/hdt/hdt-cli.h b/com32/hdt/hdt-cli.h
index 92791c49..72e46a36 100644
--- a/com32/hdt/hdt-cli.h
+++ b/com32/hdt/hdt-cli.h
@@ -24,11 +24,12 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#ifndef DEFINE_HDT_CLI_H
#define DEFINE_HDT_CLI_H
#include <stdio.h>
+
#include "hdt-common.h"
#define CLI_CLEAR "clear"
@@ -40,11 +41,14 @@
#define CLI_PXE "pxe"
#define CLI_KERNEL "kernel"
#define CLI_SYSLINUX "syslinux"
+#define CLI_VESA "vesa"
#define CLI_SUMMARY "summary"
#define CLI_COMMANDS "commands"
#define CLI_DMI "dmi"
#define CLI_CPU "cpu"
#define CLI_SHOW_LIST "list"
+#define CLI_IRQ "irq"
+#define CLI_MODES "modes"
typedef enum {
EXIT_MODE,
@@ -55,20 +59,19 @@ typedef enum {
PXE_MODE,
KERNEL_MODE,
SYSLINUX_MODE,
+ VESA_MODE,
} cli_mode_t;
struct s_cli_mode {
- cli_mode_t mode;
- char prompt[32];
+ cli_mode_t mode;
+ char prompt[32];
};
-
-void show_cli_help(struct s_cli_mode *cli_mode);
-void start_cli_mode(struct s_hardware *hardware, int argc, char *argv[]);
-void main_show(char *item, struct s_hardware *hardware, struct s_cli_mode *cli_mode);
+void start_cli_mode(struct s_hardware *hardware);
+void main_show(char *item, struct s_hardware *hardware);
int do_exit(struct s_cli_mode *cli_mode);
-//DMI STUFF
+// DMI STUFF
#define CLI_DMI_BASE_BOARD "base_board"
#define CLI_DMI_BATTERY "battery"
#define CLI_DMI_BIOS "bios"
@@ -77,40 +80,34 @@ int do_exit(struct s_cli_mode *cli_mode);
#define CLI_DMI_MEMORY_BANK "bank"
#define CLI_DMI_PROCESSOR "cpu"
#define CLI_DMI_SYSTEM "system"
+void main_show_dmi(struct s_hardware *hardware);
+void handle_dmi_commands(char *cli_line, struct s_hardware *hardware);
+void show_dmi_memory_modules(struct s_hardware *hardware, bool clearscreen,
+ bool show_free_banks);
-void main_show_dmi(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
-void handle_dmi_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
-void show_dmi_base_board(struct s_hardware *hardware);
-void show_dmi_system(struct s_hardware *hardware);
-void show_dmi_bios(struct s_hardware *hardware);
-void show_dmi_chassis(struct s_hardware *hardware);
-void show_dmi_cpu(struct s_hardware *hardware);
-void show_dmi_modules(struct s_hardware *hardware);
-void show_dmi_memory_modules(struct s_hardware *hardware,bool clearscreen, bool show_free_banks);
-void show_dmi_memory_bank(struct s_hardware *hardware, const char *item);
-void show_dmi_battery(struct s_hardware *hardware);
-
-//PCI STUFF
+// PCI STUFF
#define CLI_PCI_DEVICE "device"
void main_show_pci(struct s_hardware *hardware);
-void handle_pci_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
-void pci_show(char *item, struct s_hardware *hardware);
+void handle_pci_commands(char *cli_line, struct s_hardware *hardware);
void cli_detect_pci(struct s_hardware *hardware);
-//CPU STUFF
-void main_show_cpu(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
-void handle_cpu_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
-void cpu_show(char *item, struct s_hardware *hardware);
+// CPU STUFF
+void main_show_cpu(struct s_hardware *hardware);
+void handle_cpu_commands(char *cli_line, struct s_hardware *hardware);
+
+// PXE STUFF
+void main_show_pxe(struct s_hardware *hardware);
+void handle_pxe_commands(char *cli_line, struct s_hardware *hardware);
-//PXE STUFF
-void main_show_pxe(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
-void handle_pxe_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
+// KERNEL STUFF
+void main_show_kernel(struct s_hardware *hardware);
+void handle_kernel_commands(char *cli_line, struct s_hardware *hardware);
-//KERNEL STUFF
-void main_show_kernel(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
-void handle_kernel_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
+// SYSLINUX STUFF
+void main_show_syslinux(struct s_hardware *hardware);
+void handle_syslinux_commands(char *cli_line, struct s_hardware *hardware);
-//SYSLINUX STUFF
-void main_show_syslinux(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
-void handle_syslinux_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
+// VESA STUFF
+void main_show_vesa(struct s_hardware *hardware);
+void handle_vesa_commands(char *cli_line, struct s_hardware *hardware);
#endif
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index 0ff7e86d..fb0c4c9e 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -26,216 +26,357 @@
* -----------------------------------------------------------------------
*/
-#include "hdt-common.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "syslinux/config.h"
+#include "../lib/sys/vesa/vesa.h"
+
+#include "hdt-common.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_parameters(const int argc, const 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) {
+void detect_syslinux(struct s_hardware *hardware)
+{
hardware->sv = syslinux_version();
- switch(hardware->sv->filesystem) {
- case SYSLINUX_FS_SYSLINUX: strlcpy(hardware->syslinux_fs,"SYSlinux",9); break;
- case SYSLINUX_FS_PXELINUX: strlcpy(hardware->syslinux_fs,"PXElinux",9); break;
- case SYSLINUX_FS_ISOLINUX: strlcpy(hardware->syslinux_fs,"ISOlinux",9); break;
- case SYSLINUX_FS_EXTLINUX: strlcpy(hardware->syslinux_fs,"EXTlinux",9); break;
- case SYSLINUX_FS_UNKNOWN:
- default: strlcpy(hardware->syslinux_fs,"Unknown Bootloader",sizeof hardware->syslinux_fs); break;
+ switch (hardware->sv->filesystem) {
+ case SYSLINUX_FS_SYSLINUX:
+ strlcpy(hardware->syslinux_fs, "SYSlinux", 9);
+ break;
+ case SYSLINUX_FS_PXELINUX:
+ strlcpy(hardware->syslinux_fs, "PXElinux", 9);
+ break;
+ case SYSLINUX_FS_ISOLINUX:
+ strlcpy(hardware->syslinux_fs, "ISOlinux", 9);
+ break;
+ case SYSLINUX_FS_EXTLINUX:
+ strlcpy(hardware->syslinux_fs, "EXTlinux", 9);
+ break;
+ case SYSLINUX_FS_UNKNOWN:
+ default:
+ strlcpy(hardware->syslinux_fs, "Unknown Bootloader",
+ sizeof hardware->syslinux_fs);
+ break;
}
}
-void init_hardware(struct s_hardware *hardware) {
- hardware->pci_ids_return_code=0;
- hardware->modules_pcimap_return_code=0;
- hardware->cpu_detection=false;
- hardware->pci_detection=false;
- hardware->disk_detection=false;
- hardware->dmi_detection=false;
- hardware->pxe_detection=false;
- hardware->nb_pci_devices=0;
- hardware->is_dmi_valid=false;
- hardware->is_pxe_valid=false;
- hardware->pci_domain=NULL;
+void init_hardware(struct s_hardware *hardware)
+{
+ hardware->pci_ids_return_code = 0;
+ hardware->modules_pcimap_return_code = 0;
+ hardware->cpu_detection = false;
+ hardware->pci_detection = false;
+ hardware->disk_detection = false;
+ hardware->dmi_detection = false;
+ hardware->pxe_detection = false;
+ hardware->vesa_detection = false;
+ hardware->nb_pci_devices = 0;
+ hardware->is_dmi_valid = false;
+ hardware->is_pxe_valid = false;
+ hardware->pci_domain = NULL;
/* Cleaning structures */
- memset(hardware->disk_info,0,sizeof(hardware->disk_info));
- memset(&hardware->dmi,0,sizeof(s_dmi));
- 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");
+ memset(hardware->disk_info, 0, sizeof(hardware->disk_info));
+ memset(&hardware->dmi, 0, sizeof(s_dmi));
+ memset(&hardware->cpu, 0, sizeof(s_cpu));
+ memset(&hardware->pxe, 0, sizeof(struct s_pxe));
+ memset(&hardware->vesa, 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
- * if yes, let's parse it */
-int detect_dmi(struct s_hardware *hardware) {
- if (hardware->dmi_detection == true) return -1;
- hardware->dmi_detection=true;
- if (dmi_iterate(&hardware->dmi) == -ENODMITABLE ) {
- hardware->is_dmi_valid=false;
- return -ENODMITABLE;
+/*
+ * Detecting if a DMI table exist
+ * if yes, let's parse it
+ */
+int detect_dmi(struct s_hardware *hardware)
+{
+ if (hardware->dmi_detection == true)
+ return -1;
+ hardware->dmi_detection = true;
+ if (dmi_iterate(&hardware->dmi) == -ENODMITABLE) {
+ hardware->is_dmi_valid = false;
+ return -ENODMITABLE;
}
parse_dmitable(&hardware->dmi);
- hardware->is_dmi_valid=true;
- return 0;
+ hardware->is_dmi_valid = true;
+ return 0;
}
-/* Try to detects disk from port 0x80 to 0xff*/
-void detect_disks(struct s_hardware *hardware) {
- hardware->disk_detection=true;
- 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);
- }
+/* Detection vesa stuff*/
+int detect_vesa(struct s_hardware *hardware) {
+ static com32sys_t rm;
+ struct vesa_general_info *gi;
+ struct vesa_mode_info *mi;
+ uint16_t mode, *mode_ptr;
+ char *oem_ptr;
+
+ if (hardware->vesa_detection == true) return -1;
+
+ hardware->vesa_detection=true;
+ hardware->is_vesa_valid=false;
+
+ /* Allocate space in the bounce buffer for these structures */
+ gi = &((struct vesa_info *)__com32.cs_bounce)->gi;
+ mi = &((struct vesa_info *)__com32.cs_bounce)->mi;
+
+ gi->signature = VBE2_MAGIC; /* Get VBE2 extended data */
+ rm.eax.w[0] = 0x4F00; /* Get SVGA general information */
+ rm.edi.w[0] = OFFS(gi);
+ rm.es = SEG(gi);
+ __intcall(0x10, &rm, &rm);
+
+ if ( rm.eax.w[0] != 0x004F ) {
+ return -1;
+ };
+
+ mode_ptr = GET_PTR(gi->video_mode_ptr);
+ oem_ptr = GET_PTR(gi->oem_vendor_name_ptr);
+ strncpy(hardware->vesa.vendor,oem_ptr,sizeof(hardware->vesa.vendor));
+ oem_ptr = GET_PTR(gi->oem_product_name_ptr);
+ strncpy(hardware->vesa.product,oem_ptr,sizeof(hardware->vesa.product));
+ oem_ptr = GET_PTR(gi->oem_product_rev_ptr);
+ strncpy(hardware->vesa.product_revision,oem_ptr,sizeof(hardware->vesa.product_revision));
+
+ hardware->vesa.major_version=(gi->version >> 8) & 0xff;
+ hardware->vesa.minor_version=gi->version & 0xff;
+ hardware->vesa.total_memory=gi->total_memory;
+ hardware->vesa.software_rev=gi->oem_software_rev;
+
+ hardware->vesa.vmi_count=0;
+
+ while ((mode = *mode_ptr++) != 0xFFFF) {
+
+ rm.eax.w[0] = 0x4F01; /* Get SVGA mode information */
+ rm.ecx.w[0] = mode;
+ rm.edi.w[0] = OFFS(mi);
+ rm.es = SEG(mi);
+ __intcall(0x10, &rm, &rm);
+
+ /* Must be a supported mode */
+ if ( rm.eax.w[0] != 0x004f )
+ continue;
+
+ /* Saving detected values*/
+ memcpy(&hardware->vesa.vmi[hardware->vesa.vmi_count].mi, mi,
+ sizeof(struct vesa_mode_info));
+ hardware->vesa.vmi[hardware->vesa.vmi_count].mode = mode;
+
+ hardware->vesa.vmi_count++;
+ }
+ hardware->is_vesa_valid = true;
+ return 0;
}
-int detect_pxe(struct s_hardware *hardware) {
- void *dhcpdata;
+/* Try to detect disks from port 0x80 to 0xff */
+void detect_disks(struct s_hardware *hardware)
+{
+ hardware->disk_detection = true;
+ 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);
+ }
+}
- size_t dhcplen;
- t_PXENV_UNDI_GET_NIC_TYPE gnt;
+int detect_pxe(struct s_hardware *hardware)
+{
+ void *dhcpdata;
- if (hardware->pxe_detection == true) return -1;
- hardware->pxe_detection=true;
- hardware->is_pxe_valid=false;
- memset(&gnt,0, sizeof(t_PXENV_UNDI_GET_NIC_TYPE));
- memset(&hardware->pxe,0, sizeof(struct s_pxe));
+ size_t dhcplen;
+ t_PXENV_UNDI_GET_NIC_TYPE gnt;
- /* This code can only work if pxelinux is loaded*/
- if (hardware->sv->filesystem != SYSLINUX_FS_PXELINUX) {
- return -1;
- }
+ if (hardware->pxe_detection == true)
+ return -1;
+ hardware->pxe_detection = true;
+ hardware->is_pxe_valid = false;
+ memset(&gnt, 0, sizeof(t_PXENV_UNDI_GET_NIC_TYPE));
+ memset(&hardware->pxe, 0, sizeof(struct s_pxe));
+ /* This code can only work if pxelinux is loaded */
+ if (hardware->sv->filesystem != SYSLINUX_FS_PXELINUX) {
+ return -1;
+ }
// printf("PXE: PXElinux detected\n");
- if (!pxe_get_cached_info(PXENV_PACKET_TYPE_DHCP_ACK, &dhcpdata, &dhcplen)) {
- pxe_bootp_t *dhcp=&hardware->pxe.dhcpdata;
- memcpy(&hardware->pxe.dhcpdata,dhcpdata,sizeof(hardware->pxe.dhcpdata));
- snprintf(hardware->pxe.mac_addr, sizeof(hardware->pxe.mac_addr), "%02x:%02x:%02x:%02x:%02x:%02x",
- dhcp->CAddr[0],dhcp->CAddr[1],dhcp->CAddr[2],dhcp->CAddr[3],dhcp->CAddr[4],dhcp->CAddr[5]);
-
- /* Saving Our IP address in a easy format*/
- hardware->pxe.ip_addr[0]= hardware->pxe.dhcpdata.yip & 0xff;
- hardware->pxe.ip_addr[1]= hardware->pxe.dhcpdata.yip >>8 & 0xff;
- hardware->pxe.ip_addr[2]= hardware->pxe.dhcpdata.yip >>16 & 0xff;
- hardware->pxe.ip_addr[3]= hardware->pxe.dhcpdata.yip >>24 & 0xff;
-
- if (!pxe_get_nic_type(&gnt)) {
- switch(gnt.NicType) {
- case PCI_NIC:
- hardware->is_pxe_valid=true;
- hardware->pxe.vendor_id=gnt.info.pci.Vendor_ID;
- hardware->pxe.product_id=gnt.info.pci.Dev_ID;
- hardware->pxe.subvendor_id=gnt.info.pci.SubVendor_ID;
- hardware->pxe.subproduct_id=gnt.info.pci.SubDevice_ID,
- hardware->pxe.rev=gnt.info.pci.Rev;
- hardware->pxe.pci_bus= (gnt.info.pci.BusDevFunc >> 8) & 0xff;
- hardware->pxe.pci_dev= (gnt.info.pci.BusDevFunc >> 3) & 0x7;
- hardware->pxe.pci_func=gnt.info.pci.BusDevFunc & 0x03;
- hardware->pxe.base_class=gnt.info.pci.Base_Class;
- hardware->pxe.sub_class=gnt.info.pci.Sub_Class;
- hardware->pxe.prog_intf=gnt.info.pci.Prog_Intf;
- hardware->pxe.nictype=gnt.NicType;
- break;
- case CardBus_NIC:
- hardware->is_pxe_valid=true;
- hardware->pxe.vendor_id=gnt.info.cardbus.Vendor_ID;
- hardware->pxe.product_id=gnt.info.cardbus.Dev_ID;
- hardware->pxe.subvendor_id=gnt.info.cardbus.SubVendor_ID;
- hardware->pxe.subproduct_id=gnt.info.cardbus.SubDevice_ID,
- hardware->pxe.rev=gnt.info.cardbus.Rev;
- hardware->pxe.pci_bus= (gnt.info.cardbus.BusDevFunc >> 8) & 0xff;
- hardware->pxe.pci_dev= (gnt.info.cardbus.BusDevFunc >> 3) & 0x7;
- hardware->pxe.pci_func=gnt.info.cardbus.BusDevFunc & 0x03;
- hardware->pxe.base_class=gnt.info.cardbus.Base_Class;
- hardware->pxe.sub_class=gnt.info.cardbus.Sub_Class;
- hardware->pxe.prog_intf=gnt.info.cardbus.Prog_Intf;
- hardware->pxe.nictype=gnt.NicType;
- break;
- case PnP_NIC:
- default: return -1; break;
+ if (!pxe_get_cached_info
+ (PXENV_PACKET_TYPE_DHCP_ACK, &dhcpdata, &dhcplen)) {
+ pxe_bootp_t *dhcp = &hardware->pxe.dhcpdata;
+ memcpy(&hardware->pxe.dhcpdata, dhcpdata,
+ sizeof(hardware->pxe.dhcpdata));
+ snprintf(hardware->pxe.mac_addr, sizeof(hardware->pxe.mac_addr),
+ "%02x:%02x:%02x:%02x:%02x:%02x", dhcp->CAddr[0],
+ dhcp->CAddr[1], dhcp->CAddr[2], dhcp->CAddr[3],
+ dhcp->CAddr[4], dhcp->CAddr[5]);
+
+ /* Saving our IP address in a easy format */
+ hardware->pxe.ip_addr[0] = hardware->pxe.dhcpdata.yip & 0xff;
+ hardware->pxe.ip_addr[1] =
+ hardware->pxe.dhcpdata.yip >> 8 & 0xff;
+ hardware->pxe.ip_addr[2] =
+ hardware->pxe.dhcpdata.yip >> 16 & 0xff;
+ hardware->pxe.ip_addr[3] =
+ hardware->pxe.dhcpdata.yip >> 24 & 0xff;
+
+ if (!pxe_get_nic_type(&gnt)) {
+ switch (gnt.NicType) {
+ case PCI_NIC:
+ hardware->is_pxe_valid = true;
+ hardware->pxe.vendor_id =
+ gnt.info.pci.Vendor_ID;
+ hardware->pxe.product_id = gnt.info.pci.Dev_ID;
+ hardware->pxe.subvendor_id =
+ gnt.info.pci.SubVendor_ID;
+ hardware->pxe.subproduct_id =
+ gnt.info.pci.SubDevice_ID,
+ hardware->pxe.rev = gnt.info.pci.Rev;
+ hardware->pxe.pci_bus =
+ (gnt.info.pci.BusDevFunc >> 8) & 0xff;
+ hardware->pxe.pci_dev =
+ (gnt.info.pci.BusDevFunc >> 3) & 0x7;
+ hardware->pxe.pci_func =
+ gnt.info.pci.BusDevFunc & 0x03;
+ hardware->pxe.base_class =
+ gnt.info.pci.Base_Class;
+ hardware->pxe.sub_class =
+ gnt.info.pci.Sub_Class;
+ hardware->pxe.prog_intf =
+ gnt.info.pci.Prog_Intf;
+ hardware->pxe.nictype = gnt.NicType;
+ break;
+ case CardBus_NIC:
+ hardware->is_pxe_valid = true;
+ hardware->pxe.vendor_id =
+ gnt.info.cardbus.Vendor_ID;
+ hardware->pxe.product_id =
+ gnt.info.cardbus.Dev_ID;
+ hardware->pxe.subvendor_id =
+ gnt.info.cardbus.SubVendor_ID;
+ hardware->pxe.subproduct_id =
+ gnt.info.cardbus.SubDevice_ID,
+ hardware->pxe.rev = gnt.info.cardbus.Rev;
+ hardware->pxe.pci_bus =
+ (gnt.info.cardbus.BusDevFunc >> 8) & 0xff;
+ hardware->pxe.pci_dev =
+ (gnt.info.cardbus.BusDevFunc >> 3) & 0x7;
+ hardware->pxe.pci_func =
+ gnt.info.cardbus.BusDevFunc & 0x03;
+ hardware->pxe.base_class =
+ gnt.info.cardbus.Base_Class;
+ hardware->pxe.sub_class =
+ gnt.info.cardbus.Sub_Class;
+ hardware->pxe.prog_intf =
+ gnt.info.cardbus.Prog_Intf;
+ hardware->pxe.nictype = gnt.NicType;
+ break;
+ case PnP_NIC:
+ default:
+ return -1;
+ break;
+ }
+ /* Let's try to find the associated pci device */
+ detect_pci(hardware);
+ hardware->pxe.pci_device = NULL;
+ hardware->pxe.pci_device_pos = 0;
+ struct pci_device *pci_device;
+ int pci_number = 0;
+ for_each_pci_func(pci_device, hardware->pci_domain) {
+ pci_number++;
+ if ((__pci_bus == hardware->pxe.pci_bus) &&
+ (__pci_slot == hardware->pxe.pci_dev) &&
+ (__pci_func == hardware->pxe.pci_func) &&
+ (pci_device->vendor ==
+ hardware->pxe.vendor_id)
+ && (pci_device->product ==
+ hardware->pxe.product_id)) {
+ hardware->pxe.pci_device = pci_device;
+ hardware->pxe.pci_device_pos =
+ pci_number;
}
- /* Let's try to find the associated pci device */
- detect_pci(hardware);
- hardware->pxe.pci_device=NULL;
- hardware->pxe.pci_device_pos=0;
- struct pci_device *pci_device;
- int pci_number=0;
- for_each_pci_func(pci_device, hardware->pci_domain) {
- pci_number++;
- if ((__pci_bus == hardware->pxe.pci_bus) &&
- (__pci_slot == hardware->pxe.pci_dev) &&
- (__pci_func == hardware->pxe.pci_func) &&
- (pci_device->vendor == hardware->pxe.vendor_id) &&
- (pci_device->product == hardware->pxe.product_id)) {
- hardware->pxe.pci_device=pci_device;
- hardware->pxe.pci_device_pos=pci_number;
- }
- }
- }
- }
- return 0;
+ }
+ }
+ }
+ return 0;
}
-void detect_pci(struct s_hardware *hardware) {
- if (hardware->pci_detection == true) return;
- hardware->pci_detection=true;
+void detect_pci(struct s_hardware *hardware)
+{
+ if (hardware->pci_detection == true)
+ return;
+ hardware->pci_detection = true;
/* Scanning to detect pci buses and devices */
hardware->pci_domain = pci_scan();
- hardware->nb_pci_devices=0;
+ /* Gathering addtional information*/
+ gather_additional_pci_config(hardware->pci_domain);
+
+ hardware->nb_pci_devices = 0;
struct pci_device *pci_device;
for_each_pci_func(pci_device, hardware->pci_domain) {
- hardware->nb_pci_devices++;
+ hardware->nb_pci_devices++;
}
- printf("PCI: %d devices detected\n",hardware->nb_pci_devices);
+ 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->pciids_path);
+ /* Assigning product & vendor name for each device */
+ 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->pciids_path);
-
+ /* Assigning class name for each device */
+ 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_path);
+ 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 */
+ /* We try to detect the pxe stuff to populate the PXE: field of pci devices */
detect_pxe(hardware);
}
-void cpu_detect(struct s_hardware *hardware) {
- if (hardware->cpu_detection == true) return;
+void cpu_detect(struct s_hardware *hardware)
+{
+ if (hardware->cpu_detection == true)
+ return;
detect_cpu(&hardware->cpu);
- hardware->cpu_detection=true;
+ hardware->cpu_detection = true;
}
-/* Find the last instance of a particular command line argument
- (which should include the final =; do not use for boolean arguments) */
-char *find_argument(const char **argv, const char *argument)
+/*
+ * Find the last instance of a particular command line argument
+ * (which should include the final =; do not use for boolean arguments)
+ */
+const char *find_argument(const char **argv, const char *argument)
{
int la = strlen(argument);
const char **arg;
- char *ptr = NULL;
+ const char *ptr = NULL;
for (arg = argv; *arg; arg++) {
if (!memcmp(*arg, argument, la))
@@ -248,6 +389,5 @@ char *find_argument(const char **argv, const char *argument)
void clear_screen(void)
{
fputs("\033e\033%@\033)0\033(B\1#0\033[?25l\033[2J", stdout);
- display_line_nb=0;
+ display_line_nb = 0;
}
-
diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h
index 1b27b588..8cdf6636 100644
--- a/com32/hdt/hdt-common.h
+++ b/com32/hdt/hdt-common.h
@@ -24,20 +24,23 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#ifndef DEFINE_HDT_COMMON_H
#define DEFINE_HDT_COMMON_H
#include <stdio.h>
+#include <syslinux/pxe.h>
#include "sys/pci.h"
+
#include "cpuid.h"
#include "dmi/dmi.h"
-#include <syslinux/pxe.h>
#include "hdt-ata.h"
+#include "../lib/sys/vesa/vesa.h"
-/* This two values are used for switching for the menu to the CLI mode*/
+/* This two values are used for switching for the menu to the CLI mode */
#define HDT_SWITCH_TO_CLI "hdt_switch_to_cli"
#define HDT_RETURN_TO_CLI 100
+#define MAX_VESA_MODES 255
extern int display_line_nb;
@@ -52,55 +55,72 @@ extern int display_line_nb;
display_line_nb++; \
} while (0);
-
struct s_pxe {
- uint16_t vendor_id;
- uint16_t product_id;
- uint16_t subvendor_id;
- uint16_t subproduct_id;
- uint8_t rev;
- uint8_t pci_bus;
- uint8_t pci_dev;
- uint8_t pci_func;
- uint8_t base_class;
- uint8_t sub_class;
- uint8_t prog_intf;
- uint8_t nictype;
- char mac_addr[18]; /* The current mac address */
- uint8_t ip_addr[4];
+ uint16_t vendor_id;
+ uint16_t product_id;
+ uint16_t subvendor_id;
+ uint16_t subproduct_id;
+ uint8_t rev;
+ uint8_t pci_bus;
+ uint8_t pci_dev;
+ uint8_t pci_func;
+ uint8_t base_class;
+ uint8_t sub_class;
+ uint8_t prog_intf;
+ uint8_t nictype;
+ char mac_addr[18]; /* The current mac address */
+ uint8_t ip_addr[4];
+ pxe_bootp_t dhcpdata; /* The dhcp answer */
+ struct pci_device *pci_device; /* The matching pci device */
+ uint8_t pci_device_pos; /* It position in our pci sorted list */
+};
- pxe_bootp_t dhcpdata; /* The dhcp answer */
- struct pci_device *pci_device; /* The matching pci device */
- uint8_t pci_device_pos; /* It position in our pci sorted list*/
+struct s_vesa_mode_info {
+ struct vesa_mode_info mi;
+ uint16_t mode;
+};
+struct s_vesa {
+ uint8_t major_version;
+ uint8_t minor_version;
+ struct s_vesa_mode_info vmi[MAX_VESA_MODES];
+ uint8_t vmi_count;
+ uint16_t total_memory;
+ char vendor[256];
+ char product[256];
+ char product_revision[256];
+ uint16_t software_rev;
};
struct s_hardware {
- s_dmi dmi; /* DMI table */
- s_cpu cpu; /* CPU information */
- struct pci_domain *pci_domain; /* PCI Devices */
- struct diskinfo disk_info[256]; /* Disk Information*/
+ s_dmi dmi; /* DMI table */
+ s_cpu cpu; /* CPU information */
+ struct pci_domain *pci_domain; /* PCI Devices */
+ struct diskinfo disk_info[256]; /* Disk Information */
struct s_pxe pxe;
+ struct s_vesa vesa;
int pci_ids_return_code;
int modules_pcimap_return_code;
int nb_pci_devices;
bool is_dmi_valid;
bool is_pxe_valid;
+ bool is_vesa_valid;
- bool dmi_detection; /* Does the dmi stuff have been already detected */
- bool pci_detection; /* Does the pci stuff have been already detected */
- bool cpu_detection; /* Does the cpu stuff have been already detected */
- bool disk_detection; /* Does the disk stuff have been already detected */
- bool pxe_detection; /* Does the pxe stuff have been already detected*/
+ bool dmi_detection; /* Does the dmi stuff has already been detected? */
+ bool pci_detection; /* Does the pci stuff has already been detected? */
+ bool cpu_detection; /* Does the cpu stuff has already been detected? */
+ bool disk_detection;/* Does the disk stuff has already been detected? */
+ bool pxe_detection; /* Does the pxe stuff has already been detected? */
+ bool vesa_detection;/* Does the vesa sutff have been already detected? */
- char syslinux_fs[22];
- struct syslinux_version *sv;
- char modules_pcimap_path[255];
- char pciids_path[255];
+ char syslinux_fs[22];
+ const struct syslinux_version *sv;
+ char modules_pcimap_path[255];
+ char pciids_path[255];
};
-char *find_argument(const char **argv, const char *argument);
+const char *find_argument(const char **argv, const char *argument);
int detect_dmi(struct s_hardware *hardware);
void detect_disks(struct s_hardware *hardware);
void detect_pci(struct s_hardware *hardware);
@@ -109,5 +129,7 @@ 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);
+void detect_parameters(const int argc, const char *argv[],
+ struct s_hardware *hardware);
+int detect_vesa(struct s_hardware *hardware);
#endif
diff --git a/com32/hdt/hdt-menu-about.c b/com32/hdt/hdt-menu-about.c
index 51032402..ad3a820e 100644
--- a/com32/hdt/hdt-menu-about.c
+++ b/com32/hdt/hdt-menu-about.c
@@ -24,41 +24,40 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#include "hdt-menu.h"
/* Computing About menu*/
-void compute_aboutmenu(struct s_my_menu *menu) {
- char buffer[SUBMENULEN+1];
- char statbuffer[STATLEN+1];
+void compute_aboutmenu(struct s_my_menu *menu)
+{
+ char buffer[SUBMENULEN + 1];
+ char statbuffer[STATLEN + 1];
- menu->menu = add_menu(" About ",-1);
- menu->items_count=0;
+ menu->menu = add_menu(" About ", -1);
+ menu->items_count = 0;
- set_menu_pos(SUBMENU_Y,SUBMENU_X);
+ set_menu_pos(SUBMENU_Y, SUBMENU_X);
snprintf(buffer, sizeof buffer, "Product : %s", PRODUCT_NAME);
snprintf(statbuffer, sizeof statbuffer, "Product : %s", PRODUCT_NAME);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
snprintf(buffer, sizeof buffer, "Version : %s", VERSION);
snprintf(statbuffer, sizeof statbuffer, "Version : %s", VERSION);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
snprintf(buffer, sizeof buffer, "Author : %s", AUTHOR);
snprintf(statbuffer, sizeof statbuffer, "Author : %s", AUTHOR);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
snprintf(buffer, sizeof buffer, "Contact : %s", CONTACT);
snprintf(statbuffer, sizeof statbuffer, "Contact : %s", CONTACT);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- printf("MENU: About menu done (%d items)\n",menu->items_count);
-
+ printf("MENU: About menu done (%d items)\n", menu->items_count);
}
-
diff --git a/com32/hdt/hdt-menu-disk.c b/com32/hdt/hdt-menu-disk.c
index 9c96e787..1b273036 100644
--- a/com32/hdt/hdt-menu-disk.c
+++ b/com32/hdt/hdt-menu-disk.c
@@ -24,125 +24,154 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#include "hdt-menu.h"
/* Compute the disk submenu */
-int compute_disk_module(struct s_my_menu *menu, int nb_sub_disk_menu,struct diskinfo *d,int disk_number) {
- char buffer[MENULEN+1];
- char statbuffer[STATLEN+1];
-
- /* No need to add no existing devices*/
- if (strlen(d[disk_number].aid.model)<=0) return -1;
-
- snprintf(buffer,sizeof buffer," Disk <%d> ",nb_sub_disk_menu);
- menu[nb_sub_disk_menu].menu = add_menu(buffer,-1);
- menu[nb_sub_disk_menu].items_count=0;
-
- snprintf(buffer,sizeof buffer,"Model : %s",d[disk_number].aid.model);
- snprintf(statbuffer,sizeof statbuffer,"Model: %s",d[disk_number].aid.model);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+int compute_disk_module(struct s_my_menu *menu, int nb_sub_disk_menu,
+ struct diskinfo *d, int disk_number)
+{
+ char buffer[MENULEN + 1];
+ char statbuffer[STATLEN + 1];
+
+ /* No need to add no existing devices */
+ if (strlen(d[disk_number].aid.model) <= 0)
+ return -1;
+
+ snprintf(buffer, sizeof buffer, " Disk <%d> ", nb_sub_disk_menu);
+ menu[nb_sub_disk_menu].menu = add_menu(buffer, -1);
+ menu[nb_sub_disk_menu].items_count = 0;
+
+ snprintf(buffer, sizeof buffer, "Model : %s",
+ d[disk_number].aid.model);
+ snprintf(statbuffer, sizeof statbuffer, "Model: %s",
+ d[disk_number].aid.model);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu[nb_sub_disk_menu].items_count++;
/* Compute device size */
- char previous_unit[3],unit[3]; //GB
- int previous_size,size = d[disk_number].sectors/2; // Converting to bytes
- strlcpy(unit,"KB",2);
- strlcpy(previous_unit,unit,2);
- previous_size=size;
- if (size>1000) {
- size=size/1000;
- strlcpy(unit,"MB",2);
- if (size>1000) {
- previous_size=size;
- size=size/1000;
- strlcpy(previous_unit,unit,2);
- strlcpy(unit,"GB",2);
- if (size>1000) {
- previous_size=size;
- size=size/1000;
- strlcpy(previous_unit,unit,2);
- strlcpy(unit,"TB",2);
- }
- }
+ char previous_unit[3], unit[3]; //GB
+ int previous_size, size = d[disk_number].sectors / 2; // Converting to bytes
+ strlcpy(unit, "KB", 2);
+ strlcpy(previous_unit, unit, 2);
+ previous_size = size;
+ if (size > 1000) {
+ size = size / 1000;
+ strlcpy(unit, "MB", 2);
+ if (size > 1000) {
+ previous_size = size;
+ size = size / 1000;
+ strlcpy(previous_unit, unit, 2);
+ strlcpy(unit, "GB", 2);
+ if (size > 1000) {
+ previous_size = size;
+ size = size / 1000;
+ strlcpy(previous_unit, unit, 2);
+ strlcpy(unit, "TB", 2);
+ }
+ }
}
- snprintf(buffer,sizeof buffer,"Size : %d %s (%d %s)",size,unit,previous_size,previous_unit);
- snprintf(statbuffer, sizeof statbuffer, "Size: %d %s (%d %s)",size,unit,previous_size,previous_unit);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Size : %d %s (%d %s)", size,
+ unit, previous_size, previous_unit);
+ snprintf(statbuffer, sizeof statbuffer, "Size: %d %s (%d %s)", size,
+ unit, previous_size, previous_unit);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu[nb_sub_disk_menu].items_count++;
- snprintf(buffer,sizeof buffer,"Firmware Rev.: %s",d[disk_number].aid.fw_rev);
- snprintf(statbuffer,sizeof statbuffer,"Firmware Revision: %s",d[disk_number].aid.fw_rev);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Firmware Rev.: %s",
+ d[disk_number].aid.fw_rev);
+ snprintf(statbuffer, sizeof statbuffer, "Firmware Revision: %s",
+ d[disk_number].aid.fw_rev);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu[nb_sub_disk_menu].items_count++;
- snprintf(buffer,sizeof buffer,"Serial Number: %s",d[disk_number].aid.serial_no);
- snprintf(statbuffer,sizeof statbuffer,"Serial Number: %s",d[disk_number].aid.serial_no);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Serial Number: %s",
+ d[disk_number].aid.serial_no);
+ snprintf(statbuffer, sizeof statbuffer, "Serial Number: %s",
+ d[disk_number].aid.serial_no);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu[nb_sub_disk_menu].items_count++;
- snprintf(buffer,sizeof buffer,"Interface : %s",d[disk_number].interface_type);
- snprintf(statbuffer,sizeof statbuffer,"Interface: %s",d[disk_number].interface_type);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Interface : %s",
+ d[disk_number].interface_type);
+ snprintf(statbuffer, sizeof statbuffer, "Interface: %s",
+ d[disk_number].interface_type);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu[nb_sub_disk_menu].items_count++;
- snprintf(buffer,sizeof buffer,"Host Bus : %s",d[disk_number].host_bus_type);
- snprintf(statbuffer,sizeof statbuffer,"Host Bus Type: %s",d[disk_number].host_bus_type);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Host Bus : %s",
+ d[disk_number].host_bus_type);
+ snprintf(statbuffer, sizeof statbuffer, "Host Bus Type: %s",
+ d[disk_number].host_bus_type);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu[nb_sub_disk_menu].items_count++;
- snprintf(buffer,sizeof buffer, "Sectors : %d",d[disk_number].sectors);
- snprintf(statbuffer,sizeof statbuffer, "Sectors: %d",d[disk_number].sectors);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Sectors : %d",
+ d[disk_number].sectors);
+ snprintf(statbuffer, sizeof statbuffer, "Sectors: %d",
+ d[disk_number].sectors);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu[nb_sub_disk_menu].items_count++;
- snprintf(buffer,sizeof buffer,"Heads : %d",d[disk_number].heads);
- snprintf(statbuffer,sizeof statbuffer,"Heads: %d",d[disk_number].heads);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Heads : %d",
+ d[disk_number].heads);
+ snprintf(statbuffer, sizeof statbuffer, "Heads: %d",
+ d[disk_number].heads);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu[nb_sub_disk_menu].items_count++;
- snprintf(buffer, sizeof buffer,"Cylinders : %d",d[disk_number].cylinders);
- snprintf(statbuffer, sizeof statbuffer,"Cylinders: %d",d[disk_number].cylinders);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Cylinders : %d",
+ d[disk_number].cylinders);
+ snprintf(statbuffer, sizeof statbuffer, "Cylinders: %d",
+ d[disk_number].cylinders);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu[nb_sub_disk_menu].items_count++;
- snprintf(buffer,sizeof buffer, "Sectors/Track: %d",d[disk_number].sectors_per_track);
- snprintf(statbuffer,sizeof statbuffer, "Sectors per Track: %d",d[disk_number].sectors_per_track);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Sectors/Track: %d",
+ d[disk_number].sectors_per_track);
+ snprintf(statbuffer, sizeof statbuffer, "Sectors per Track: %d",
+ d[disk_number].sectors_per_track);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu[nb_sub_disk_menu].items_count++;
- snprintf(buffer,sizeof buffer,"Port : 0x%X",disk_number);
- snprintf(statbuffer,sizeof statbuffer,"Port: 0x%X",disk_number);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Port : 0x%X", disk_number);
+ snprintf(statbuffer, sizeof statbuffer, "Port: 0x%X", disk_number);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu[nb_sub_disk_menu].items_count++;
- snprintf(buffer,sizeof buffer,"EDD Version : %s",d[disk_number].edd_version);
- snprintf(statbuffer,sizeof statbuffer,"EDD Version: %s",d[disk_number].edd_version);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "EDD Version : %s",
+ d[disk_number].edd_version);
+ snprintf(statbuffer, sizeof statbuffer, "EDD Version: %s",
+ d[disk_number].edd_version);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu[nb_sub_disk_menu].items_count++;
return 0;
}
-/* Compute the Disk Menu*/
-void compute_disks(struct s_hdt_menu *menu, struct diskinfo *disk_info) {
- char buffer[MENULEN+1];
- int nb_sub_disk_menu=0;
- for (int i=0;i<0xff;i++) {
- if (compute_disk_module(&(menu->disk_sub_menu),nb_sub_disk_menu,disk_info,i) == 0)
- nb_sub_disk_menu++;
+/* Compute the Disks menu */
+void compute_disks(struct s_hdt_menu *menu, struct diskinfo *disk_info)
+{
+ char buffer[MENULEN + 1];
+ int nb_sub_disk_menu = 0;
+ for (int i = 0; i < 0xff; i++) {
+ if (compute_disk_module
+ ((struct s_my_menu*) &(menu->disk_sub_menu), nb_sub_disk_menu, disk_info,
+ i) == 0)
+ nb_sub_disk_menu++;
}
- menu->disk_menu.menu = add_menu(" Disks ",-1);
- menu->disk_menu.items_count=0;
+ menu->disk_menu.menu = add_menu(" Disks ", -1);
+ menu->disk_menu.items_count = 0;
- for (int i=0;i<nb_sub_disk_menu;i++) {
- snprintf(buffer,sizeof buffer," Disk <%d> ",i);
- add_item(buffer,"Disk",OPT_SUBMENU,NULL,menu->disk_sub_menu[i].menu);
+ for (int i = 0; i < nb_sub_disk_menu; i++) {
+ snprintf(buffer, sizeof buffer, " Disk <%d> ", i);
+ add_item(buffer, "Disk", OPT_SUBMENU, NULL,
+ menu->disk_sub_menu[i].menu);
menu->disk_menu.items_count++;
}
- printf("MENU: Disks menu done (%d items)\n",menu->disk_menu.items_count);
+ printf("MENU: Disks menu done (%d items)\n",
+ menu->disk_menu.items_count);
}
-
diff --git a/com32/hdt/hdt-menu-dmi.c b/com32/hdt/hdt-menu-dmi.c
index 485f25ec..79193019 100644
--- a/com32/hdt/hdt-menu-dmi.c
+++ b/com32/hdt/hdt-menu-dmi.c
@@ -24,360 +24,458 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#include "hdt-menu.h"
/* Compute System main menu */
-void compute_system(struct s_my_menu *menu,s_dmi *dmi) {
- char buffer[SUBMENULEN+1];
- char statbuffer[STATLEN+1];
+void compute_system(struct s_my_menu *menu, s_dmi * dmi)
+{
+ char buffer[SUBMENULEN + 1];
+ char statbuffer[STATLEN + 1];
- menu->menu = add_menu(" System ",-1);
- menu->items_count=0;
- set_menu_pos(SUBMENU_Y,SUBMENU_X);
+ menu->menu = add_menu(" System ", -1);
+ menu->items_count = 0;
+ set_menu_pos(SUBMENU_Y, SUBMENU_X);
- snprintf(buffer,sizeof buffer,"Vendor : %s",dmi->system.manufacturer);
- snprintf(statbuffer,sizeof statbuffer,"Vendor: %s",dmi->system.manufacturer);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Vendor : %s",
+ dmi->system.manufacturer);
+ snprintf(statbuffer, sizeof statbuffer, "Vendor: %s",
+ dmi->system.manufacturer);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Product : %s",dmi->system.product_name);
- snprintf(statbuffer,sizeof statbuffer,"Product Name: %s",dmi->system.product_name);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Product : %s",
+ dmi->system.product_name);
+ snprintf(statbuffer, sizeof statbuffer, "Product Name: %s",
+ dmi->system.product_name);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Version : %s",dmi->system.version);
- snprintf(statbuffer,sizeof statbuffer,"Version: %s",dmi->system.version);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Version : %s", dmi->system.version);
+ snprintf(statbuffer, sizeof statbuffer, "Version: %s",
+ dmi->system.version);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Serial : %s",dmi->system.serial);
- snprintf(statbuffer,sizeof statbuffer,"Serial Number: %s",dmi->system.serial);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Serial : %s", dmi->system.serial);
+ snprintf(statbuffer, sizeof statbuffer, "Serial Number: %s",
+ dmi->system.serial);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"UUID : %s",dmi->system.uuid);
- snprintf(statbuffer,sizeof statbuffer,"UUID: %s",dmi->system.uuid);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "UUID : %s", dmi->system.uuid);
+ snprintf(statbuffer, sizeof statbuffer, "UUID: %s", dmi->system.uuid);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Wakeup : %s",dmi->system.wakeup_type);
- snprintf(statbuffer,sizeof statbuffer,"Wakeup Type: %s",dmi->system.wakeup_type);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Wakeup : %s",
+ dmi->system.wakeup_type);
+ snprintf(statbuffer, sizeof statbuffer, "Wakeup Type: %s",
+ dmi->system.wakeup_type);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"SKU Number: %s",dmi->system.sku_number);
- snprintf(statbuffer,sizeof statbuffer,"SKU Number: %s",dmi->system.sku_number);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "SKU Number: %s",
+ dmi->system.sku_number);
+ snprintf(statbuffer, sizeof statbuffer, "SKU Number: %s",
+ dmi->system.sku_number);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Family : %s",dmi->system.family);
- snprintf(statbuffer,sizeof statbuffer,"Family: %s",dmi->system.family);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Family : %s", dmi->system.family);
+ snprintf(statbuffer, sizeof statbuffer, "Family: %s",
+ dmi->system.family);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- printf("MENU: System menu done (%d items)\n",menu->items_count);
+ printf("MENU: System menu done (%d items)\n", menu->items_count);
}
/* Compute Chassis menu */
-void compute_chassis(struct s_my_menu *menu,s_dmi *dmi) {
- char buffer[SUBMENULEN+1];
- char statbuffer[STATLEN+1];
- menu->menu = add_menu(" Chassis ",-1);
- menu->items_count=0;
- set_menu_pos(SUBMENU_Y,SUBMENU_X);
+void compute_chassis(struct s_my_menu *menu, s_dmi * dmi)
+{
+ char buffer[SUBMENULEN + 1];
+ char statbuffer[STATLEN + 1];
+ menu->menu = add_menu(" Chassis ", -1);
+ menu->items_count = 0;
+ set_menu_pos(SUBMENU_Y, SUBMENU_X);
- snprintf(buffer,sizeof buffer,"Vendor : %s",dmi->chassis.manufacturer);
- snprintf(statbuffer,sizeof statbuffer,"Vendor: %s",dmi->chassis.manufacturer);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Vendor : %s",
+ dmi->chassis.manufacturer);
+ snprintf(statbuffer, sizeof statbuffer, "Vendor: %s",
+ dmi->chassis.manufacturer);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Type : %s",dmi->chassis.type);
- snprintf(statbuffer,sizeof statbuffer,"Type: %s",dmi->chassis.type);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Type : %s", dmi->chassis.type);
+ snprintf(statbuffer, sizeof statbuffer, "Type: %s", dmi->chassis.type);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Version : %s",dmi->chassis.version);
- snprintf(statbuffer,sizeof statbuffer,"Version: %s",dmi->chassis.version);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Version : %s", dmi->chassis.version);
+ snprintf(statbuffer, sizeof statbuffer, "Version: %s",
+ dmi->chassis.version);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Serial : %s",dmi->chassis.serial);
- snprintf(statbuffer,sizeof statbuffer,"Serial Number: %s",dmi->chassis.serial);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Serial : %s", dmi->chassis.serial);
+ snprintf(statbuffer, sizeof statbuffer, "Serial Number: %s",
+ dmi->chassis.serial);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Asset Tag : %s",dmi->chassis.asset_tag);
- snprintf(statbuffer,sizeof statbuffer,"Asset Tag: %s",dmi->chassis.asset_tag);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Asset Tag : %s",
+ dmi->chassis.asset_tag);
+ snprintf(statbuffer, sizeof statbuffer, "Asset Tag: %s",
+ dmi->chassis.asset_tag);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Lock : %s",dmi->chassis.lock);
- snprintf(statbuffer,sizeof statbuffer,"Lock: %s",dmi->chassis.lock);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Lock : %s", dmi->chassis.lock);
+ snprintf(statbuffer, sizeof statbuffer, "Lock: %s", dmi->chassis.lock);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
printf("MENU: Chassis menu done (%d items)\n", menu->items_count);
}
/* Compute BIOS menu */
-void compute_bios(struct s_my_menu *menu,s_dmi *dmi) {
- char buffer[SUBMENULEN+1];
- char statbuffer[STATLEN+1];
+void compute_bios(struct s_my_menu *menu, s_dmi * dmi)
+{
+ char buffer[SUBMENULEN + 1];
+ char statbuffer[STATLEN + 1];
- menu->menu = add_menu(" BIOS ",-1);
- menu->items_count=0;
- set_menu_pos(SUBMENU_Y,SUBMENU_X);
+ menu->menu = add_menu(" BIOS ", -1);
+ menu->items_count = 0;
+ set_menu_pos(SUBMENU_Y, SUBMENU_X);
- snprintf(buffer,sizeof buffer,"Vendor : %s",dmi->bios.vendor);
- snprintf(statbuffer,sizeof statbuffer,"Vendor: %s",dmi->bios.vendor);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Vendor : %s", dmi->bios.vendor);
+ snprintf(statbuffer, sizeof statbuffer, "Vendor: %s", dmi->bios.vendor);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Version : %s",dmi->bios.version);
- snprintf(statbuffer,sizeof statbuffer,"Version: %s",dmi->bios.version);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Version : %s", dmi->bios.version);
+ snprintf(statbuffer, sizeof statbuffer, "Version: %s",
+ dmi->bios.version);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Release : %s",dmi->bios.release_date);
- snprintf(statbuffer,sizeof statbuffer,"Release Date: %s",dmi->bios.release_date);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Release : %s",
+ dmi->bios.release_date);
+ snprintf(statbuffer, sizeof statbuffer, "Release Date: %s",
+ dmi->bios.release_date);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Bios Rev. : %s",dmi->bios.bios_revision);
- snprintf(statbuffer,sizeof statbuffer,"Bios Revision: %s",dmi->bios.bios_revision);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Bios Rev. : %s",
+ dmi->bios.bios_revision);
+ snprintf(statbuffer, sizeof statbuffer, "Bios Revision: %s",
+ dmi->bios.bios_revision);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Fw. Rev. : %s",dmi->bios.firmware_revision);
- snprintf(statbuffer,sizeof statbuffer,"Firmware Revision : %s",dmi->bios.firmware_revision);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Fw. Rev. : %s",
+ dmi->bios.firmware_revision);
+ snprintf(statbuffer, sizeof statbuffer, "Firmware Revision : %s",
+ dmi->bios.firmware_revision);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
- printf("MENU: BIOS menu done (%d items)\n",menu->items_count);
+ printf("MENU: BIOS menu done (%d items)\n", menu->items_count);
}
/* Compute Motherboard main menu */
-void compute_motherboard(struct s_my_menu *menu,s_dmi *dmi) {
- char buffer[SUBMENULEN+1];
- char statbuffer[STATLEN+1];
+void compute_motherboard(struct s_my_menu *menu, s_dmi * dmi)
+{
+ char buffer[SUBMENULEN + 1];
+ char statbuffer[STATLEN + 1];
- menu->menu = add_menu(" Motherboard ",-1);
- menu->items_count=0;
- set_menu_pos(SUBMENU_Y,SUBMENU_X);
+ menu->menu = add_menu(" Motherboard ", -1);
+ menu->items_count = 0;
+ set_menu_pos(SUBMENU_Y, SUBMENU_X);
- snprintf(buffer,sizeof buffer,"Vendor : %s",dmi->base_board.manufacturer);
- snprintf(statbuffer,sizeof statbuffer,"Vendor: %s",dmi->base_board.manufacturer);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Vendor : %s",
+ dmi->base_board.manufacturer);
+ snprintf(statbuffer, sizeof statbuffer, "Vendor: %s",
+ dmi->base_board.manufacturer);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Product : %s",dmi->base_board.product_name);
- snprintf(statbuffer,sizeof statbuffer,"Product Name: %s",dmi->base_board.product_name);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Product : %s",
+ dmi->base_board.product_name);
+ snprintf(statbuffer, sizeof statbuffer, "Product Name: %s",
+ dmi->base_board.product_name);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Version : %s",dmi->base_board.version);
- snprintf(statbuffer,sizeof statbuffer,"Version: %s",dmi->base_board.version);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Version : %s",
+ dmi->base_board.version);
+ snprintf(statbuffer, sizeof statbuffer, "Version: %s",
+ dmi->base_board.version);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Serial : %s",dmi->base_board.serial);
- snprintf(statbuffer,sizeof statbuffer,"Serial Number: %s",dmi->base_board.serial);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Serial : %s",
+ dmi->base_board.serial);
+ snprintf(statbuffer, sizeof statbuffer, "Serial Number: %s",
+ dmi->base_board.serial);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Asset Tag : %s",dmi->base_board.asset_tag);
- snprintf(statbuffer,sizeof statbuffer,"Asset Tag: %s",dmi->base_board.asset_tag);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Asset Tag : %s",
+ dmi->base_board.asset_tag);
+ snprintf(statbuffer, sizeof statbuffer, "Asset Tag: %s",
+ dmi->base_board.asset_tag);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Location : %s",dmi->base_board.location);
- snprintf(statbuffer,sizeof statbuffer,"Location: %s",dmi->base_board.location);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Location : %s",
+ dmi->base_board.location);
+ snprintf(statbuffer, sizeof statbuffer, "Location: %s",
+ dmi->base_board.location);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Type : %s",dmi->base_board.type);
- snprintf(statbuffer,sizeof statbuffer,"Type: %s",dmi->base_board.type);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Type : %s", dmi->base_board.type);
+ snprintf(statbuffer, sizeof statbuffer, "Type: %s",
+ dmi->base_board.type);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- printf("MENU: Motherboard menu done (%d items)\n",menu->items_count);
+ printf("MENU: Motherboard menu done (%d items)\n", menu->items_count);
}
-/* Compute the memory submenu */
-void compute_memory_module(struct s_my_menu *menu, s_dmi *dmi, int slot_number) {
- int i=slot_number;
- char buffer[MENULEN+1];
- char statbuffer[STATLEN+1];
+/* Compute the Memory submenu */
+static void compute_memory_module(struct s_my_menu *menu, s_dmi * dmi,
+ int slot_number)
+{
+ int i = slot_number;
+ char buffer[MENULEN + 1];
+ char statbuffer[STATLEN + 1];
- sprintf(buffer," Bank <%d> ",i);
- menu->items_count=0;
- menu->menu = add_menu(buffer,-1);
+ sprintf(buffer, " Bank <%d> ", i);
+ menu->items_count = 0;
+ menu->menu = add_menu(buffer, -1);
- snprintf(buffer,sizeof buffer,"Form Factor : %s",dmi->memory[i].form_factor);
- snprintf(statbuffer,sizeof statbuffer,"Form Factor: %s",dmi->memory[i].form_factor);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Form Factor : %s",
+ dmi->memory[i].form_factor);
+ snprintf(statbuffer, sizeof statbuffer, "Form Factor: %s",
+ dmi->memory[i].form_factor);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Type : %s",dmi->memory[i].type);
- snprintf(statbuffer,sizeof statbuffer,"Type: %s",dmi->memory[i].type);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Type : %s",
+ dmi->memory[i].type);
+ snprintf(statbuffer, sizeof statbuffer, "Type: %s",
+ dmi->memory[i].type);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Type Details : %s",dmi->memory[i].type_detail);
- snprintf(statbuffer,sizeof statbuffer,"Type Details: %s",dmi->memory[i].type_detail);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Type Details : %s",
+ dmi->memory[i].type_detail);
+ snprintf(statbuffer, sizeof statbuffer, "Type Details: %s",
+ dmi->memory[i].type_detail);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Speed : %s",dmi->memory[i].speed);
- snprintf(statbuffer,sizeof statbuffer,"Speed (Mhz): %s",dmi->memory[i].speed);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Speed : %s",
+ dmi->memory[i].speed);
+ snprintf(statbuffer, sizeof statbuffer, "Speed (Mhz): %s",
+ dmi->memory[i].speed);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Size : %s",dmi->memory[i].size);
- snprintf(statbuffer,sizeof statbuffer,"Size: %s",dmi->memory[i].size);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Size : %s",
+ dmi->memory[i].size);
+ snprintf(statbuffer, sizeof statbuffer, "Size: %s",
+ dmi->memory[i].size);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Device Set : %s",dmi->memory[i].device_set);
- snprintf(statbuffer,sizeof statbuffer,"Device Set: %s",dmi->memory[i].device_set);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Device Set : %s",
+ dmi->memory[i].device_set);
+ snprintf(statbuffer, sizeof statbuffer, "Device Set: %s",
+ dmi->memory[i].device_set);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Device Loc. : %s",dmi->memory[i].device_locator);
- snprintf(statbuffer,sizeof statbuffer,"Device Location: %s",dmi->memory[i].device_locator);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Device Loc. : %s",
+ dmi->memory[i].device_locator);
+ snprintf(statbuffer, sizeof statbuffer, "Device Location: %s",
+ dmi->memory[i].device_locator);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Bank Locator : %s",dmi->memory[i].bank_locator);
- snprintf(statbuffer,sizeof statbuffer,"Bank Locator: %s",dmi->memory[i].bank_locator);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Bank Locator : %s",
+ dmi->memory[i].bank_locator);
+ snprintf(statbuffer, sizeof statbuffer, "Bank Locator: %s",
+ dmi->memory[i].bank_locator);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Total Width : %s",dmi->memory[i].total_width);
- snprintf(statbuffer,sizeof statbuffer,"Total bit Width: %s",dmi->memory[i].total_width);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Total Width : %s",
+ dmi->memory[i].total_width);
+ snprintf(statbuffer, sizeof statbuffer, "Total bit Width: %s",
+ dmi->memory[i].total_width);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Data Width : %s",dmi->memory[i].data_width);
- snprintf(statbuffer,sizeof statbuffer,"Data bit Width: %s",dmi->memory[i].data_width);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Data Width : %s",
+ dmi->memory[i].data_width);
+ snprintf(statbuffer, sizeof statbuffer, "Data bit Width: %s",
+ dmi->memory[i].data_width);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Error : %s",dmi->memory[i].error);
- snprintf(statbuffer,sizeof statbuffer,"Error: %s",dmi->memory[i].error);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Error : %s",
+ dmi->memory[i].error);
+ snprintf(statbuffer, sizeof statbuffer, "Error: %s",
+ dmi->memory[i].error);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Vendor : %s",dmi->memory[i].manufacturer);
- snprintf(statbuffer,sizeof statbuffer,"Vendor: %s",dmi->memory[i].manufacturer);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Vendor : %s",
+ dmi->memory[i].manufacturer);
+ snprintf(statbuffer, sizeof statbuffer, "Vendor: %s",
+ dmi->memory[i].manufacturer);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Serial : %s",dmi->memory[i].serial);
- snprintf(statbuffer,sizeof statbuffer,"Serial: %s",dmi->memory[i].serial);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Serial : %s",
+ dmi->memory[i].serial);
+ snprintf(statbuffer, sizeof statbuffer, "Serial: %s",
+ dmi->memory[i].serial);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Asset Tag : %s",dmi->memory[i].asset_tag);
- snprintf(statbuffer,sizeof statbuffer,"Asset Tag: %s",dmi->memory[i].asset_tag);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Asset Tag : %s",
+ dmi->memory[i].asset_tag);
+ snprintf(statbuffer, sizeof statbuffer, "Asset Tag: %s",
+ dmi->memory[i].asset_tag);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Part Number : %s",dmi->memory[i].part_number);
- snprintf(buffer,sizeof statbuffer,"Part Number: %s",dmi->memory[i].part_number);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Part Number : %s",
+ dmi->memory[i].part_number);
+ snprintf(buffer, sizeof statbuffer, "Part Number: %s",
+ dmi->memory[i].part_number);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
}
-/* Compute the Memory Menu*/
-void compute_memory(struct s_hdt_menu *menu, s_dmi *dmi) {
- char buffer[MENULEN+1];
- for (int i=0;i<dmi->memory_count;i++) {
- compute_memory_module(&(menu->memory_sub_menu[i]),dmi,i);
- }
-
- menu->memory_menu.menu = add_menu(" Memory Banks ",-1);
- menu->memory_menu.items_count=0;
-
- for (int i=0;i<dmi->memory_count;i++) {
- snprintf(buffer,sizeof buffer," Bank <%d> ",i);
- add_item(buffer,"Memory Bank",OPT_SUBMENU,NULL,menu->memory_sub_menu[i].menu);
- menu->memory_menu.items_count++;
- }
- printf("MENU: Memory menu done (%d items)\n",menu->memory_menu.items_count);
- add_item("Run Test","Run Test",OPT_RUN,"memtest",0);
+/* Compute the Memory menu */
+void compute_memory(struct s_hdt_menu *menu, s_dmi * dmi)
+{
+ char buffer[MENULEN + 1];
+ for (int i = 0; i < dmi->memory_count; i++) {
+ compute_memory_module(&(menu->memory_sub_menu[i]), dmi, i);
+ }
+
+ menu->memory_menu.menu = add_menu(" Memory Banks ", -1);
+ menu->memory_menu.items_count = 0;
+
+ for (int i = 0; i < dmi->memory_count; i++) {
+ snprintf(buffer, sizeof buffer, " Bank <%d> ", i);
+ add_item(buffer, "Memory Bank", OPT_SUBMENU, NULL,
+ menu->memory_sub_menu[i].menu);
+ menu->memory_menu.items_count++;
+ }
+ printf("MENU: Memory menu done (%d items)\n",
+ menu->memory_menu.items_count);
+ add_item("Run Test", "Run Test", OPT_RUN, "memtest", 0);
}
+/* Compute Main Battery menu */
+void compute_battery(struct s_my_menu *menu, s_dmi * dmi)
+{
+ char buffer[SUBMENULEN + 1];
+ char statbuffer[STATLEN + 1];
+ menu->menu = add_menu(" Battery ", -1);
+ menu->items_count = 0;
+ set_menu_pos(SUBMENU_Y, SUBMENU_X);
-/* Main Battery Menu*/
-void compute_battery(struct s_my_menu *menu, s_dmi *dmi) {
- char buffer[SUBMENULEN+1];
- char statbuffer[STATLEN+1];
- menu->menu = add_menu(" Battery ",-1);
- menu->items_count=0;
- set_menu_pos(SUBMENU_Y,SUBMENU_X);
-
- snprintf(buffer, sizeof buffer,"Vendor : %s",dmi->battery.manufacturer);
- snprintf(statbuffer, sizeof statbuffer,"Vendor: %s",dmi->battery.manufacturer);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Vendor : %s",
+ dmi->battery.manufacturer);
+ snprintf(statbuffer, sizeof statbuffer, "Vendor: %s",
+ dmi->battery.manufacturer);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer,"Manufacture Date: %s",dmi->battery.manufacture_date);
- snprintf(statbuffer, sizeof statbuffer,"Manufacture Date: %s",dmi->battery.manufacture_date);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Manufacture Date: %s",
+ dmi->battery.manufacture_date);
+ snprintf(statbuffer, sizeof statbuffer, "Manufacture Date: %s",
+ dmi->battery.manufacture_date);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer,"Serial : %s",dmi->battery.serial);
- snprintf(statbuffer, sizeof statbuffer,"Serial: %s",dmi->battery.serial);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Serial : %s",
+ dmi->battery.serial);
+ snprintf(statbuffer, sizeof statbuffer, "Serial: %s",
+ dmi->battery.serial);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer,"Name : %s",dmi->battery.name);
- snprintf(statbuffer, sizeof statbuffer,"Name: %s",dmi->battery.name);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Name : %s",
+ dmi->battery.name);
+ snprintf(statbuffer, sizeof statbuffer, "Name: %s", dmi->battery.name);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer,"Chemistry : %s",dmi->battery.chemistry);
- snprintf(statbuffer, sizeof statbuffer,"Chemistry: %s",dmi->battery.chemistry);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Chemistry : %s",
+ dmi->battery.chemistry);
+ snprintf(statbuffer, sizeof statbuffer, "Chemistry: %s",
+ dmi->battery.chemistry);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer,"Design Capacity : %s",dmi->battery.design_capacity);
- snprintf(statbuffer, sizeof statbuffer,"Design Capacity: %s",dmi->battery.design_capacity);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Design Capacity : %s",
+ dmi->battery.design_capacity);
+ snprintf(statbuffer, sizeof statbuffer, "Design Capacity: %s",
+ dmi->battery.design_capacity);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer,"Design Voltage : %s",dmi->battery.design_voltage);
- snprintf(statbuffer, sizeof statbuffer,"Design Voltage : %s",dmi->battery.design_voltage);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Design Voltage : %s",
+ dmi->battery.design_voltage);
+ snprintf(statbuffer, sizeof statbuffer, "Design Voltage : %s",
+ dmi->battery.design_voltage);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer,"SBDS : %s",dmi->battery.sbds);
- snprintf(statbuffer, sizeof statbuffer,"SBDS: %s",dmi->battery.sbds);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "SBDS : %s",
+ dmi->battery.sbds);
+ snprintf(statbuffer, sizeof statbuffer, "SBDS: %s", dmi->battery.sbds);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer,"SBDS Manuf. Date: %s",dmi->battery.sbds_manufacture_date);
- snprintf(statbuffer, sizeof statbuffer,"SBDS Manufacture Date: %s",dmi->battery.sbds_manufacture_date);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "SBDS Manuf. Date: %s",
+ dmi->battery.sbds_manufacture_date);
+ snprintf(statbuffer, sizeof statbuffer, "SBDS Manufacture Date: %s",
+ dmi->battery.sbds_manufacture_date);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer,"SBDS Chemistry : %s",dmi->battery.sbds_chemistry);
- snprintf(statbuffer, sizeof statbuffer,"SBDS Chemistry : %s",dmi->battery.sbds_chemistry);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "SBDS Chemistry : %s",
+ dmi->battery.sbds_chemistry);
+ snprintf(statbuffer, sizeof statbuffer, "SBDS Chemistry : %s",
+ dmi->battery.sbds_chemistry);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer,"Maximum Error : %s",dmi->battery.maximum_error);
- snprintf(statbuffer, sizeof statbuffer,"Maximum Error (%) : %s",dmi->battery.maximum_error);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Maximum Error : %s",
+ dmi->battery.maximum_error);
+ snprintf(statbuffer, sizeof statbuffer, "Maximum Error (%) : %s",
+ dmi->battery.maximum_error);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer,"OEM Info : %s",dmi->battery.oem_info);
- snprintf(statbuffer, sizeof statbuffer,"OEM Info: %s",dmi->battery.oem_info);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "OEM Info : %s",
+ dmi->battery.oem_info);
+ snprintf(statbuffer, sizeof statbuffer, "OEM Info: %s",
+ dmi->battery.oem_info);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- printf("MENU: Battery menu done (%d items)\n",menu->items_count);
+ printf("MENU: Battery menu done (%d items)\n", menu->items_count);
}
diff --git a/com32/hdt/hdt-menu-kernel.c b/com32/hdt/hdt-menu-kernel.c
index 39979279..b94d1fed 100644
--- a/com32/hdt/hdt-menu-kernel.c
+++ b/com32/hdt/hdt-menu-kernel.c
@@ -24,50 +24,68 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#include "hdt-menu.h"
-/* Main Kernel Menu*/
-void compute_kernel(struct s_my_menu *menu,struct s_hardware *hardware) {
- char buffer[SUBMENULEN+1];
- char infobar[STATLEN+1];
- char kernel_modules [LINUX_KERNEL_MODULE_SIZE*MAX_KERNEL_MODULES_PER_PCI_DEVICE];
+/* Main Kernel menu */
+void compute_kernel(struct s_my_menu *menu, struct s_hardware *hardware)
+{
+ char buffer[SUBMENULEN + 1];
+ char infobar[STATLEN + 1];
+ char kernel_modules[LINUX_KERNEL_MODULE_SIZE *
+ MAX_KERNEL_MODULES_PER_PCI_DEVICE];
struct pci_device *pci_device;
- menu->menu = add_menu(" Kernel Modules ",-1);
- menu->items_count=0;
- set_menu_pos(SUBMENU_Y,SUBMENU_X);
+ menu->menu = add_menu(" Kernel Modules ", -1);
+ menu->items_count = 0;
+ set_menu_pos(SUBMENU_Y, SUBMENU_X);
if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) {
- add_item("The modules.pcimap file is missing","Missing modules.pcimap file",OPT_INACTIVE,NULL,0);
- add_item("Kernel modules can't be computed.","Missing modules.pcimap file",OPT_INACTIVE,NULL,0);
- add_item("Please put one in same dir as hdt","Missing modules.pcimap file",OPT_INACTIVE,NULL,0);
- add_item("","",OPT_SEP,"",0);
- } else {
- /* 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);
+ add_item("The modules.pcimap file is missing",
+ "Missing modules.pcimap file", OPT_INACTIVE, NULL, 0);
+ add_item("Kernel modules can't be computed.",
+ "Missing modules.pcimap file", OPT_INACTIVE, NULL, 0);
+ add_item("Please put one in same dir as hdt",
+ "Missing modules.pcimap file", OPT_INACTIVE, NULL, 0);
+ add_item("", "", OPT_SEP, "", 0);
+ } else {
+ /*
+ * 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);
}
- /* 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(infobar, sizeof infobar,"%04x:%04x %s : %s\n",
- pci_device->vendor, pci_device->product,
- pci_device->dev_info->vendor_name,
- pci_device->dev_info->product_name);
+ 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(infobar, sizeof infobar,
+ "%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,infobar,OPT_INACTIVE,NULL,0);
- menu->items_count++;
- }
+ add_item(buffer, infobar, OPT_INACTIVE, NULL,
+ 0);
+ menu->items_count++;
+ }
}
}
- printf("MENU: Kernel menu done (%d items)\n",menu->items_count);
+ printf("MENU: Kernel menu done (%d items)\n", menu->items_count);
}
-
diff --git a/com32/hdt/hdt-menu-pci.c b/com32/hdt/hdt-menu-pci.c
index 477ba4aa..ab31efd5 100644
--- a/com32/hdt/hdt-menu-pci.c
+++ b/com32/hdt/hdt-menu-pci.c
@@ -24,102 +24,155 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#include "hdt-menu.h"
-
-/* Dynamic submenu for the pci devices */
-void compute_pci_device(struct s_my_menu *menu,struct pci_device *pci_device,int pci_bus, int pci_slot, int pci_func) {
+/* Dynamic submenu for pci devices */
+static void compute_pci_device(struct s_my_menu *menu,
+ struct pci_device *pci_device,
+ int pci_bus, int pci_slot, int pci_func)
+{
char buffer[56];
char statbuffer[STATLEN];
- char kernel_modules [LINUX_KERNEL_MODULE_SIZE*MAX_KERNEL_MODULES_PER_PCI_DEVICE];
+ char kernel_modules[LINUX_KERNEL_MODULE_SIZE *
+ MAX_KERNEL_MODULES_PER_PCI_DEVICE];
+
+ menu->menu = add_menu(" Details ", -1);
+ menu->items_count = 0;
+ set_menu_pos(5, 17);
+
+ snprintf(buffer, sizeof buffer, "Vendor : %s",
+ pci_device->dev_info->vendor_name);
+ snprintf(statbuffer, sizeof statbuffer, "Vendor Name: %s",
+ pci_device->dev_info->vendor_name);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
- menu->menu = add_menu(" Details ",-1);
- menu->items_count=0;
- set_menu_pos(5,17);
+ snprintf(buffer, sizeof buffer, "Product : %s",
+ pci_device->dev_info->product_name);
+ snprintf(statbuffer, sizeof statbuffer, "Product Name %s",
+ pci_device->dev_info->product_name);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
- snprintf(buffer,sizeof buffer,"Vendor : %s",pci_device->dev_info->vendor_name);
- snprintf(statbuffer,sizeof statbuffer,"Vendor Name: %s",pci_device->dev_info->vendor_name);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
- menu->items_count++;
+ snprintf(buffer, sizeof buffer, "Class : %s",
+ pci_device->dev_info->class_name);
+ snprintf(statbuffer, sizeof statbuffer, "Class Name: %s",
+ pci_device->dev_info->class_name);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
- snprintf(buffer,sizeof buffer,"Product : %s",pci_device->dev_info->product_name);
- snprintf(statbuffer,sizeof statbuffer,"Product Name %s",pci_device->dev_info->product_name);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
- menu->items_count++;
+ snprintf(buffer, sizeof buffer, "Location: %02x:%02x.%01x", pci_bus,
+ pci_slot, pci_func);
+ snprintf(statbuffer, sizeof statbuffer,
+ "Location on the PCI Bus: %02x:%02x.%01x", pci_bus, pci_slot,
+ pci_func);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
- snprintf(buffer,sizeof buffer,"Class : %s",pci_device->dev_info->class_name);
- snprintf(statbuffer,sizeof statbuffer,"Class Name: %s",pci_device->dev_info->class_name);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
- menu->items_count++;
+ snprintf(buffer, sizeof buffer, "PCI ID : %04x:%04x[%04x:%04x]",
+ pci_device->vendor, pci_device->product,
+ pci_device->sub_vendor, pci_device->sub_product);
+ snprintf(statbuffer, sizeof statbuffer,
+ "vendor:product[sub_vendor:sub_product] : %04x:%04x[%04x:%04x]",
+ pci_device->vendor, pci_device->product,
+ pci_device->sub_vendor, pci_device->sub_product);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
+
+ if ((pci_device->dev_info->irq>0) && (pci_device->dev_info->irq<255)) {
+ snprintf(buffer, sizeof buffer,"IRQ : %d", pci_device->dev_info->irq);
+ snprintf(statbuffer, sizeof statbuffer,"IRQ : %d", pci_device->dev_info->irq);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
+ }
- snprintf(buffer,sizeof buffer,"Location: %02x:%02x.%01x",pci_bus, pci_slot, pci_func);
- snprintf(statbuffer,sizeof statbuffer,"Location on the PCI Bus: %02x:%02x.%01x",pci_bus, pci_slot, pci_func);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
- menu->items_count++;
+ snprintf(buffer,sizeof buffer,"Latency : %d",pci_device->dev_info->latency);
+ snprintf(statbuffer,sizeof statbuffer,"Latency : %d",pci_device->dev_info->latency);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
- snprintf(buffer,sizeof buffer,"PCI ID : %04x:%04x[%04x:%04x]",pci_device->vendor, pci_device->product,pci_device->sub_vendor, pci_device->sub_product);
- snprintf(statbuffer,sizeof statbuffer,"vendor:product[sub_vendor:sub_product] : %04x:%04x[%04x:%04x]",pci_device->vendor, pci_device->product,pci_device->sub_vendor, pci_device->sub_product);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
- menu->items_count++;
- if (pci_device->dev_info->linux_kernel_module_count>1) {
- for (int i=0; i<pci_device->dev_info->linux_kernel_module_count;i++) {
- if (i>0) {
- strncat(kernel_modules," | ",3);
+ if (pci_device->dev_info->linux_kernel_module_count > 1) {
+ 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);
+ strncat(kernel_modules,
+ pci_device->dev_info->linux_kernel_module[i],
+ LINUX_KERNEL_MODULE_SIZE - 1);
}
- snprintf(buffer,sizeof buffer,"Modules : %s",kernel_modules);
- snprintf(statbuffer,sizeof statbuffer,"Kernel Modules: %s",kernel_modules);
- } else {
- snprintf(buffer,sizeof buffer,"Module : %s",pci_device->dev_info->linux_kernel_module[0]);
- snprintf(statbuffer,sizeof statbuffer,"Kernel Module: %s",pci_device->dev_info->linux_kernel_module[0]);
- }
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
- menu->items_count++;
+ snprintf(buffer, sizeof buffer, "Modules : %s", kernel_modules);
+ snprintf(statbuffer, sizeof statbuffer, "Kernel Modules: %s",
+ kernel_modules);
+ } else {
+ snprintf(buffer, sizeof buffer, "Module : %s",
+ pci_device->dev_info->linux_kernel_module[0]);
+ snprintf(statbuffer, sizeof statbuffer, "Kernel Module: %s",
+ pci_device->dev_info->linux_kernel_module[0]);
+ }
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
}
-/* Main PCI Menu*/
-int compute_PCI(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware) {
- int i=0;
- char menuname[255][MENULEN+1];
- char infobar[255][STATLEN+1];
- struct pci_device *pci_device;
- char kernel_modules [LINUX_KERNEL_MODULE_SIZE*MAX_KERNEL_MODULES_PER_PCI_DEVICE];
+/* Main PCI menu */
+int compute_PCI(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
+{
+ int i = 0;
+ char menuname[255][MENULEN + 1];
+ char infobar[255][STATLEN + 1];
+ struct pci_device *pci_device;
+ char kernel_modules[LINUX_KERNEL_MODULE_SIZE *
+ MAX_KERNEL_MODULES_PER_PCI_DEVICE];
- /* For every detected pci device, compute its submenu */
- for_each_pci_func(pci_device, hardware->pci_domain) {
- memset(kernel_modules,0,sizeof kernel_modules);
- for (int kmod=0; kmod<pci_device->dev_info->linux_kernel_module_count;kmod++) {
- if (kmod>0) {
- strncat(kernel_modules," | ",3);
- }
- strncat(kernel_modules, pci_device->dev_info->linux_kernel_module[kmod],LINUX_KERNEL_MODULE_SIZE-1);
- }
- if (pci_device->dev_info->linux_kernel_module_count==0) strlcpy(kernel_modules,"unknown",7);
+ /* For every detected pci device, compute its submenu */
+ for_each_pci_func(pci_device, hardware->pci_domain) {
+ memset(kernel_modules, 0, sizeof kernel_modules);
+ for (int kmod = 0;
+ kmod < pci_device->dev_info->linux_kernel_module_count;
+ kmod++) {
+ if (kmod > 0) {
+ strncat(kernel_modules, " | ", 3);
+ }
+ strncat(kernel_modules,
+ pci_device->dev_info->linux_kernel_module[kmod],
+ LINUX_KERNEL_MODULE_SIZE - 1);
+ }
+ if (pci_device->dev_info->linux_kernel_module_count == 0)
+ strlcpy(kernel_modules, "unknown", 7);
- compute_pci_device(&(hdt_menu->pci_sub_menu[i]),pci_device,__pci_bus,__pci_slot,__pci_func);
- snprintf(menuname[i],59,"%s|%s",pci_device->dev_info->vendor_name,pci_device->dev_info->product_name);
- snprintf(infobar[i], STATLEN,"%02x:%02x.%01x # %s # ID:%04x:%04x[%04x:%04x] # Kmod:%s\n",
- __pci_bus, __pci_slot, __pci_func,pci_device->dev_info->class_name,
- pci_device->vendor, pci_device->product,
- pci_device->sub_vendor, pci_device->sub_product,kernel_modules);
- i++;
- }
+ compute_pci_device(&(hdt_menu->pci_sub_menu[i]), pci_device,
+ __pci_bus, __pci_slot, __pci_func);
+ snprintf(menuname[i], 59, "%s|%s",
+ pci_device->dev_info->vendor_name,
+ pci_device->dev_info->product_name);
+ snprintf(infobar[i], STATLEN,
+ "%02x:%02x.%01x # %s # ID:%04x:%04x[%04x:%04x] # Kmod:%s\n",
+ __pci_bus, __pci_slot, __pci_func,
+ pci_device->dev_info->class_name, pci_device->vendor,
+ pci_device->product, pci_device->sub_vendor,
+ pci_device->sub_product, kernel_modules);
+ i++;
+ }
- hdt_menu->pci_menu.menu = add_menu(" PCI Devices ",-1);
- hdt_menu->pci_menu.items_count=0;
- if (hardware->pci_ids_return_code == -ENOPCIIDS) {
- add_item("The pci.ids file is missing","Missing pci.ids file",OPT_INACTIVE,NULL,0);
- add_item("PCI Device names can't be computed.","Missing pci.ids file",OPT_INACTIVE,NULL,0);
- add_item("Please put one in same dir as hdt","Missing pci.ids file",OPT_INACTIVE,NULL,0);
- add_item("","",OPT_SEP,"",0);
+ hdt_menu->pci_menu.menu = add_menu(" PCI Devices ", -1);
+ hdt_menu->pci_menu.items_count = 0;
+ if (hardware->pci_ids_return_code == -ENOPCIIDS) {
+ add_item("The pci.ids file is missing", "Missing pci.ids file",
+ OPT_INACTIVE, NULL, 0);
+ add_item("PCI Device names can't be computed.",
+ "Missing pci.ids file", OPT_INACTIVE, NULL, 0);
+ add_item("Please put one in same dir as hdt",
+ "Missing pci.ids file", OPT_INACTIVE, NULL, 0);
+ add_item("", "", OPT_SEP, "", 0);
+ }
+ for (int j = 0; j < i; j++) {
+ add_item(menuname[j], infobar[j], OPT_SUBMENU, NULL,
+ hdt_menu->pci_sub_menu[j].menu);
+ hdt_menu->pci_menu.items_count++;
}
- for (int j=0;j<i;j++) {
- add_item(menuname[j],infobar[j],OPT_SUBMENU,NULL,hdt_menu->pci_sub_menu[j].menu);
- hdt_menu->pci_menu.items_count++;
- }
- printf("MENU: PCI menu done (%d items)\n",hdt_menu->pci_menu.items_count);
- return 0;
+ printf("MENU: PCI menu done (%d items)\n",
+ hdt_menu->pci_menu.items_count);
+ return 0;
}
diff --git a/com32/hdt/hdt-menu-processor.c b/com32/hdt/hdt-menu-processor.c
index d0d7dd7b..d71fbe1f 100644
--- a/com32/hdt/hdt-menu-processor.c
+++ b/com32/hdt/hdt-menu-processor.c
@@ -24,163 +24,217 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#include "hdt-menu.h"
/* Compute Processor menu */
-void compute_processor(struct s_my_menu *menu,struct s_hardware *hardware) {
- char buffer[SUBMENULEN+1];
- char buffer1[SUBMENULEN+1];
- char statbuffer[STATLEN+1];
-
- menu->menu = add_menu(" Main Processor ",-1);
- menu->items_count=0;
- set_menu_pos(SUBMENU_Y,SUBMENU_X);
-
- snprintf(buffer,sizeof buffer,"Vendor : %s",hardware->cpu.vendor);
- snprintf(statbuffer,sizeof statbuffer,"Vendor: %s",hardware->cpu.vendor);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+void compute_processor(struct s_my_menu *menu, struct s_hardware *hardware)
+{
+ char buffer[SUBMENULEN + 1];
+ char buffer1[SUBMENULEN + 1];
+ char statbuffer[STATLEN + 1];
+
+ menu->menu = add_menu(" Main Processor ", -1);
+ menu->items_count = 0;
+ set_menu_pos(SUBMENU_Y, SUBMENU_X);
+
+ snprintf(buffer, sizeof buffer, "Vendor : %s", hardware->cpu.vendor);
+ snprintf(statbuffer, sizeof statbuffer, "Vendor: %s",
+ hardware->cpu.vendor);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Model : %s",hardware->cpu.model);
- snprintf(statbuffer,sizeof statbuffer,"Model: %s",hardware->cpu.model);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Model : %s", hardware->cpu.model);
+ snprintf(statbuffer, sizeof statbuffer, "Model: %s",
+ hardware->cpu.model);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Vendor ID : %d",hardware->cpu.vendor_id);
- snprintf(statbuffer,sizeof statbuffer,"Vendor ID: %d",hardware->cpu.vendor_id);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Vendor ID : %d",
+ hardware->cpu.vendor_id);
+ snprintf(statbuffer, sizeof statbuffer, "Vendor ID: %d",
+ hardware->cpu.vendor_id);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Family ID : %d",hardware->cpu.family);
- snprintf(statbuffer,sizeof statbuffer,"Family ID: %d",hardware->cpu.family);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Family ID : %d", hardware->cpu.family);
+ snprintf(statbuffer, sizeof statbuffer, "Family ID: %d",
+ hardware->cpu.family);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Model ID : %d",hardware->cpu.model_id);
- snprintf(statbuffer,sizeof statbuffer,"Model ID: %d",hardware->cpu.model_id);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Model ID : %d",
+ hardware->cpu.model_id);
+ snprintf(statbuffer, sizeof statbuffer, "Model ID: %d",
+ hardware->cpu.model_id);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer,sizeof buffer,"Stepping : %d",hardware->cpu.stepping);
- snprintf(statbuffer,sizeof statbuffer,"Stepping: %d",hardware->cpu.stepping);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Stepping : %d",
+ hardware->cpu.stepping);
+ snprintf(statbuffer, sizeof statbuffer, "Stepping: %d",
+ hardware->cpu.stepping);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
if (hardware->is_dmi_valid) {
- snprintf(buffer,sizeof buffer,"FSB : %d",hardware->dmi.processor.external_clock);
- snprintf(statbuffer,sizeof statbuffer,"Front Side Bus (MHz): %d",hardware->dmi.processor.external_clock);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
- menu->items_count++;
-
- snprintf(buffer,sizeof buffer,"Cur. Speed: %d",hardware->dmi.processor.current_speed);
- snprintf(statbuffer,sizeof statbuffer,"Current Speed (MHz): %d",hardware->dmi.processor.current_speed);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
- menu->items_count++;
-
- snprintf(buffer,sizeof buffer,"Max Speed : %d",hardware->dmi.processor.max_speed);
- snprintf(statbuffer,sizeof statbuffer,"Max Speed (MHz): %d",hardware->dmi.processor.max_speed);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
- menu->items_count++;
-
- snprintf(buffer,sizeof buffer,"Upgrade : %s", hardware->dmi.processor.upgrade);
- snprintf(statbuffer,sizeof statbuffer,"Upgrade: %s",hardware->dmi.processor.upgrade);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
- menu->items_count++;
+ snprintf(buffer, sizeof buffer, "FSB : %d",
+ hardware->dmi.processor.external_clock);
+ snprintf(statbuffer, sizeof statbuffer,
+ "Front Side Bus (MHz): %d",
+ hardware->dmi.processor.external_clock);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
+
+ snprintf(buffer, sizeof buffer, "Cur. Speed: %d",
+ hardware->dmi.processor.current_speed);
+ snprintf(statbuffer, sizeof statbuffer,
+ "Current Speed (MHz): %d",
+ hardware->dmi.processor.current_speed);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
+
+ snprintf(buffer, sizeof buffer, "Max Speed : %d",
+ hardware->dmi.processor.max_speed);
+ snprintf(statbuffer, sizeof statbuffer, "Max Speed (MHz): %d",
+ hardware->dmi.processor.max_speed);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
+
+ snprintf(buffer, sizeof buffer, "Upgrade : %s",
+ hardware->dmi.processor.upgrade);
+ snprintf(statbuffer, sizeof statbuffer, "Upgrade: %s",
+ hardware->dmi.processor.upgrade);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
}
if (hardware->cpu.flags.smp) {
- snprintf(buffer,sizeof buffer,"SMP : Yes");
- snprintf(statbuffer,sizeof statbuffer,"SMP: Yes");
+ snprintf(buffer, sizeof buffer, "SMP : Yes");
+ snprintf(statbuffer, sizeof statbuffer, "SMP: Yes");
+ } else {
+ snprintf(buffer, sizeof buffer, "SMP : No");
+ snprintf(statbuffer, sizeof statbuffer, "SMP: No");
}
- else {
- snprintf(buffer,sizeof buffer,"SMP : No");
- snprintf(statbuffer,sizeof statbuffer,"SMP: No");
- }
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
if (hardware->cpu.flags.lm) {
- snprintf(buffer,sizeof buffer,"x86_64 : Yes");
- snprintf(statbuffer,sizeof statbuffer,"x86_64 compatible processor: Yes");
- }
- else {
- snprintf(buffer,sizeof buffer,"X86_64 : No");
- snprintf(statbuffer,sizeof statbuffer,"X86_64 compatible processor: No");
+ snprintf(buffer, sizeof buffer, "x86_64 : Yes");
+ snprintf(statbuffer, sizeof statbuffer,
+ "x86_64 compatible processor: Yes");
+ } else {
+ snprintf(buffer, sizeof buffer, "X86_64 : No");
+ snprintf(statbuffer, sizeof statbuffer,
+ "X86_64 compatible processor: No");
}
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- buffer1[0]='\0';
- if (hardware->cpu.flags.fpu) strcat(buffer1,"fpu ");
- if (hardware->cpu.flags.vme) strcat(buffer1,"vme ");
- if (hardware->cpu.flags.de) strcat(buffer1,"de ");
- if (hardware->cpu.flags.pse) strcat(buffer1,"pse ");
- if (hardware->cpu.flags.tsc) strcat(buffer1,"tsc ");
- if (hardware->cpu.flags.msr) strcat(buffer1,"msr ");
- if (hardware->cpu.flags.pae) strcat(buffer1,"pae ");
- snprintf(buffer,sizeof buffer,"Flags : %s",buffer1);
- snprintf(statbuffer,sizeof statbuffer,"Flags: %s",buffer1);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ buffer1[0] = '\0';
+ if (hardware->cpu.flags.fpu)
+ strcat(buffer1, "fpu ");
+ if (hardware->cpu.flags.vme)
+ strcat(buffer1, "vme ");
+ if (hardware->cpu.flags.de)
+ strcat(buffer1, "de ");
+ if (hardware->cpu.flags.pse)
+ strcat(buffer1, "pse ");
+ if (hardware->cpu.flags.tsc)
+ strcat(buffer1, "tsc ");
+ if (hardware->cpu.flags.msr)
+ strcat(buffer1, "msr ");
+ if (hardware->cpu.flags.pae)
+ strcat(buffer1, "pae ");
+ snprintf(buffer, sizeof buffer, "Flags : %s", buffer1);
+ snprintf(statbuffer, sizeof statbuffer, "Flags: %s", buffer1);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- buffer1[0]='\0';
- if (hardware->cpu.flags.mce) strcat(buffer1,"mce ");
- if (hardware->cpu.flags.cx8) strcat(buffer1,"cx8 ");
- if (hardware->cpu.flags.apic) strcat(buffer1,"apic ");
- if (hardware->cpu.flags.sep) strcat(buffer1,"sep ");
- if (hardware->cpu.flags.mtrr) strcat(buffer1,"mtrr ");
- if (hardware->cpu.flags.pge) strcat(buffer1,"pge ");
- if (hardware->cpu.flags.mca) strcat(buffer1,"mca ");
- snprintf(buffer,sizeof buffer,"Flags : %s",buffer1);
- snprintf(statbuffer,sizeof statbuffer,"Flags: %s",buffer1);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ buffer1[0] = '\0';
+ if (hardware->cpu.flags.mce)
+ strcat(buffer1, "mce ");
+ if (hardware->cpu.flags.cx8)
+ strcat(buffer1, "cx8 ");
+ if (hardware->cpu.flags.apic)
+ strcat(buffer1, "apic ");
+ if (hardware->cpu.flags.sep)
+ strcat(buffer1, "sep ");
+ if (hardware->cpu.flags.mtrr)
+ strcat(buffer1, "mtrr ");
+ if (hardware->cpu.flags.pge)
+ strcat(buffer1, "pge ");
+ if (hardware->cpu.flags.mca)
+ strcat(buffer1, "mca ");
+ snprintf(buffer, sizeof buffer, "Flags : %s", buffer1);
+ snprintf(statbuffer, sizeof statbuffer, "Flags: %s", buffer1);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- buffer1[0]='\0';
- if (hardware->cpu.flags.cmov) strcat(buffer1,"cmov ");
- if (hardware->cpu.flags.pat) strcat(buffer1,"pat ");
- if (hardware->cpu.flags.pse_36) strcat(buffer1,"pse_36 ");
- if (hardware->cpu.flags.psn) strcat(buffer1,"psn ");
- if (hardware->cpu.flags.clflsh) strcat(buffer1,"clflsh ");
- snprintf(buffer,sizeof buffer,"Flags : %s",buffer1);
- snprintf(statbuffer,sizeof statbuffer,"Flags: %s",buffer1);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ buffer1[0] = '\0';
+ if (hardware->cpu.flags.cmov)
+ strcat(buffer1, "cmov ");
+ if (hardware->cpu.flags.pat)
+ strcat(buffer1, "pat ");
+ if (hardware->cpu.flags.pse_36)
+ strcat(buffer1, "pse_36 ");
+ if (hardware->cpu.flags.psn)
+ strcat(buffer1, "psn ");
+ if (hardware->cpu.flags.clflsh)
+ strcat(buffer1, "clflsh ");
+ snprintf(buffer, sizeof buffer, "Flags : %s", buffer1);
+ snprintf(statbuffer, sizeof statbuffer, "Flags: %s", buffer1);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- buffer1[0]='\0';
- if (hardware->cpu.flags.dts) strcat(buffer1,"dts ");
- if (hardware->cpu.flags.acpi) strcat(buffer1,"acpi ");
- if (hardware->cpu.flags.mmx) strcat(buffer1,"mmx ");
- if (hardware->cpu.flags.sse) strcat(buffer1,"sse ");
- snprintf(buffer,sizeof buffer,"Flags : %s",buffer1);
- snprintf(statbuffer,sizeof statbuffer,"Flags: %s",buffer1);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ buffer1[0] = '\0';
+ if (hardware->cpu.flags.dts)
+ strcat(buffer1, "dts ");
+ if (hardware->cpu.flags.acpi)
+ strcat(buffer1, "acpi ");
+ if (hardware->cpu.flags.mmx)
+ strcat(buffer1, "mmx ");
+ if (hardware->cpu.flags.sse)
+ strcat(buffer1, "sse ");
+ snprintf(buffer, sizeof buffer, "Flags : %s", buffer1);
+ snprintf(statbuffer, sizeof statbuffer, "Flags: %s", buffer1);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- buffer1[0]='\0';
- if (hardware->cpu.flags.sse2) strcat(buffer1,"sse2 ");
- if (hardware->cpu.flags.ss) strcat(buffer1,"ss ");
- if (hardware->cpu.flags.htt) strcat(buffer1,"ht ");
- if (hardware->cpu.flags.acc) strcat(buffer1,"acc ");
- if (hardware->cpu.flags.syscall) strcat(buffer1,"syscall ");
- if (hardware->cpu.flags.mp) strcat(buffer1,"mp ");
- snprintf(buffer,sizeof buffer,"Flags : %s",buffer1);
- snprintf(statbuffer,sizeof statbuffer,"Flags: %s",buffer1);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ buffer1[0] = '\0';
+ if (hardware->cpu.flags.sse2)
+ strcat(buffer1, "sse2 ");
+ if (hardware->cpu.flags.ss)
+ strcat(buffer1, "ss ");
+ if (hardware->cpu.flags.htt)
+ strcat(buffer1, "ht ");
+ if (hardware->cpu.flags.acc)
+ strcat(buffer1, "acc ");
+ if (hardware->cpu.flags.syscall)
+ strcat(buffer1, "syscall ");
+ if (hardware->cpu.flags.mp)
+ strcat(buffer1, "mp ");
+ snprintf(buffer, sizeof buffer, "Flags : %s", buffer1);
+ snprintf(statbuffer, sizeof statbuffer, "Flags: %s", buffer1);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- buffer1[0]='\0';
- if (hardware->cpu.flags.nx) strcat(buffer1,"nx ");
- if (hardware->cpu.flags.mmxext) strcat(buffer1,"mmxext ");
- if (hardware->cpu.flags.lm) strcat(buffer1,"lm ");
- if (hardware->cpu.flags.nowext) strcat(buffer1,"3dnowext ");
- if (hardware->cpu.flags.now) strcat(buffer1,"3dnow! ");
- snprintf(buffer,sizeof buffer,"Flags : %s",buffer1);
- snprintf(statbuffer,sizeof statbuffer,"Flags: %s",buffer1);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ buffer1[0] = '\0';
+ if (hardware->cpu.flags.nx)
+ strcat(buffer1, "nx ");
+ if (hardware->cpu.flags.mmxext)
+ strcat(buffer1, "mmxext ");
+ if (hardware->cpu.flags.lm)
+ strcat(buffer1, "lm ");
+ if (hardware->cpu.flags.nowext)
+ strcat(buffer1, "3dnowext ");
+ if (hardware->cpu.flags.now)
+ strcat(buffer1, "3dnow! ");
+ snprintf(buffer, sizeof buffer, "Flags : %s", buffer1);
+ snprintf(statbuffer, sizeof statbuffer, "Flags: %s", buffer1);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- printf("MENU: Processor menu done (%d items)\n",menu->items_count);
+ printf("MENU: Processor menu done (%d items)\n", menu->items_count);
}
diff --git a/com32/hdt/hdt-menu-pxe.c b/com32/hdt/hdt-menu-pxe.c
index 5ab3d8b3..686117ab 100644
--- a/com32/hdt/hdt-menu-pxe.c
+++ b/com32/hdt/hdt-menu-pxe.c
@@ -24,76 +24,97 @@
* 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);
+/* 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-summary.c b/com32/hdt/hdt-menu-summary.c
index 9bbefbfe..6401221a 100644
--- a/com32/hdt/hdt-menu-summary.c
+++ b/com32/hdt/hdt-menu-summary.c
@@ -28,131 +28,182 @@
#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];
+/* 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;
+ menu->menu = add_menu(" Summary ", -1);
+ menu->items_count = 0;
- set_menu_pos(SUBMENU_Y,SUBMENU_X);
+ 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);
+ 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);
+ 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);
+ 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) {
+ 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++;
- }
+ 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);
- }
+ 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);
+ 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);
+ add_item("", "", OPT_SEP, "", 0);
- if (hardware->is_pxe_valid==true) {
- struct s_pxe *p = &hardware->pxe;
+ 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 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++;
+ 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);
+ 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;
+ 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);
+ if (kmod == true)
+ add_item("", "", OPT_SEP, "", 0);
}
- printf("MENU: Summary menu done (%d items)\n",menu->items_count);
+ printf("MENU: Summary menu done (%d items)\n", menu->items_count);
}
-
diff --git a/com32/hdt/hdt-menu-syslinux.c b/com32/hdt/hdt-menu-syslinux.c
index d17070f8..4c874d0e 100644
--- a/com32/hdt/hdt-menu-syslinux.c
+++ b/com32/hdt/hdt-menu-syslinux.c
@@ -24,51 +24,62 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#include "syslinux/config.h"
#include "hdt-menu.h"
-/* Computing Syslinux menu*/
-void compute_syslinuxmenu(struct s_my_menu *menu, struct s_hardware *hardware) {
+/* Computing Syslinux menu */
+void compute_syslinuxmenu(struct s_my_menu *menu, struct s_hardware *hardware)
+{
char syslinux_fs_menu[24];
- char buffer[SUBMENULEN+1];
- char statbuffer[STATLEN+1];
+ char buffer[SUBMENULEN + 1];
+ char statbuffer[STATLEN + 1];
- memset(syslinux_fs_menu,0,sizeof syslinux_fs_menu);
+ memset(syslinux_fs_menu, 0, sizeof syslinux_fs_menu);
- snprintf(syslinux_fs_menu,sizeof syslinux_fs_menu," %s ",hardware->syslinux_fs);
- menu->menu = add_menu(syslinux_fs_menu,-1);
- menu->items_count=0;
- set_menu_pos(SUBMENU_Y,SUBMENU_X);
+ snprintf(syslinux_fs_menu, sizeof syslinux_fs_menu, " %s ",
+ hardware->syslinux_fs);
+ menu->menu = add_menu(syslinux_fs_menu, -1);
+ menu->items_count = 0;
+ set_menu_pos(SUBMENU_Y, SUBMENU_X);
- snprintf(buffer, sizeof buffer, "Bootloader : %s", hardware->syslinux_fs);
- snprintf(statbuffer, sizeof statbuffer, "Bootloader: %s", hardware->syslinux_fs);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Bootloader : %s",
+ hardware->syslinux_fs);
+ snprintf(statbuffer, sizeof statbuffer, "Bootloader: %s",
+ hardware->syslinux_fs);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer, "Version : %s", hardware->sv->version_string+2);
- snprintf(statbuffer, sizeof statbuffer, "Version: %s", hardware->sv->version_string+2);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Version : %s",
+ hardware->sv->version_string + 2);
+ snprintf(statbuffer, sizeof statbuffer, "Version: %s",
+ hardware->sv->version_string + 2);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer, "Version : %u",hardware->sv->version);
- snprintf(statbuffer, sizeof statbuffer, "Version: %u",hardware->sv->version);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Version : %u",
+ hardware->sv->version);
+ snprintf(statbuffer, sizeof statbuffer, "Version: %u",
+ hardware->sv->version);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer, "Max API : %u",hardware->sv->max_api);
- snprintf(statbuffer, sizeof statbuffer, "Max API: %u",hardware->sv->max_api);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "Max API : %u",
+ hardware->sv->max_api);
+ snprintf(statbuffer, sizeof statbuffer, "Max API: %u",
+ hardware->sv->max_api);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- add_item("","",OPT_SEP,"",0);
+ add_item("", "", OPT_SEP, "", 0);
- snprintf(buffer, sizeof buffer, "%s", hardware->sv->copyright_string+1);
- snprintf(statbuffer, sizeof statbuffer, "%s", hardware->sv->copyright_string+1);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ snprintf(buffer, sizeof buffer, "%s",
+ hardware->sv->copyright_string + 1);
+ snprintf(statbuffer, sizeof statbuffer, "%s",
+ hardware->sv->copyright_string + 1);
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- printf("MENU: Syslinux menu done (%d items)\n",menu->items_count);
+ printf("MENU: Syslinux menu done (%d items)\n", menu->items_count);
}
-
diff --git a/com32/hdt/hdt-menu-vesa.c b/com32/hdt/hdt-menu-vesa.c
new file mode 100644
index 00000000..d969a291
--- /dev/null
+++ b/com32/hdt/hdt-menu-vesa.c
@@ -0,0 +1,106 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * 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"
+
+
+/* Submenu for the vesa card */
+void compute_vesa_card(struct s_my_menu *menu, struct s_hardware *hardware) {
+ char buffer[SUBMENULEN+1];
+ char statbuffer[STATLEN+1];
+
+ menu->menu = add_menu(" VESA Bios ",-1);
+ menu->items_count=0;
+ set_menu_pos(SUBMENU_Y,SUBMENU_X);
+
+ snprintf(buffer,sizeof buffer,"VESA Version: %d.%d",hardware->vesa.major_version,hardware->vesa.minor_version);
+ snprintf(statbuffer,sizeof statbuffer,"Version: %d.%d",hardware->vesa.major_version,hardware->vesa.minor_version);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ snprintf(buffer,sizeof buffer,"Vendor : %s",hardware->vesa.vendor);
+ snprintf(statbuffer,sizeof statbuffer,"Vendor Name: %s",hardware->vesa.vendor);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ snprintf(buffer,sizeof buffer,"Product : %s",hardware->vesa.product);
+ snprintf(statbuffer,sizeof statbuffer,"Product Name: %s",hardware->vesa.product);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ snprintf(buffer,sizeof buffer,"Product Rev.: %s",hardware->vesa.product_revision);
+ snprintf(statbuffer,sizeof statbuffer,"Produt Revision: %s",hardware->vesa.product_revision);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ snprintf(buffer,sizeof buffer,"Software Rev: %s",hardware->vesa.software_rev);
+ snprintf(statbuffer,sizeof statbuffer,"Software Revision: %s",hardware->vesa.software_rev);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+
+ snprintf(buffer,sizeof buffer,"Memory (KB) : %d",hardware->vesa.total_memory*64);
+ snprintf(statbuffer,sizeof statbuffer,"Memory (KB): %d",hardware->vesa.total_memory*64);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+}
+
+/* Submenu for the vesa card */
+void compute_vesa_modes(struct s_my_menu *menu, struct s_hardware *hardware) {
+ char buffer[56];
+ char statbuffer[STATLEN];
+
+ menu->menu = add_menu(" VESA Modes ",-1);
+ menu->items_count=0;
+ set_menu_pos(SUBMENU_Y,SUBMENU_X);
+ for (int i=0;i<hardware->vesa.vmi_count;i++) {
+ struct vesa_mode_info *mi=&hardware->vesa.vmi[i].mi;
+ snprintf(buffer,sizeof buffer,"%4u x %4u x %2ubits vga=%3d",
+ mi->h_res, mi->v_res, mi->bpp, hardware->vesa.vmi[i].mode+0x200);
+ snprintf(statbuffer,sizeof statbuffer,"%4ux%4ux%2ubits vga=%3d",
+ mi->h_res, mi->v_res, mi->bpp, hardware->vesa.vmi[i].mode+0x200);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ menu->items_count++;
+ }
+}
+
+/* Main VESA Menu*/
+int compute_VESA(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware) {
+ char buffer[15];
+ compute_vesa_card(&hdt_menu->vesa_card_menu,hardware);
+ compute_vesa_modes(&hdt_menu->vesa_modes_menu,hardware);
+ hdt_menu->vesa_menu.menu = add_menu(" VESA ",-1);
+ hdt_menu->vesa_menu.items_count=0;
+
+ add_item("VESA Bios","VESA Bios",OPT_SUBMENU,NULL,hdt_menu->vesa_card_menu.menu);
+ hdt_menu->vesa_menu.items_count++;
+ snprintf(buffer,sizeof buffer,"%s (%d)","Modes",hardware->vesa.vmi_count);
+ add_item(buffer,"VESA Modes",OPT_SUBMENU,NULL,hdt_menu->vesa_modes_menu.menu);
+ hdt_menu->vesa_menu.items_count++;
+ printf("MENU: VESA menu done (%d items)\n",hdt_menu->vesa_menu.items_count);
+ return 0;
+}
diff --git a/com32/hdt/hdt-menu.c b/com32/hdt/hdt-menu.c
index 0853f09e..a0196c24 100644
--- a/com32/hdt/hdt-menu.c
+++ b/com32/hdt/hdt-menu.c
@@ -24,52 +24,53 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#include "hdt-menu.h"
-
-
-int start_menu_mode(struct s_hardware *hardware, char *version_string) {
+int start_menu_mode(struct s_hardware *hardware, char *version_string)
+{
struct s_hdt_menu hdt_menu;
- memset(&hdt_menu,0,sizeof (hdt_menu));
+ memset(&hdt_menu, 0, sizeof(hdt_menu));
/* Detect every kind of hardware */
detect_hardware(hardware);
- /* Setup the menu system*/
+ /* Setup the menu system */
setup_menu(version_string);
- /* Compute all sub menus */
+ /* Compute all submenus */
compute_submenus(&hdt_menu, hardware);
- /* Compute main menu */
- compute_main_menu(&hdt_menu,hardware);
+ /* Compute the main menu */
+ compute_main_menu(&hdt_menu, hardware);
#ifdef WITH_MENU_DISPLAY
- t_menuitem * curr;
+ t_menuitem *curr;
char cmd[160];
- printf("Starting Menu (%d menus)\n",hdt_menu.total_menu_count);
- curr=showmenus(hdt_menu.main_menu.menu);
- /* When we exit the menu, do we have something to do */
+ printf("Starting Menu (%d menus)\n", hdt_menu.total_menu_count);
+ curr = showmenus(hdt_menu.main_menu.menu);
+ /* When we exit the menu, do we have something to do? */
if (curr) {
- /* When want to execute something */
- if (curr->action == OPT_RUN)
- {
- /* Tweak, we want to switch to the cli*/
- if (! strncmp(curr->data,HDT_SWITCH_TO_CLI,sizeof(HDT_SWITCH_TO_CLI))) {
- return HDT_RETURN_TO_CLI;
- }
- strcpy(cmd,curr->data);
-
- /* Use specific syslinux call if needed */
- if (issyslinux())
- runsyslinuxcmd(cmd);
- else csprint(cmd,0x07);
- return 1; // Should not happen when run from SYSLINUX
- }
+ /* When want to execute something */
+ if (curr->action == OPT_RUN) {
+ /* Tweak, we want to switch to the cli */
+ if (!strncmp
+ (curr->data, HDT_SWITCH_TO_CLI,
+ sizeof(HDT_SWITCH_TO_CLI))) {
+ return HDT_RETURN_TO_CLI;
+ }
+ strcpy(cmd, curr->data);
+
+ /* Use specific syslinux call if needed */
+ if (issyslinux())
+ runsyslinuxcmd(cmd);
+ else
+ csprint(cmd, 0x07);
+ return 1; // Should not happen when run from SYSLINUX
+ }
}
#endif
return 0;
@@ -78,161 +79,201 @@ int start_menu_mode(struct s_hardware *hardware, char *version_string) {
/* In the menu system, what to do on keyboard timeout */
TIMEOUTCODE ontimeout()
{
- // beep();
- return CODE_WAIT;
+ // beep();
+ return CODE_WAIT;
}
/* Keyboard handler for the menu system */
-void keys_handler(t_menusystem *ms, t_menuitem *mi,unsigned int scancode)
+void keys_handler(t_menusystem * ms, t_menuitem * mi, unsigned int scancode)
{
- char nc;
-
- if ((scancode >> 8) == F1) { // If scancode of F1
- runhelpsystem(mi->helpid);
- }
- // If user hit TAB, and item is an "executable" item
- // and user has privileges to edit it, edit it in place.
- if (((scancode & 0xFF) == 0x09) && (mi->action == OPT_RUN)) {
+ char nc;
+
+ if ((scancode >> 8) == F1) { // If scancode of F1
+ runhelpsystem(mi->helpid);
+ }
+ /*
+ * If user hit TAB, and item is an "executable" item
+ * and user has privileges to edit it, edit it in place.
+ */
+ if (((scancode & 0xFF) == 0x09) && (mi->action == OPT_RUN)) {
//(isallowed(username,"editcmd") || isallowed(username,"root"))) {
- nc = getnumcols();
- // User typed TAB and has permissions to edit command line
- gotoxy(EDITPROMPT,1,ms->menupage);
- csprint("Command line:",0x07);
- editstring(mi->data,ACTIONLEN);
- gotoxy(EDITPROMPT,1,ms->menupage);
- cprint(' ',0x07,nc-1,ms->menupage);
- }
+ nc = getnumcols();
+ /* User typed TAB and has permissions to edit command line */
+ gotoxy(EDITPROMPT, 1, ms->menupage);
+ csprint("Command line:", 0x07);
+ editstring(mi->data, ACTIONLEN);
+ gotoxy(EDITPROMPT, 1, ms->menupage);
+ cprint(' ', 0x07, nc - 1, ms->menupage);
+ }
}
-/* Setup the Menu system*/
-void setup_menu(char *version) {
- /* Creating the menu */
+/* Setup the Menu system */
+void setup_menu(char *version)
+{
+ /* Creating the menu */
init_menusystem(version);
- set_window_size(0,0,24,80);
+ set_window_size(0, 0, 24, 80);
- // Register the menusystem handler
- // reg_handler(HDLR_SCREEN,&msys_handler);
- reg_handler(HDLR_KEYS,&keys_handler);
+ /* Register the menusystem handler */
+ // reg_handler(HDLR_SCREEN,&msys_handler);
+ reg_handler(HDLR_KEYS, &keys_handler);
- // Register the ontimeout handler, with a time out of 10 seconds
- reg_ontimeout(ontimeout,1000,0);
+ /* Register the ontimeout handler, with a time out of 10 seconds */
+ reg_ontimeout(ontimeout, 1000, 0);
}
-/* Compute Main' Submenus*/
-void compute_submenus(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware) {
-
- /* Compute this menus if a DMI table exist */
- if (hardware->is_dmi_valid) {
- if (hardware->dmi.base_board.filled==true) compute_motherboard(&(hdt_menu->mobo_menu),&(hardware->dmi));
- if (hardware->dmi.chassis.filled==true) compute_chassis(&(hdt_menu->chassis_menu),&(hardware->dmi));
- if (hardware->dmi.system.filled==true) compute_system(&(hdt_menu->system_menu),&(hardware->dmi));
- for (int i=0;i<hardware->dmi.memory_count;i++) {
- if (hardware->dmi.memory[i].filled==true) {
- compute_memory(hdt_menu,&(hardware->dmi));
- break;
- }
+/* Compute Main' submenus */
+void compute_submenus(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
+{
+
+ /* Compute this menu if a DMI table exists */
+ if (hardware->is_dmi_valid) {
+ if (hardware->dmi.base_board.filled == true)
+ compute_motherboard(&(hdt_menu->mobo_menu),
+ &(hardware->dmi));
+ if (hardware->dmi.chassis.filled == true)
+ compute_chassis(&(hdt_menu->chassis_menu),
+ &(hardware->dmi));
+ if (hardware->dmi.system.filled == true)
+ compute_system(&(hdt_menu->system_menu),
+ &(hardware->dmi));
+ for (int i = 0; i < hardware->dmi.memory_count; i++) {
+ if (hardware->dmi.memory[i].filled == true) {
+ compute_memory(hdt_menu, &(hardware->dmi));
+ break;
+ }
}
- if (hardware->dmi.bios.filled==true) compute_bios(&(hdt_menu->bios_menu),&(hardware->dmi));
- if (hardware->dmi.battery.filled==true) compute_battery(&(hdt_menu->battery_menu),&(hardware->dmi));
+ if (hardware->dmi.bios.filled == true)
+ compute_bios(&(hdt_menu->bios_menu), &(hardware->dmi));
+ if (hardware->dmi.battery.filled == true)
+ compute_battery(&(hdt_menu->battery_menu),
+ &(hardware->dmi));
}
- compute_processor(&(hdt_menu->cpu_menu),hardware);
- compute_disks(hdt_menu,hardware->disk_info);
+ compute_processor(&(hdt_menu->cpu_menu), 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);
+ compute_PCI(hdt_menu, 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),hardware);
+ compute_summarymenu(&(hdt_menu->summary_menu), hardware);
+ compute_syslinuxmenu(&(hdt_menu->syslinux_menu), hardware);
+ compute_VESA(hdt_menu,hardware);
compute_aboutmenu(&(hdt_menu->about_menu));
}
-void compute_main_menu(struct s_hdt_menu *hdt_menu,struct s_hardware *hardware) {
+void compute_main_menu(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
+{
char menu_item[64];
- /* Let's count the number of menu we have */
- hdt_menu->total_menu_count=0;
- hdt_menu->main_menu.items_count=0;
+ /* Let's count the number of menus we have */
+ hdt_menu->total_menu_count = 0;
+ hdt_menu->main_menu.items_count = 0;
- hdt_menu->main_menu.menu = add_menu(" Main Menu ",-1);
- set_item_options(-1,24);
+ hdt_menu->main_menu.menu = add_menu(" Main Menu ", -1);
+ set_item_options(-1, 24);
#ifdef WITH_PCI
- snprintf(menu_item, sizeof (menu_item), "PC<I> Devices(%2d)\n",hardware->nb_pci_devices);
- add_item(menu_item,"PCI Devices Menu",OPT_SUBMENU,NULL,hdt_menu->pci_menu.menu);
+ snprintf(menu_item, sizeof(menu_item), "PC<I> Devices(%2d)\n",
+ hardware->nb_pci_devices);
+ add_item(menu_item, "PCI Devices Menu", OPT_SUBMENU, NULL,
+ hdt_menu->pci_menu.menu);
hdt_menu->main_menu.items_count++;
- hdt_menu->total_menu_count+=hdt_menu->pci_menu.items_count;
+ hdt_menu->total_menu_count += hdt_menu->pci_menu.items_count;
#endif
- if (hdt_menu->disk_menu.items_count>0) {
- snprintf(menu_item, sizeof (menu_item), "<D>isks (%2d)\n",hdt_menu->disk_menu.items_count);
- add_item(menu_item,"Disks Menu",OPT_SUBMENU,NULL,hdt_menu->disk_menu.menu);
- hdt_menu->main_menu.items_count++;
- hdt_menu->total_menu_count+=hdt_menu->disk_menu.items_count;
+ if (hdt_menu->disk_menu.items_count > 0) {
+ snprintf(menu_item, sizeof(menu_item), "<D>isks (%2d)\n",
+ hdt_menu->disk_menu.items_count);
+ add_item(menu_item, "Disks Menu", OPT_SUBMENU, NULL,
+ hdt_menu->disk_menu.menu);
+ hdt_menu->main_menu.items_count++;
+ hdt_menu->total_menu_count += hdt_menu->disk_menu.items_count;
}
- if (hdt_menu->memory_menu.items_count>0) {
- snprintf(menu_item, sizeof (menu_item), "<M>emory (%2d)\n",hdt_menu->memory_menu.items_count);
- add_item(menu_item,"Memory Menu",OPT_SUBMENU,NULL,hdt_menu->memory_menu.menu);
- hdt_menu->main_menu.items_count++;
- hdt_menu->total_menu_count+=hdt_menu->memory_menu.items_count;
+ if (hdt_menu->memory_menu.items_count > 0) {
+ snprintf(menu_item, sizeof(menu_item), "<M>emory (%2d)\n",
+ hdt_menu->memory_menu.items_count);
+ add_item(menu_item, "Memory Menu", OPT_SUBMENU, NULL,
+ hdt_menu->memory_menu.menu);
+ hdt_menu->main_menu.items_count++;
+ hdt_menu->total_menu_count += hdt_menu->memory_menu.items_count;
}
- add_item("<P>rocessor","Main Processor Menu",OPT_SUBMENU,NULL,hdt_menu->cpu_menu.menu);
+ add_item("<P>rocessor", "Main Processor Menu", OPT_SUBMENU, NULL,
+ hdt_menu->cpu_menu.menu);
hdt_menu->main_menu.items_count++;
-if (hardware->is_dmi_valid) {
- if (hardware->dmi.base_board.filled==true) {
- add_item("M<o>therboard","Motherboard Menu",OPT_SUBMENU,NULL,hdt_menu->mobo_menu.menu);
- hdt_menu->main_menu.items_count++;
- }
+ if (hardware->is_dmi_valid) {
+ if (hardware->dmi.base_board.filled == true) {
+ add_item("M<o>therboard", "Motherboard Menu",
+ OPT_SUBMENU, NULL, hdt_menu->mobo_menu.menu);
+ hdt_menu->main_menu.items_count++;
+ }
- if (hardware->dmi.bios.filled==true) {
- add_item("<B>ios","Bios Menu",OPT_SUBMENU,NULL,hdt_menu->bios_menu.menu);
- hdt_menu->main_menu.items_count++;
- }
+ if (hardware->dmi.bios.filled == true) {
+ add_item("<B>ios", "Bios Menu", OPT_SUBMENU, NULL,
+ hdt_menu->bios_menu.menu);
+ hdt_menu->main_menu.items_count++;
+ }
- if (hardware->dmi.chassis.filled==true) {
- add_item("<C>hassis","Chassis Menu",OPT_SUBMENU,NULL,hdt_menu->chassis_menu.menu);
- hdt_menu->main_menu.items_count++;
- }
+ if (hardware->dmi.chassis.filled == true) {
+ add_item("<C>hassis", "Chassis Menu", OPT_SUBMENU, NULL,
+ hdt_menu->chassis_menu.menu);
+ hdt_menu->main_menu.items_count++;
+ }
- if (hardware->dmi.system.filled==true) {
- add_item("<S>ystem","System Menu",OPT_SUBMENU,NULL,hdt_menu->system_menu.menu);
- hdt_menu->main_menu.items_count++;
- }
+ if (hardware->dmi.system.filled == true) {
+ add_item("<S>ystem", "System Menu", OPT_SUBMENU, NULL,
+ hdt_menu->system_menu.menu);
+ hdt_menu->main_menu.items_count++;
+ }
- if (hardware->dmi.battery.filled==true) {
- add_item("Ba<t>tery","Battery Menu",OPT_SUBMENU,NULL,hdt_menu->battery_menu.menu);
- hdt_menu->main_menu.items_count++;
+ if (hardware->dmi.battery.filled == true) {
+ add_item("Ba<t>tery", "Battery Menu", OPT_SUBMENU, NULL,
+ hdt_menu->battery_menu.menu);
+ 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);
+ add_item("P<X>E", "PXE Information Menu", OPT_SUBMENU, NULL,
+ hdt_menu->pxe_menu.menu);
+ hdt_menu->main_menu.items_count++;
+ }
+
+ if (hardware->is_vesa_valid == true) {
+ add_item("<V>ESA","VESA Information Menu", OPT_SUBMENU, NULL,
+ hdt_menu->vesa_menu.menu);
hdt_menu->main_menu.items_count++;
}
- add_item("","",OPT_SEP,"",0);
+ add_item("", "", OPT_SEP, "", 0);
#ifdef WITH_PCI
if (hardware->modules_pcimap_return_code != -ENOMODULESPCIMAP) {
- add_item("<K>ernel Modules","Kernel Modules Menu",OPT_SUBMENU,NULL,hdt_menu->kernel_menu.menu);
- hdt_menu->main_menu.items_count++;
+ add_item("<K>ernel Modules", "Kernel Modules Menu", OPT_SUBMENU,
+ NULL, hdt_menu->kernel_menu.menu);
+ hdt_menu->main_menu.items_count++;
}
#endif
- add_item("<S>yslinux","Syslinux Information Menu",OPT_SUBMENU,NULL,hdt_menu->syslinux_menu.menu);
+ add_item("S<y>slinux", "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);
+ 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("", "", 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);
+ 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++;
- hdt_menu->total_menu_count+=hdt_menu->main_menu.items_count;
+ hdt_menu->total_menu_count += hdt_menu->main_menu.items_count;
}
-void detect_hardware(struct s_hardware *hardware) {
+void detect_hardware(struct s_hardware *hardware)
+{
printf("CPU: Detecting\n");
cpu_detect(hardware);
@@ -240,14 +281,19 @@ void detect_hardware(struct s_hardware *hardware) {
detect_disks(hardware);
printf("DMI: Detecting Table\n");
- if (detect_dmi(hardware) == -ENODMITABLE ) {
- printf("DMI: ERROR ! Table not found ! \n");
- printf("DMI: Many hardware components will not be detected ! \n");
+ if (detect_dmi(hardware) == -ENODMITABLE) {
+ printf("DMI: ERROR ! Table not found ! \n");
+ printf
+ ("DMI: Many hardware components will not be detected ! \n");
} else {
- printf("DMI: Table found ! (version %d.%d)\n",hardware->dmi.dmitable.major_version,hardware->dmi.dmitable.minor_version);
+ printf("DMI: Table found ! (version %d.%d)\n",
+ hardware->dmi.dmitable.major_version,
+ hardware->dmi.dmitable.minor_version);
}
#ifdef WITH_PCI
detect_pci(hardware);
- printf("PCI: %d Devices Found\n",hardware->nb_pci_devices);
+ printf("PCI: %d Devices Found\n", hardware->nb_pci_devices);
#endif
+ printf("VESA: Detecting\n");
+ detect_vesa(hardware);
}
diff --git a/com32/hdt/hdt-menu.h b/com32/hdt/hdt-menu.h
index db94057a..fbb21e26 100644
--- a/com32/hdt/hdt-menu.h
+++ b/com32/hdt/hdt-menu.h
@@ -24,11 +24,12 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#ifndef DEFINE_HDT_MENU_H
#define DEFINE_HDT_MENU_H
#include <stdio.h>
+
#include "menu.h"
#include "help.h"
//#include "cpuid.h"
@@ -49,60 +50,62 @@
#define MAX_DISK_SUB_MENU 32
struct s_my_menu {
- unsigned char menu;
- int items_count;
+ unsigned char menu;
+ int items_count;
};
struct s_hdt_menu {
- struct s_my_menu main_menu;
- struct s_my_menu cpu_menu;
- struct s_my_menu mobo_menu;
- struct s_my_menu chassis_menu;
- struct s_my_menu bios_menu;
- struct s_my_menu system_menu;
- struct s_my_menu pci_menu;
- struct s_my_menu pci_sub_menu[MAX_PCI_SUB_MENU];
- struct s_my_menu kernel_menu;
- struct s_my_menu memory_menu;
- struct s_my_menu memory_sub_menu[MAX_MEMORY_SUB_MENU];
- struct s_my_menu disk_menu;
- struct s_my_menu disk_sub_menu[MAX_DISK_SUB_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
+ struct s_my_menu main_menu;
+ struct s_my_menu cpu_menu;
+ struct s_my_menu mobo_menu;
+ struct s_my_menu chassis_menu;
+ struct s_my_menu bios_menu;
+ struct s_my_menu system_menu;
+ struct s_my_menu pci_menu;
+ struct s_my_menu pci_sub_menu[MAX_PCI_SUB_MENU];
+ struct s_my_menu kernel_menu;
+ struct s_my_menu memory_menu;
+ struct s_my_menu memory_sub_menu[MAX_MEMORY_SUB_MENU];
+ struct s_my_menu disk_menu;
+ struct s_my_menu disk_sub_menu[MAX_DISK_SUB_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;
+ struct s_my_menu vesa_menu;
+ struct s_my_menu vesa_card_menu;
+ struct s_my_menu vesa_modes_menu;
+ int total_menu_count; // Sum of all menus we have
};
TIMEOUTCODE ontimeout();
-void keys_handler(t_menusystem *ms, t_menuitem *mi,unsigned int scancode);
+void keys_handler(t_menusystem * ms, t_menuitem * mi, unsigned int scancode);
// PCI Stuff
-void compute_pci_device(struct s_my_menu *menu,struct pci_device *pci_device,int pci_bus, int pci_slot, int pci_func);
int compute_PCI(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware);
// KERNEL Stuff
-void compute_kernel(struct s_my_menu *menu,struct s_hardware *hardware);
+void compute_kernel(struct s_my_menu *menu, struct s_hardware *hardware);
// Disk Stuff
-int compute_disk_module(struct s_my_menu *menu, int nb_sub_disk_menu, struct diskinfo *d,int disk_number);
+int compute_disk_module(struct s_my_menu *menu, int nb_sub_disk_menu,
+ struct diskinfo *d, int disk_number);
void compute_disks(struct s_hdt_menu *menu, struct diskinfo *disk_info);
// DMI Stuff
-void compute_motherboard(struct s_my_menu *menu,s_dmi *dmi);
-void compute_battery(struct s_my_menu *menu, s_dmi *dmi);
-void compute_system(struct s_my_menu *menu,s_dmi *dmi);
-void compute_chassis(struct s_my_menu *menu,s_dmi *dmi);
-void compute_bios(struct s_my_menu *menu,s_dmi *dmi);
-void compute_memory(struct s_hdt_menu *menu, s_dmi *dmi);
-void compute_memory_module(struct s_my_menu *menu, s_dmi *dmi, int slot_number);
+void compute_motherboard(struct s_my_menu *menu, s_dmi * dmi);
+void compute_battery(struct s_my_menu *menu, s_dmi * dmi);
+void compute_system(struct s_my_menu *menu, s_dmi * dmi);
+void compute_chassis(struct s_my_menu *menu, s_dmi * dmi);
+void compute_bios(struct s_my_menu *menu, s_dmi * dmi);
+void compute_memory(struct s_hdt_menu *menu, s_dmi * dmi);
// Processor Stuff
-void compute_processor(struct s_my_menu *menu,struct s_hardware *hardware);
+void compute_processor(struct s_my_menu *menu, struct s_hardware *hardware);
// Syslinux stuff
-void compute_syslinuxmenu(struct s_my_menu *menu,struct s_hardware *hardware);
+void compute_syslinuxmenu(struct s_my_menu *menu, struct s_hardware *hardware);
// About menu
void compute_aboutmenu(struct s_my_menu *menu);
@@ -110,12 +113,16 @@ 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);
+// PXE menu
+void compute_PXE(struct s_my_menu *menu, struct s_hardware *hardware);
+
+//VESA menu
+int compute_VESA(struct s_hdt_menu *hdt_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);
-void compute_submenus(struct s_hdt_menu *hdt_menu,struct s_hardware *hardware);
+void compute_main_menu(struct s_hdt_menu *hdt_menu,
+ struct s_hardware *hardware);
+void compute_submenus(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware);
void detect_hardware(struct s_hardware *hardware);
#endif
diff --git a/com32/hdt/hdt.c b/com32/hdt/hdt.c
index b417d9da..93e2fa0b 100644
--- a/com32/hdt/hdt.c
+++ b/com32/hdt/hdt.c
@@ -24,7 +24,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
/*
* hdt.c
@@ -34,45 +34,47 @@
#include <stdio.h>
#include <console.h>
+
#include "hdt.h"
#include "hdt-menu.h"
#include "hdt-cli.h"
#include "hdt-common.h"
-int display_line_nb=0;
+int display_line_nb = 0;
-int main(int argc, char *argv[])
+int main(const int argc, const char *argv[])
{
char version_string[256];
- char *arg;
+ const char *arg;
struct s_hardware hardware;
- snprintf(version_string,sizeof version_string,"%s %s by %s",PRODUCT_NAME,VERSION,AUTHOR);
+ snprintf(version_string, sizeof version_string, "%s %s by %s",
+ PRODUCT_NAME,VERSION,AUTHOR);
/* Cleaning structures */
init_hardware(&hardware);
/* Detecting parameters */
- detect_parameters(argc,argv,&hardware);
+ detect_parameters(argc, argv, &hardware);
- /* Detecting Syslinux Version*/
+ /* Detecting Syslinux version */
detect_syslinux(&hardware);
- /* Opening the syslinux console */
+ /* Opening the Syslinux console */
openconsole(&dev_stdcon_r, &dev_ansicon_w);
clear_screen();
- printf("%s\n",version_string);
+ printf("%s\n", version_string);
+
+ if ((arg = find_argument(argv + 1, "nomenu")))
+ start_cli_mode(&hardware);
+ else {
+ int return_code = start_menu_mode(&hardware, version_string);
- if ((arg = find_argument(argv+1, "nomenu"))) {
- start_cli_mode(&hardware, argc, argv);
- } else{
- int return_code = start_menu_mode(&hardware, version_string);
- if (return_code == HDT_RETURN_TO_CLI) {
- start_cli_mode(&hardware,argc,argv);
- } else {
- return return_code;
- }
+ if (return_code == HDT_RETURN_TO_CLI)
+ start_cli_mode(&hardware);
+ else
+ return return_code;
}
return 0;
diff --git a/com32/hdt/hdt.h b/com32/hdt/hdt.h
index b8563ab5..9f96200b 100644
--- a/com32/hdt/hdt.h
+++ b/com32/hdt/hdt.h
@@ -24,7 +24,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#ifndef DEFINE_HDT_H
#define DEFINE_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.3"
+#define VERSION "0.2.4"
#define ATTR_PACKED __attribute__((packed))
diff --git a/com32/include/sys/pci.h b/com32/include/sys/pci.h
index fad7250c..18e97548 100644
--- a/com32/include/sys/pci.h
+++ b/com32/include/sys/pci.h
@@ -30,6 +30,8 @@ struct pci_dev_info {
int linux_kernel_module_count;
char class_name[PCI_CLASS_NAME_SIZE]; /* The most precise class name */
char category_name[PCI_CLASS_NAME_SIZE]; /*The general category*/
+ uint8_t irq;
+ uint8_t latency;
};
/* PCI device (really, function) */
@@ -134,5 +136,5 @@ struct match * find_pci_device(const struct pci_domain *pci_domain,
int get_name_from_pci_ids(struct pci_domain *pci_domain, char *pciids_path);
int get_module_name_from_pci_ids(struct pci_domain *pci_domain, char *modules_pcimap_path);
int get_class_name_from_pci_ids(struct pci_domain *pci_domain, char *pciids_path);
-
+void gather_additional_pci_config(struct pci_domain *domain);
#endif /* _SYS_PCI_H */
diff --git a/com32/lib/pci/scan.c b/com32/lib/pci/scan.c
index cfd9e654..dd5d6402 100644
--- a/com32/lib/pci/scan.c
+++ b/com32/lib/pci/scan.c
@@ -83,7 +83,7 @@ int get_module_name_from_pci_ids(struct pci_domain *domain, char *modules_pcimap
char sub_vendor_id[16];
char sub_product_id[16];
FILE *f;
- struct pci_device *dev;
+ struct pci_device *dev=NULL;
/* Intializing the linux_kernel_module for each pci device to "unknown" */
/* adding a dev_info member if needed */
@@ -512,6 +512,40 @@ struct pci_domain *pci_scan(void)
return NULL;
}
+/* gathering additional configuration*/
+void gather_additional_pci_config(struct pci_domain *domain)
+{
+ struct pci_bus *bus = NULL;
+ struct pci_slot *slot = NULL;
+ unsigned int nbus, ndev, nfunc, maxfunc;
+ pciaddr_t a;
+ int cfgtype;
+ cfgtype = pci_set_config_type(PCI_CFG_AUTO);
+ (void)cfgtype;
+
+ for (nbus = 0; nbus < MAX_PCI_BUSES; nbus++) {
+ bus = NULL;
+
+ for (ndev = 0; ndev < MAX_PCI_DEVICES; ndev++) {
+ maxfunc = 1; /* Assume a single-function device */
+ slot = NULL;
+
+ for (nfunc = 0; nfunc < maxfunc; nfunc++) {
+ a = pci_mkaddr(nbus, ndev, nfunc, 0);
+ struct pci_device *dev = domain->bus[nbus]->slot[ndev]->func[nfunc];
+ if (! dev->dev_info) {
+ dev->dev_info = zalloc(sizeof *dev->dev_info);
+ if (!dev->dev_info)
+ return;
+ }
+ dev->dev_info->irq = pci_readb(a + 0x3c);
+ dev->dev_info->latency = pci_readb(a + 0x0d);
+ }
+ }
+ }
+}
+
+
void free_pci_domain(struct pci_domain *domain)
{
struct pci_bus *bus;
diff --git a/com32/lib/sys/vesa/vesa.h b/com32/lib/sys/vesa/vesa.h
index e67a3108..a7150b35 100644
--- a/com32/lib/sys/vesa/vesa.h
+++ b/com32/lib/sys/vesa/vesa.h
@@ -38,7 +38,7 @@ struct vesa_general_info {
far_ptr_t vendor_string;
uint8_t capabilities[4];
far_ptr_t video_mode_ptr;
- uint32_t total_memory;
+ uint16_t total_memory;
uint16_t oem_software_rev;
far_ptr_t oem_vendor_name_ptr;