summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi Sun <yi.sun@intel.com>2011-08-04 13:29:43 +0800
committerYi Sun <yi.sun@intel.com>2011-08-04 13:29:43 +0800
commit926f877f5dbf3d19e6911a482eae2fd73d87d505 (patch)
tree0d7cf41ca7a1848779dd3191a17015906873b93c
parent5642009819142b34803b1ca30d2155111a7aacdf (diff)
Delete the white space.
-rw-r--r--drm_edid.h5
-rw-r--r--testedid.c77
2 files changed, 37 insertions, 45 deletions
diff --git a/drm_edid.h b/drm_edid.h
index 082436f..28c1fcc 100644
--- a/drm_edid.h
+++ b/drm_edid.h
@@ -3,9 +3,7 @@
* This table is copied from xfree86/modes/xf86EdidModes.c.
* But the mode with Reduced blank feature is deleted.
*/
-//static struct drm_display_mode drm_dmt_modes[] = {
-
-struct drm_display_mode
+struct drm_display_mode
{
char name[20];
int freq;
@@ -141,7 +139,6 @@ struct drm_display_mode dmt_modes[] = {
/*
* Detailed mode info for the EDID "established modes" data to use.
*/
-//static struct drm_display_mode edid_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 */
diff --git a/testedid.c b/testedid.c
index a8be461..cf2ea13 100644
--- a/testedid.c
+++ b/testedid.c
@@ -29,17 +29,16 @@
* -HDMI block parse
* -
*/
-
#include <stdio.h>
#include <stddef.h> /*dir */
-#include <sys/types.h>
-#include <dirent.h>
-#include <string.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <string.h>
#include <malloc.h>
#include <stdlib.h>
#include <fcntl.h> /*open */
#include <unistd.h> /*read */
-#include <sys/stat.h>
+#include <sys/stat.h>
#include "drm_edid.h"
#define EDIDPATH "/sys/class/drm/"
@@ -52,7 +51,7 @@ struct mode_line {
int freq;
};
-union VendorProduct {
+union VendorProduct {
struct {
int c:5;
int b:5;
@@ -105,7 +104,7 @@ char *interfacetpye[] = {
"DisplayPort"
};
-struct mode_line estmode[] = {
+struct mode_line estmode[] = {
{"1280x1024",75},
{"1024x768",75},
{"1024x768",70},
@@ -173,8 +172,8 @@ union H2bit {
};
char *bppinfo[] = {
- "DVI_Dual",
- "",
+ "DVI_Dual",
+ "",
"",
"DC_Y444",
"DC_30bit",
@@ -211,7 +210,7 @@ get_edid(char *edid_file_name)
static void print_edid(char *edid)
{
- for (int j=0; j < MAXEDID; j++) {
+ for (int j=0; j < MAXEDID; j++) {
if (j % 16 == 0)
printf("\t%04hhx: ", j);
if (j % 16 == 8)
@@ -223,32 +222,32 @@ static void print_edid(char *edid)
printf("\n");
}
-static int
+static int
get_connected_card_list(char *** connected_card_list )
{
struct dirent *dirent_ptr;
- DIR* drm_dir_ptr;
+ DIR* drm_dir_ptr;
int connected_count = 0;
char edid_file[MAXFILENAME];
char *new_edid;
- drm_dir_ptr = opendir(EDIDPATH);
+ drm_dir_ptr = opendir(EDIDPATH);
if (drm_dir_ptr == NULL){
printf("Error: fail to open the directory %s\n", EDIDPATH);
return 1;
}
-
+
(*connected_card_list)= malloc(MAXCARD * sizeof(char*));
- dirent_ptr = readdir(drm_dir_ptr);
+ dirent_ptr = readdir(drm_dir_ptr);
while (dirent_ptr) {
if (strstr(dirent_ptr->d_name, "card0-") >0 ) {
sprintf(edid_file, "%s%s/edid", EDIDPATH, dirent_ptr->d_name);
-
+
new_edid = get_edid(edid_file);
-
+
if (new_edid != NULL){
(*connected_card_list)[connected_count] = malloc(MAXFILENAME);
memcpy((*connected_card_list)[connected_count], edid_file, strlen(edid_file) );
@@ -257,7 +256,7 @@ get_connected_card_list(char *** connected_card_list )
}
dirent_ptr = readdir(drm_dir_ptr);
}
- closedir(drm_dir_ptr);
+ closedir(drm_dir_ptr);
return connected_count;
}
@@ -337,7 +336,7 @@ static int parse_edid_vendor_product(char edid[])
union VendorProduct mfid;
mfid.singlechr.hb = edid[8];
mfid.singlechr.lb = edid[9];
-
+
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]);
@@ -446,13 +445,13 @@ static int parse_edid_power_support(char edid[])
char msg[256];
memset(msg, 0, sizeof(msg));
memset(msg, 0, 256);
- if(powman.standby) strcat(msg, "standby ");
- if(powman.suspend) strcat(msg, "suspend ");
- if(powman.activeoff) strcat(msg, "activeoff ");
- if(!(powman.monchrome & 3)) strcat(msg, "monochrome ");
- else if(powman.activeoff & 1) strcat(msg, "RGB ");
- else if(powman.activeoff & 2) strcat(msg, "Non RGB ");
- else if(powman.activeoff & 3) strcat(msg, "Undefineed ");
+ if(powman.standby) strcat(msg, "standby ");
+ if(powman.suspend) strcat(msg, "suspend ");
+ if(powman.activeoff) strcat(msg, "activeoff ");
+ if(!(powman.monchrome & 3)) strcat(msg, "monochrome ");
+ else if(powman.activeoff & 1) strcat(msg, "RGB ");
+ else if(powman.activeoff & 2) strcat(msg, "Non RGB ");
+ else if(powman.activeoff & 3) strcat(msg, "Undefineed ");
printf("\tPowerSupport: %s\n", msg);
printf("\tChromaInfo: %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx \n", edid[0x19], edid[0x1a], edid[0x1b], edid[0x1c], edid[0x1d], edid[0x1e], edid[0x1f], edid[0x20], edid[0x21], edid[0x22]);
@@ -489,7 +488,7 @@ static int parse_edid_established_timing(char edid[])
char es = edid[0x24];
int escount=0;
for (int i=0; i < 8; i++) {
- if (es & 0x01) {
+ if (es & 0x01) {
memcpy(&curestmode[escount], &estmode[i], sizeof(struct mode_line));
escount++;
}
@@ -497,7 +496,7 @@ static int parse_edid_established_timing(char edid[])
}
es = edid[0x23];
for (int i=0; i<8; i++) {
- if (es & 0x01) {
+ if (es & 0x01) {
memcpy(&curestmode[escount], &estmode[i+8], sizeof(struct mode_line));
escount++;
}
@@ -563,7 +562,7 @@ static int parse_edid_standar_timing(char edid[])
sprintf(tmod, "%dx%d", tem * 8 + 248, (int)(((tem * 8 + 248) * 1.0 * vratio + 0.5) / hratio));
strcat(tdmtmode.mode , tmod);
tdmtmode.freq = stdtiminginfo.vertfrequency + 60;
-
+
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);
@@ -580,7 +579,7 @@ static int parse_edid_detail_timing(char edid[])
memset(&pixclk, 0, sizeof(union PixelClock));
for(int i = 0; i < 4; i++) {
- int Hdisp, Vdisp, Hblank, Vblank;
+ int Hdisp, Vdisp, Hblank, Vblank;
float freq;
pixclk.clkchr.clkl = edid[0x36 + i*18];
pixclk.clkchr.clkh = edid[0x37 + i*18];
@@ -623,7 +622,7 @@ static int parse_edid_detail_timing(char edid[])
union H2bit h2bit;
h2bit.value = edid[0x36 + i*18 + 11];
memset(&sync, 0, 4);
- sync.syncchr.syncl = edid[0x36 + i*18 + 8];
+ sync.syncchr.syncl = edid[0x36 + i*18 + 8];
sync.syncchr.synch = h2bit.chr.vsync;
}
return 0;
@@ -632,7 +631,7 @@ static int parse_edid_detail_timing(char edid[])
static int parse_edid_hdmi_bpp(char edid[])
{
/*
- * Extended block for HDMI
+ * Extended block for HDMI
*/
int phdmiindex = gethdmiblock(edid);
@@ -640,7 +639,7 @@ static int parse_edid_hdmi_bpp(char edid[])
printf("\tHaving a hdmi block, start position is:%2hhx\n", phdmiindex);
char bppbyte = edid[phdmiindex + 5];
for (int i = 0; i < 8; i++) {
- if (bppbyte & 0x01) {
+ if (bppbyte & 0x01) {
printf("\tHDMI bpp supports: %s\n", bppinfo[i]);
}
bppbyte = bppbyte >> 1;
@@ -651,7 +650,7 @@ static int parse_edid_hdmi_bpp(char edid[])
static int parse_edid(char edid[])
{
- if (check_edid(edid))
+ if (check_edid(edid))
return 1;
parse_edid_vendor_product(edid);
@@ -671,11 +670,8 @@ static int parse_edid(char edid[])
return 0;
}
-
-
-
-int main(void)
-{
+int main(void)
+{
int connected_count;
char **edid_list;
char **connected_card_list;
@@ -694,5 +690,4 @@ int main(void)
}
return 0;
-}
-
+}