diff options
author | Gwenolé Beauchesne <gbeauchesne@mandriva.org> | 2003-10-24 13:30:19 +0000 |
---|---|---|
committer | Gwenolé Beauchesne <gbeauchesne@mandriva.org> | 2003-10-24 13:30:19 +0000 |
commit | 1767b4a1709cbebff59e96144463e19927e71a3c (patch) | |
tree | e0e947d0cce59f75a2c352b5f697588e17d009ff /tools/ddcprobe/ddcxinfos.c | |
parent | c5b81552b9abf8ef78056bd1db685aa7d9362620 (diff) | |
download | drakx-1767b4a1709cbebff59e96144463e19927e71a3c.tar drakx-1767b4a1709cbebff59e96144463e19927e71a3c.tar.gz drakx-1767b4a1709cbebff59e96144463e19927e71a3c.tar.bz2 drakx-1767b4a1709cbebff59e96144463e19927e71a3c.tar.xz drakx-1767b4a1709cbebff59e96144463e19927e71a3c.zip |
Really read necessary mode_list info from VBE. Check that kernel could
actually get something useful into EDID block.
Diffstat (limited to 'tools/ddcprobe/ddcxinfos.c')
-rw-r--r-- | tools/ddcprobe/ddcxinfos.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/ddcprobe/ddcxinfos.c b/tools/ddcprobe/ddcxinfos.c index 4aec99d29..04ab260cf 100644 --- a/tools/ddcprobe/ddcxinfos.c +++ b/tools/ddcprobe/ddcxinfos.c @@ -21,6 +21,8 @@ int main(void) struct vbe_edid1_info *edid; struct vbe_modeline *modelines; #if KERNEL_BOOT_INFO + u_int32_t vga_bios_base, vga_bios_size; + u_int32_t page_size; int dev_mem_fd; char *mem; #endif @@ -34,13 +36,15 @@ int main(void) perror("open /dev/mem"); return 1; } - if ((mem = (char *)mmap(0, VGA_BIOS_SIZE, PROT_READ, MAP_PRIVATE, dev_mem_fd, VGA_BIOS_BASE)) == MAP_FAILED) { - perror("mmap /dev/mem at VGA_BIOS_BASE"); + page_size = getpagesize(); + vga_bios_base = vbe_info->mode_list.base & ~0xffff; + vga_bios_size = (vbe_info->mode_list.base - vga_bios_base + page_size - 1) & -page_size; + mem = malloc(vga_bios_size); + if (lseek(dev_mem_fd, vga_bios_base, SEEK_SET) != vga_bios_base) return 1; - } - - if ((vbe_info->mode_list.base & ~0xffff) != VGA_BIOS_BASE) return 1; - mode_list = (u_int16_t *)(mem + vbe_info->mode_list.base - VGA_BIOS_BASE); + if (read(dev_mem_fd, mem, vga_bios_size) != vga_bios_size) + return 1; + mode_list = (u_int16_t *)(mem + vbe_info->mode_list.base - vga_bios_base); #endif #if defined(__i386__) mode_list = (u_int16_t *)vbe_info->mode_list.ptr; @@ -60,7 +64,7 @@ int main(void) printf("\n"); #if KERNEL_BOOT_INFO - munmap(mem, VGA_BIOS_SIZE); + free(mem); close(dev_mem_fd); #endif |