1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
/*
* sysobj - https://github.com/bp0/verbose-spork
* Copyright (C) 2018 Burt P. <pburt0@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef __UTIL_EDID_H__
#define __UTIL_EDID_H__
#include <stdint.h> /* for *int*_t types */
struct edid_dtd {
uint8_t *ptr;
int pixel_clock_khz;
int horiz_pixels;
int vert_lines;
};
struct edid_cea_header {
uint8_t *ptr;
int type, len;
};
struct edid_cea_block {
struct edid_cea_header header;
int reserved[8];
};
struct edid_cea_audio {
struct edid_cea_header header;
int format, channels, freq_bits;
int depth_bits; /* format 1 */
int max_kbps; /* formats 2-8 */
};
struct edid_cea_video {
struct edid_cea_header header;
};
struct edid_cea_vendor_spec {
struct edid_cea_header header;
};
struct edid_cea_speaker {
struct edid_cea_header header;
int alloc_bits;
};
typedef struct {
union {
void* data;
uint8_t* u8;
uint16_t* u16;
uint32_t* u32;
};
unsigned int len;
/* 0 - EDID
* 1 - EIA/CEA-861
* 2 - DisplayID
*/
int std;
int ver_major, ver_minor;
int checksum_ok; /* first 128-byte block only */
int ext_blocks, ext_blocks_ok, ext_blocks_fail;
uint8_t *ext_ok;
int dtd_count;
struct edid_dtd *dtds;
int cea_block_count;
struct edid_cea_block *cea_blocks;
char ven[4];
int d_type[4];
char d_text[4][14];
/* point into d_text */
char *name;
char *serial;
char *ut1;
char *ut2;
int a_or_d; /* 0 = analog, 1 = digital */
int bpc;
uint16_t product;
uint32_t n_serial;
int week, year;
int horiz_cm, vert_cm;
float diag_cm, diag_in;
} edid;
edid *edid_new(const char *data, unsigned int len);
edid *edid_new_from_hex(const char *hex_string);
void edid_free(edid *e);
char *edid_dump_hex(edid *e, int tabs, int breaks);
const char *edid_standard(int type);
const char *edid_descriptor_type(int type);
const char *edid_ext_block_type(int type);
const char *edid_cea_block_type(int type);
const char *edid_cea_audio_type(int type);
char *edid_dtd_describe(struct edid_dtd *dtd);
char *edid_cea_block_describe(struct edid_cea_block *blk);
char *edid_dump2(edid *e);
#endif
|