summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@x-sgb1.(none)>2011-07-31 10:32:25 +0800
committerroot <root@x-sgb1.(none)>2011-07-31 10:32:25 +0800
commit811e3e742214179114bc9c8b1b93c131fcaec638 (patch)
tree956b791442fcc663a05dbbc869f039e6969aa19d
parentfef7018b8425306d9c3756476a97fa6cbe3b1092 (diff)
Rewrite it first time, but still not perfect.
-rw-r--r--drm_edid.h15
-rwxr-xr-xtestedid.c80
2 files changed, 50 insertions, 45 deletions
diff --git a/drm_edid.h b/drm_edid.h
index 12e466e..082436f 100644
--- a/drm_edid.h
+++ b/drm_edid.h
@@ -4,15 +4,8 @@
* But the mode with Reduced blank feature is deleted.
*/
//static struct drm_display_mode drm_dmt_modes[] = {
-//
-//
-//
-//
-//
-//
-//
-//
-struct modeline
+
+struct drm_display_mode
{
char name[20];
int freq;
@@ -28,7 +21,7 @@ struct modeline
int vtot;
int v0;
};
-struct modeline dmt_modes[] = {
+struct drm_display_mode dmt_modes[] = {
/* 640x350@85Hz */
{ "640x350",85, 31500, 640, 672,736, 832, 0, 350, 382, 385, 445, 0},
/* 640x400@85Hz */
@@ -149,7 +142,7 @@ struct modeline dmt_modes[] = {
* Detailed mode info for the EDID "established modes" data to use.
*/
//static struct drm_display_mode edid_est_modes[] = {
-struct modeline est_modes[] = {
+struct drm_display_mode est_modes[] = {
{ "800x600",60, 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0 }, /* 800x600@60Hz */
{ "800x600",56, 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0}, /* 800x600@56Hz */
{ "640x480",75, 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0 }, /* 640x480@75Hz */
diff --git a/testedid.c b/testedid.c
index b4a5578..0bc0ef5 100755
--- a/testedid.c
+++ b/testedid.c
@@ -154,7 +154,14 @@ int parse_edid(char edid[])
{
if (check_edid(edid))
return 1;
- union mfdata
+/*
+3.4 Vendor & Product ID: 10 Bytes
+08h, 09h 2 ID Manufacturer Name Section 3.4.1
+0Ah, 0Bh 2 ID Product Code Section 3.4.2
+0Ch → 0Fh 4 ID Serial Number Section 3.4.3
+10h, 11h 2 Week of Manufacture or Model Year Flag,
+*/
+ union VendorProduct
{
struct
{
@@ -171,33 +178,47 @@ int parse_edid(char edid[])
mfid.singlechr.hb = edid[8];
mfid.singlechr.lb = edid[9];
- //printf("ManufactureID: %02hhx %02hhx %02hhx\n",mfid.idchr.a,mfid.idchr.b,mfid.idchr.c);
printf("\tManufactureID: %c%c%c\t",chrmap(mfid.idchr.a),chrmap(mfid.idchr.b),chrmap(mfid.idchr.c));
printf("\tMonitorID: %hhx%hhx\t",edid[0xb],edid[0xa]);
printf("\tSerialNumber: %c%c%c%c\n",edid[0xf],edid[0xe],edid[0xd],edid[0xc]);
printf("\tProductWeek/year: %d/%d\n",edid[0x10],edid[0x11]+1990);
printf("\tEdidVersion: %hhx.%hhx\n",edid[0x12],edid[0x13]);
- struct
- {
- char serrationvsync:1;
- char syncongreen:1;
- char compositesync:1;
- char separatesyncs:1;
- char blanktoblacksetup:1;
- char videolevel:2;
- char analogordigital:1;
- } inputdef;
+
+ union VideoInputDefinition
+ {
+ struct
+ {
+ char serrationvsync:1;
+ char syncongreen:1;
+ char compositesync:1;
+ char separatesyncs:1;
+ char blanktoblacksetup:1;
+ char videolevel:2;
+ char analogordigital:1;
+ } inputdef_a;
+ struct
+ {
+ char InterfaceStandardSupported:4;
+ char colorbitdepth:3;
+ char analogordigital:1;
+ } inputdef_d;
+ } inputdef;
memcpy(&inputdef,&edid[0x14],1);
- char msg[256];
- memset(msg,0,sizeof(msg));
- if(inputdef.analogordigital)
- strcat(msg,"Digital");
- else
- strcat(msg, "Analogor");
- printf("\tMonitorType: %s\n",msg);
- printf("\tMaxImagesize: %hhdcm x %hhdcm\n",edid[0x15],edid[0x16]);
- printf("\tMonitorGamma: %.2f\n",((edid[0x17]+100)*1.0/100.0));
+ if(inputdef.inputdef_a.analogordigital)
+ {
+ printf("\tMonitorType: %s\n","Digital");
+ int bitsperprimarycolor[]={0,6,8,10,12,14,16,0};
+ printf("\tColorBitDepth: %d Bits per Primary Color\n",bitsperprimarycolor[inputdef.inputdef_d.colorbitdepth]);
+ char *interfacetpye[]={"","DVI","HDMI-a","HDMI-b","MDDI","DisplayPort"};
+ printf("\tInterfaceStandardSupported: %s\n",bitsperprimarycolor[inputdef.inputdef_d.InterfaceStandardSupported]);
+ }
+ else
+ {
+ printf("\tMonitorType: %s\n","Analogor");
+ printf("\tMaxImagesize: %hhdcm x %hhdcm\n",edid[0x15],edid[0x16]);
+ printf("\tMonitorGamma: %.2f\n",((edid[0x17]+100)*1.0/100.0));
+ }
struct
{
char GTFSupport:1;
@@ -209,6 +230,9 @@ int parse_edid(char edid[])
char standby:1;
} powman;
memcpy(&powman,&edid[0x18],1);
+
+ char msg[256];
+ memset(msg,0,sizeof(msg));
memset(msg,0,256);
if(powman.standby) strcat(msg,"standby ");
if(powman.suspend) strcat(msg,"suspend ");
@@ -242,17 +266,9 @@ int parse_edid(char edid[])
// if(edid[0x23] & 128) strcat(estiming,"720x400 @ 70 \t");
struct mode_line estmode[]={
- {"1280x1024",75} , {"1024x768",75} , {"1024x768",70} , {"1024x768",60} , {"1024x768",87} , {"832x624",75} , {"800x600",75} , {"800x600",72} , {"800x600",60} , {"800x600",56} , {"640x480",75} , {"640x480",72} , {"640x480",67} , {"640x480",60} , {"720x400",88} , {"720x400",70}};
+ {"1280x1024",75} , {"1024x768",75} , {"1024x768",70} , {"1024x768",60} , {"1024x768",87} , {"832x624",75} , {"800x600",75} , {"800x600",72} , {"800x600",60} , {"800x600",56} , {"640x480",75} , {"640x480",72} , {"640x480",67} , {"640x480",60} , {"720x400",88} , {"720x400",70}};
struct mode_line curestmode[80];
printf("\tEstablishedTiming: \n");
-// int len=strlen(estiming);
-// for(int i=0;i<len;i++)
-// {
-// if(estiming[i] == '\t')
-// printf("\n\t\t");
-// else
-// printf("%c",estiming[i]);
-// }
char es = edid[0x24];
int escount=0;
for(int i=0;i<8;i++)
@@ -278,7 +294,6 @@ int parse_edid(char edid[])
{
struct drm_display_mode rmodeline;
find_est_mode(&curestmode[i],&rmodeline);
- // printf("\t\t%s @ %d\n",curestmode[i].mode,curestmode[i].freq);
printf("\t\t%s @ %d %d %d %d\n",rmodeline.name,rmodeline.freq,rmodeline.pclock, rmodeline.htot,rmodeline.vtot);
}
@@ -310,8 +325,6 @@ int parse_edid(char edid[])
char *msgp = strstr(msg,":");
memcpy(ratio[0],msg,msgp-msg);
memcpy(ratio[1],msgp+1,strlen(msgp));
-// ratio[0] = strtok(msg,":");
-// ratio[1] = strtok(NULL,":");
int hratio = atoi(ratio[0]);
int vratio = atoi(ratio[1]);
if(tem != 1)
@@ -328,7 +341,6 @@ int parse_edid(char edid[])
find_dmt_mode(&tdmtmode,&rmodeline);
printf("\t\t%s @ %d %d %d %d (%s)\n",rmodeline.name, rmodeline.freq, rmodeline.pclock, rmodeline.htot, rmodeline.vtot, msg);
- //printf("\t\t%dx%d @ %d (%s)\n",tem*8+248,(tem*8+248)*vratio/hratio,stdtiminginfo.vertfrequency+60,msg);
}
}
union