vbeinfo
changeset 1:d2d777a5da95
fixed wrong memory size report
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 26 Jul 2017 21:05:01 +0300 |
parents | 4b33fa83e381 |
children | 193757920de9 |
files | src/main.c |
diffstat | 1 files changed, 14 insertions(+), 3 deletions(-) [+] |
line diff
1.1 --- a/src/main.c Sat Dec 05 07:28:47 2015 +0200 1.2 +++ b/src/main.c Wed Jul 26 21:05:01 2017 +0300 1.3 @@ -21,15 +21,26 @@ 1.4 struct vbe_mode_info *mode; 1.5 uint16_t *modes; 1.6 struct video_mode *vmodes; 1.7 + char *vendor, *product, *prod_rev; 1.8 1.9 if(!(vbe = vbe_get_info())) { 1.10 fprintf(stderr, "VBE not found\n"); 1.11 return 1; 1.12 } 1.13 + 1.14 + if(!(vendor = VBEPTR(vbe->oem_vendor_name_ptr)) || !*vendor) { 1.15 + vendor = "unknown"; 1.16 + } 1.17 + if(!(product = VBEPTR(vbe->oem_product_name_ptr)) || !*product) { 1.18 + product = "unknown"; 1.19 + } 1.20 + if(!(prod_rev = VBEPTR(vbe->oem_product_rev_ptr)) || !*prod_rev) { 1.21 + prod_rev = "unknown"; 1.22 + } 1.23 + 1.24 printf("VBE version: %x.%x\n", vbe->version >> 8, vbe->version & 0xff); 1.25 - printf("Graphics adapter: %s, %s (%s)\n", VBEPTR(vbe->oem_vendor_name_ptr), 1.26 - VBEPTR(vbe->oem_product_name_ptr), VBEPTR(vbe->oem_product_rev_ptr)); 1.27 - printf("Video memory: %dmb\n", vbe->total_mem << 6); 1.28 + printf("Graphics adapter: %s, %s (%s)\n", vendor, product, prod_rev); 1.29 + printf("Video memory: %dkb\n", vbe->total_mem << 6); 1.30 1.31 modes = VBEPTR(vbe->vid_mode_ptr); 1.32 nmodes = 0;