diff options
author | Mystery Man <unknown@mandriva.org> | 2005-10-20 14:05:54 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2005-10-20 14:05:54 +0000 |
commit | 9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5 (patch) | |
tree | f3ef7ada2ce82dafb6d41cc087b0cc7fdfc40a46 /tools/ddcprobe/ddcxinfos.c | |
parent | 3e4ad5e1b687f262a1d7cc39a0b905a595ac7f95 (diff) | |
download | drakx-backup-do-not-use-9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5.tar drakx-backup-do-not-use-9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5.tar.gz drakx-backup-do-not-use-9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5.tar.bz2 drakx-backup-do-not-use-9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5.tar.xz drakx-backup-do-not-use-9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5.zip |
This commit was manufactured by cvs2svn to create tagV10_34_11_100mdk
'V10_34_11_100mdk'.
Diffstat (limited to 'tools/ddcprobe/ddcxinfos.c')
-rw-r--r-- | tools/ddcprobe/ddcxinfos.c | 68 |
1 files changed, 54 insertions, 14 deletions
diff --git a/tools/ddcprobe/ddcxinfos.c b/tools/ddcprobe/ddcxinfos.c index 22ed653b8..e595d549c 100644 --- a/tools/ddcprobe/ddcxinfos.c +++ b/tools/ddcprobe/ddcxinfos.c @@ -2,38 +2,78 @@ #include <stdlib.h> #include <string.h> #include <math.h> +#include <sys/mman.h> +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> +#include <stdarg.h> #include "vbe.h" #include "vesamode.h" + +#ifdef HAVE_VBE +#include "int10/vbios.h" +#else +#define InitInt10(PCI_CONFIG) 0 +#define FreeInt10() /**/ +#endif + #ident "$Id$" #define SQR(x) ((x) * (x)) -int main(int argc, char **argv) +void log_err(char *format, ...) +{ + va_list args; + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); +} + +int main(void) { int i, j; - u_int16_t *mode_list; unsigned char hmin, hmax, vmin, vmax; - struct vbe_info *vbe_info; - struct vbe_edid1_info *edid; + struct vbe_info vbe_info_static; + struct vbe_info *vbe_info = &vbe_info_static; + struct vbe_edid1_info edid_static; + struct vbe_edid1_info *edid = &edid_static; struct vbe_modeline *modelines; - + int pci_config_type = 0; - if ((vbe_info = vbe_get_vbe_info()) == NULL) return 1; + /* Determine PCI configuration type */ + pci_config_type = 1; - printf("%dKB of video ram\n", vbe_info->memory_size * 64); + /* Initialize Int10 */ + if (InitInt10(pci_config_type)) return 1; - /* List supported standard modes. */ - for (mode_list = vbe_info->mode_list.list; *mode_list != 0xffff; mode_list++) + /* Get VBE information */ + if (vbe_get_vbe_info(vbe_info) == 0) { + FreeInt10(); + return 1; + } + printf("%dKB of video ram\n", vbe_info->memory_size / 1024); + + /* List supported standard modes */ +#ifdef HAVE_VBE + for (j = 0; j < vbe_info->modes; j++) for (i = 0; known_vesa_modes[i].x; i++) - if (known_vesa_modes[i].number == *mode_list) + if (known_vesa_modes[i].number == vbe_info->mode_list[j]) printf("%d %d %d\n", known_vesa_modes[i].colors, known_vesa_modes[i].x, known_vesa_modes[i].y ); +#endif printf("\n"); - if ((edid = vbe_get_edid_info()) == NULL) return 0; + /* Get EDID information */ + if (vbe_get_edid_info(edid) == 0) { + FreeInt10(); + return 0; + } + FreeInt10(); + + if (edid->manufacturer_name.p == 0 || edid->product_code == 0) return 0; if (edid->version == 255 && edid->revision == 255) return 0; vbe_get_edid_ranges(edid, &hmin, &hmax, &vmin, &vmax); @@ -48,9 +88,9 @@ int main(int argc, char **argv) char manufacturer[4]; double size = sqrt(SQR(edid->max_size_horizontal) + SQR(edid->max_size_vertical)) / 2.54; - manufacturer[0] = edid->manufacturer_name.char1 + 'A' - 1; - manufacturer[1] = edid->manufacturer_name.char2 + 'A' - 1; - manufacturer[2] = edid->manufacturer_name.char3 + 'A' - 1; + manufacturer[0] = edid->manufacturer_name.u.char1 + 'A' - 1; + manufacturer[1] = edid->manufacturer_name.u.char2 + 'A' - 1; + manufacturer[2] = edid->manufacturer_name.u.char3 + 'A' - 1; manufacturer[3] = '\0'; printf(size ? "%3.2f inches monitor (truly %3.2f') EISA ID=%s%04x\n" : "\n", size * 1.08, size, manufacturer, edid->product_code); } |