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.
This commit is contained in:
Keith Packard 2008-03-27 11:44:37 -07:00
parent 501bdedc11
commit 5ab0acfc51
2 changed files with 84 additions and 0 deletions

View file

@ -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

View file

@ -0,0 +1,80 @@
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "misc.h"
#include "xf86.h"
#include "xf86_OSproc.h"
#define _PARSE_EDID_
#include "xf86DDC.h"
#include <string.h>
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 <stdarg.h>
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);
}