1 typedef unsigned char uchar;
2 typedef struct MonitorInfo MonitorInfo;
3 typedef struct Timing Timing;
4 typedef struct DetailedTiming DetailedTiming;
5 
6 typedef enum
7 {
8     UNDEFINED,
9     DVI,
10     HDMI_A,
11     HDMI_B,
12     MDDI,
13     DISPLAY_PORT
14 } Interface;
15 
16 typedef enum
17 {
18     UNDEFINED_COLOR,
19     MONOCHROME,
20     RGB,
21     OTHER_COLOR
22 } ColorType;
23 
24 typedef enum
25 {
26     NO_STEREO,
27     FIELD_RIGHT,
28     FIELD_LEFT,
29     TWO_WAY_RIGHT_ON_EVEN,
30     TWO_WAY_LEFT_ON_EVEN,
31     FOUR_WAY_INTERLEAVED,
32     SIDE_BY_SIDE
33 } StereoType;
34 
35 struct Timing
36 {
37     int width;
38     int height;
39     int frequency;
40 };
41 
42 struct DetailedTiming
43 {
44     int		pixel_clock;
45     int		h_addr;
46     int		h_blank;
47     int		h_sync;
48     int		h_front_porch;
49     int		v_addr;
50     int		v_blank;
51     int		v_sync;
52     int		v_front_porch;
53     int		width_mm;
54     int		height_mm;
55     int		right_border;
56     int		top_border;
57     int		interlaced;
58     StereoType	stereo;
59 
60     int		digital_sync;
61     union
62     {
63 	struct
64 	{
65 	    int bipolar;
66 	    int serrations;
67 	    int sync_on_green;
68 	} analog;
69 
70 	struct
71 	{
72 	    int composite;
73 	    int serrations;
74 	    int negative_vsync;
75 	    int negative_hsync;
76 	} digital;
77     } ad;
78 };
79 
80 struct MonitorInfo
81 {
82     int			checksum;
83     char		manufacturer_code[4];
84     int			product_code;
85     unsigned int	serial_number;
86 
87     int			production_week;	/* -1 if not specified */
88     int			production_year;	/* -1 if not specified */
89     int			model_year;		/* -1 if not specified */
90 
91     int			major_version;
92     int			minor_version;
93 
94     int			is_digital;
95 
96     union
97     {
98 	struct
99 	{
100 	    int		bits_per_primary;
101 	    Interface	interface;
102 	    int		rgb444;
103 	    int		ycrcb444;
104 	    int		ycrcb422;
105 	} digital;
106 
107 	struct
108 	{
109 	    double	video_signal_level;
110 	    double	sync_signal_level;
111 	    double	total_signal_level;
112 
113 	    int		blank_to_black;
114 
115 	    int		separate_hv_sync;
116 	    int		composite_sync_on_h;
117 	    int		composite_sync_on_green;
118 	    int		serration_on_vsync;
119 	    ColorType	color_type;
120 	} analog;
121     } ad;
122 
123     int			width_mm;		/* -1 if not specified */
124     int			height_mm;		/* -1 if not specified */
125     double		aspect_ratio;		/* -1.0 if not specififed */
126 
127     double		gamma;			/* -1.0 if not specified */
128 
129     int			standby;
130     int			suspend;
131     int			active_off;
132 
133     int			srgb_is_standard;
134     int			preferred_timing_includes_native;
135     int			continuous_frequency;
136 
137     double		red_x;
138     double		red_y;
139     double		green_x;
140     double		green_y;
141     double		blue_x;
142     double		blue_y;
143     double		white_x;
144     double		white_y;
145 
146     Timing		established[24];	/* Terminated by 0x0x0 */
147     Timing		standard[8];
148 
149     int			n_detailed_timings;
150     DetailedTiming	detailed_timings[4];	/* If monitor has a preferred
151 						 * mode, it is the first one
152 						 * (whether it has, is
153 						 * determined by the
154 						 * preferred_timing_includes
155 						 * bit.
156 						 */
157 
158     /* Optional product description */
159     char		dsc_serial_number[14];
160     char		dsc_product_name[14];
161     char		dsc_string[14];		/* Unspecified ASCII data */
162 };
163 
164 MonitorInfo *decode_edid (const uchar *data);
165 void         dump_monitor_info (MonitorInfo *info);
166 char *       make_display_name (const char        *output_name,
167 				const MonitorInfo *info);
168