aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2011-03-23 22:53:17 +0100
committerErwan Velu <erwanaliasr1@gmail.com>2011-03-23 22:53:17 +0100
commit0ed0e00c1c3b0cfcf744cb58208c9ed54782c9d1 (patch)
treec5ee013c1f4cca4c562854e3c139e4999e454d71
parent751b297c74240b097cdf6260dd8f77e519c03605 (diff)
downloadsyslinux-0ed0e00c1c3b0cfcf744cb58208c9ed54782c9d1.tar.gz
syslinux-0ed0e00c1c3b0cfcf744cb58208c9ed54782c9d1.tar.xz
syslinux-0ed0e00c1c3b0cfcf744cb58208c9ed54782c9d1.zip
hdt: Dumping vesa modes & configuration
-rw-r--r--com32/hdt/hdt-dump-vesa.c65
-rw-r--r--com32/hdt/hdt-dump.c1
-rw-r--r--com32/hdt/hdt-dump.h1
3 files changed, 67 insertions, 0 deletions
diff --git a/com32/hdt/hdt-dump-vesa.c b/com32/hdt/hdt-dump-vesa.c
new file mode 100644
index 00000000..38184356
--- /dev/null
+++ b/com32/hdt/hdt-dump-vesa.c
@@ -0,0 +1,65 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2011 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-common.h"
+#include "hdt-dump.h"
+#include <syslinux/config.h>
+
+void dump_vesa(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item) {
+
+ *item = zzjson_create_object(config, NULL); /* empty object */
+ 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("vesa",config,item);
+}
diff --git a/com32/hdt/hdt-dump.c b/com32/hdt/hdt-dump.c
index 55ef9070..805289fe 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 8a2e4109..4f4d6cab 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);