diff options
author | Mystery Man <unknown@mandriva.org> | 2003-11-21 12:53:39 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2003-11-21 12:53:39 +0000 |
commit | 7396369ef190a049b3a779a54edd76ff118f3c28 (patch) | |
tree | 20c2a6d7fcd96433d0d91b1460b5604a6d7267ce /tools/ddcprobe/ddcxinfos.c | |
parent | e41742b093fdb26bcae87e9d5b30d4d7bca93ea9 (diff) | |
download | drakx-backup-do-not-use-7396369ef190a049b3a779a54edd76ff118f3c28.tar drakx-backup-do-not-use-7396369ef190a049b3a779a54edd76ff118f3c28.tar.gz drakx-backup-do-not-use-7396369ef190a049b3a779a54edd76ff118f3c28.tar.bz2 drakx-backup-do-not-use-7396369ef190a049b3a779a54edd76ff118f3c28.tar.xz drakx-backup-do-not-use-7396369ef190a049b3a779a54edd76ff118f3c28.zip |
This commit was manufactured by cvs2svn to create tag 'MDK92-AMD64'.MDK92-AMD64
Diffstat (limited to 'tools/ddcprobe/ddcxinfos.c')
-rw-r--r-- | tools/ddcprobe/ddcxinfos.c | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/tools/ddcprobe/ddcxinfos.c b/tools/ddcprobe/ddcxinfos.c index 22ed653b8..c13d803c4 100644 --- a/tools/ddcprobe/ddcxinfos.c +++ b/tools/ddcprobe/ddcxinfos.c @@ -2,28 +2,55 @@ #include <stdlib.h> #include <string.h> #include <math.h> +#include <sys/mman.h> +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> #include "vbe.h" #include "vesamode.h" #ident "$Id$" #define SQR(x) ((x) * (x)) -int main(int argc, char **argv) +int main(void) { int i, j; - u_int16_t *mode_list; + u_int16_t *mode_list, *mode_list_end; unsigned char hmin, hmax, vmin, vmax; struct vbe_info *vbe_info; struct vbe_edid1_info *edid; struct vbe_modeline *modelines; - +#if KERNEL_BOOT_INFO + u_int32_t page_size; + int dev_mem_fd; + char *mem; +#endif if ((vbe_info = vbe_get_vbe_info()) == NULL) return 1; - printf("%dKB of video ram\n", vbe_info->memory_size * 64); +#if KERNEL_BOOT_INFO + /* Open /dev/mem for extra information from VGA BIOS. */ + if ((dev_mem_fd = open("/dev/mem", O_RDONLY)) < 0) { + perror("open /dev/mem"); + return 1; + } + page_size = getpagesize(); + mem = malloc(page_size); + if (lseek(dev_mem_fd, vbe_info->mode_list.base, SEEK_SET) != vbe_info->mode_list.base) + return 1; + if (read(dev_mem_fd, mem, page_size) != page_size) + return 1; + mode_list = (u_int16_t *)mem; + mode_list_end = (u_int16_t *)(mem + page_size); +#endif +#if defined(__i386__) + mode_list = (u_int16_t *)vbe_info->mode_list.ptr; + mode_list_end = (u_int16_t *)-2; /* this will always succeed */ +#endif + /* List supported standard modes. */ - for (mode_list = vbe_info->mode_list.list; *mode_list != 0xffff; mode_list++) + while (mode_list < mode_list_end && *mode_list != 0xffff) { for (i = 0; known_vesa_modes[i].x; i++) if (known_vesa_modes[i].number == *mode_list) printf("%d %d %d\n", @@ -31,8 +58,15 @@ int main(int argc, char **argv) known_vesa_modes[i].x, known_vesa_modes[i].y ); + mode_list++; + } printf("\n"); +#if KERNEL_BOOT_INFO + free(mem); + close(dev_mem_fd); +#endif + if ((edid = vbe_get_edid_info()) == NULL) return 0; if (edid->version == 255 && edid->revision == 255) return 0; |