From 5ab0acfc5108faf7eb4735f915d86c03a5c4f3df Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 27 Mar 2008 11:44:37 -0700 Subject: [PATCH] Write a framework to decode edid data in an external program. This isn't complete, but demonstrates how one would write an external EDID parser that can work from binary data as dumped by the X server. --- hw/xfree86/ddc/Makefile.am | 4 ++ hw/xfree86/ddc/decode_edid.c | 80 ++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 hw/xfree86/ddc/decode_edid.c diff --git a/hw/xfree86/ddc/Makefile.am b/hw/xfree86/ddc/Makefile.am index cd146c5a3..69afc7296 100644 --- a/hw/xfree86/ddc/Makefile.am +++ b/hw/xfree86/ddc/Makefile.am @@ -10,3 +10,7 @@ INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) EXTRA_DIST = ddcPriv.h DDC.HOWTO + +bin_PROGRAMS = decode_edid + +decode_edid_SOURCES = decode_edid.c interpret_edid.c print_edid.c diff --git a/hw/xfree86/ddc/decode_edid.c b/hw/xfree86/ddc/decode_edid.c new file mode 100644 index 000000000..9859ae7dc --- /dev/null +++ b/hw/xfree86/ddc/decode_edid.c @@ -0,0 +1,80 @@ +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#include "misc.h" +#include "xf86.h" +#include "xf86_OSproc.h" +#define _PARSE_EDID_ +#include "xf86DDC.h" +#include + +Uchar edid[] = { + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x52, 0x62, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x11, 0x01, 0x03, 0x80, 0x69, 0x3b, 0x78, + 0x0a, 0x0d, 0xc9, 0xa0, 0x57, 0x47, 0x98, 0x27, + 0x12, 0x48, 0x4c, 0x20, 0x00, 0x00, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3a, + 0x80, 0xd0, 0x72, 0x38, 0x2d, 0x40, 0x10, 0x2c, + 0x45, 0x80, 0xc4, 0x8e, 0x21, 0x00, 0x00, 0x1e, + 0x8c, 0x0a, 0xd0, 0x90, 0x20, 0x40, 0x31, 0x20, + 0x0c, 0x40, 0x55, 0x00, 0xc4, 0x8e, 0x21, 0x00, + 0x00, 0x18, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x54, + 0x4f, 0x53, 0x48, 0x49, 0x42, 0x41, 0x2d, 0x54, + 0x56, 0x0a, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, + 0x00, 0x17, 0x3d, 0x0f, 0x44, 0x0f, 0x00, 0x0a, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x3b, +}; + +int +main (int argc, char **argv) +{ + xf86MonPtr m; + + m = xf86InterpretEDID (0, edid); + (void) xf86PrintEDID (m); + return 0; +} + +pointer +XNFcalloc (unsigned long amount) +{ + return calloc (amount, 1); +} + +#include + +void +xf86DrvMsg (int srcn, MessageType type, const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + + vprintf (fmt, args); +} + +void +xf86Msg (MessageType type, const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + + vprintf (fmt, args); +} + +void +xf86ErrorF (const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + + vprintf (fmt, args); +} + +void +Xfree (pointer x) +{ + free (x); +}