[syslinux:master] hdt: Dumping vesa modes & configuration

syslinux-bot for Erwan Velu erwanaliasr1 at gmail.com
Mon Apr 25 15:28:20 PDT 2011


Commit-ID:  0ed0e00c1c3b0cfcf744cb58208c9ed54782c9d1
Gitweb:     http://syslinux.zytor.com/commit/0ed0e00c1c3b0cfcf744cb58208c9ed54782c9d1
Author:     Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Wed, 23 Mar 2011 22:53:17 +0100
Committer:  Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Wed, 23 Mar 2011 22:53:17 +0100

hdt: Dumping vesa modes & configuration



---
 com32/hdt/{hdt-dump-cpu.c => hdt-dump-vesa.c} |   48 +++++++++++++++---------
 com32/hdt/hdt-dump.c                          |    1 +
 com32/hdt/hdt-dump.h                          |    1 +
 3 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/com32/hdt/hdt-dump-cpu.c b/com32/hdt/hdt-dump-vesa.c
similarity index 54%
copy from com32/hdt/hdt-dump-cpu.c
copy to com32/hdt/hdt-dump-vesa.c
index dc58a6f..3818435 100644
--- a/com32/hdt/hdt-dump-cpu.c
+++ b/com32/hdt/hdt-dump-vesa.c
@@ -28,26 +28,38 @@
 
 #include "hdt-common.h"
 #include "hdt-dump.h"
+#include <syslinux/config.h>
 
-void dump_cpu(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item) {
+void dump_vesa(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item) {
 
         *item = zzjson_create_object(config, NULL); /* empty object */
-	add_hs(cpu.vendor);
-	add_hs(cpu.model);
-	add_hi(cpu.vendor_id);
-	add_hi(cpu.family);
-	add_hi(cpu.model_id);
-	add_hi(cpu.stepping);
-	add_hi(cpu.num_cores);
-	add_hi(cpu.l1_data_cache_size);
-	add_hi(cpu.l1_instruction_cache_size);
-	add_hi(cpu.l2_cache_size);
-	size_t i;
-	for (i = 0; i < cpu_flags_count; i++) {
-		char temp[128]={0};
-		snprintf(temp,sizeof(temp),"cpu.flags.%s",cpu_flags_names[i]);
-		add_b(temp,get_cpu_flag_value_from_name(&hardware->cpu,cpu_flags_names[i]));
+	add_hb(is_vesa_valid);
+	if (hardware->is_vesa_valid) {
+		char buffer[64]={0};
+		snprintf(buffer,sizeof(buffer),"%d.%d", hardware->vesa.major_version, hardware->vesa.minor_version);
+		add_s("vesa.version",buffer);
+		add_hs(vesa.vendor);
+		add_hs(vesa.product);
+		add_hs(vesa.product_revision);
+		add_hi(vesa.software_rev);
+		memset(buffer,0,sizeof(buffer));
+		snprintf(buffer,sizeof(buffer),"%d KB",hardware->vesa.total_memory*64);
+		add_s("vesa.memory",buffer);
+		add_i("vesa.modes",hardware->vesa.vmi_count);
+		for (int i = 0; i < hardware->vesa.vmi_count; i++) {
+		        struct vesa_mode_info *mi = &hardware->vesa.vmi[i].mi;
+		        if ((mi->h_res == 0) || (mi->v_res == 0))
+				continue;
+		        zzjson_print(config, *item);
+		        zzjson_free(config, *item);
+        		*item = zzjson_create_object(config, NULL); /* empty object */
+			memset(buffer,0,sizeof(buffer));
+			snprintf(buffer,sizeof(buffer),"0x%04x",hardware->vesa.vmi[i].mode + 0x200);
+			add_s("vesa.kernel_mode",buffer);
+			add_i("vesa.hres",mi->h_res);
+			add_i("vesa.vres",mi->v_res);
+			add_i("vesa.bpp",mi->bpp);
+		}
 	}
-
-	flush("cpu",config,item);
+	flush("vesa",config,item);
 }
diff --git a/com32/hdt/hdt-dump.c b/com32/hdt/hdt-dump.c
index 55ef907..805289f 100644
--- a/com32/hdt/hdt-dump.c
+++ b/com32/hdt/hdt-dump.c
@@ -118,6 +118,7 @@ void dump(struct s_hardware *hardware)
     dump_pxe(hardware, &config, &json);
     dump_syslinux(hardware, &config, &json);
     dump_vpd(hardware, &config, &json);
+    dump_vesa(hardware, &config, &json);
 
     /* We close & flush the file to send */
     cpio_close(upload);
diff --git a/com32/hdt/hdt-dump.h b/com32/hdt/hdt-dump.h
index 8a2e410..4f4d6ca 100644
--- a/com32/hdt/hdt-dump.h
+++ b/com32/hdt/hdt-dump.h
@@ -53,3 +53,4 @@ void dump_cpu(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item)
 void dump_pxe(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item);
 void dump_syslinux(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item);
 void dump_vpd(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item);
+void dump_vesa(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item);



More information about the Syslinux-commits mailing list