From: Erwan Velu Date: Wed, 23 Mar 2011 21:53:17 +0000 (+0100) Subject: hdt: Dumping vesa modes & configuration X-Git-Tag: syslinux-4.05-pre1~20^2~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0ed0e00c1c3b0cfcf744cb58208c9ed54782c9d1;p=profile%2Fivi%2Fsyslinux.git hdt: Dumping vesa modes & configuration --- diff --git a/com32/hdt/hdt-dump-vesa.c b/com32/hdt/hdt-dump-vesa.c new file mode 100644 index 0000000..3818435 --- /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 + +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 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);