summaryrefslogtreecommitdiff
path: root/deps/sysobj_early/include/util_edid.h
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2019-08-23 12:28:20 -0500
committerLeandro A. F. Pereira <leandro@hardinfo.org>2019-08-28 13:15:48 +0200
commita08f2a909f7a67f7ca81354a88b7c2e47dc6f19f (patch)
treed95b755c1655442a16b9516cc266e036c1ef412f /deps/sysobj_early/include/util_edid.h
parent695e8ef2bc0298356918a430e41458e510e7b6c5 (diff)
monitors: displayid fixes
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'deps/sysobj_early/include/util_edid.h')
-rw-r--r--deps/sysobj_early/include/util_edid.h102
1 files changed, 74 insertions, 28 deletions
diff --git a/deps/sysobj_early/include/util_edid.h b/deps/sysobj_early/include/util_edid.h
index 6f1360b5..319900e2 100644
--- a/deps/sysobj_early/include/util_edid.h
+++ b/deps/sysobj_early/include/util_edid.h
@@ -21,25 +21,42 @@
#ifndef __UTIL_EDID_H__
#define __UTIL_EDID_H__
+#define _GNU_SOURCE
#include <stdint.h> /* for *int*_t types */
+#include <glib.h>
+
+typedef struct _edid edid;
+
+typedef struct {
+ edid *e;
+ uint32_t offset;
+} edid_addy;
+
+typedef struct {
+ char *str;
+ uint16_t len;
+ uint8_t is_product_name;
+ uint8_t is_serial;
+} DisplayIDString;
typedef struct {
uint8_t version;
uint8_t extension_length;
uint8_t primary_use_case;
uint8_t extension_count;
- int blocks;
- int checksum_ok;
+ uint16_t blocks;
+ uint8_t checksum_ok;
} DisplayIDMeta;
typedef struct {
- uint8_t *ptr;
+ edid_addy addy;
union {
uint8_t tag;
uint8_t type;
};
uint8_t revision;
uint8_t len;
+ uint8_t bounds_ok;
} DisplayIDBlock;
/* order by rising priority */
@@ -50,6 +67,7 @@ enum {
OUTSRC_DTD,
OUTSRC_CEA_DTD,
OUTSRC_SVD,
+
OUTSRC_DID_TYPE_I,
OUTSRC_DID_TYPE_VI,
OUTSRC_DID_TYPE_VII,
@@ -61,9 +79,9 @@ typedef struct {
int horiz_blanking, vert_blanking;
int horiz_pixels, vert_lines, vert_pixels;
float vert_freq_hz;
- int is_interlaced;
+ uint8_t is_interlaced;
+ uint8_t is_preferred;
int stereo_mode;
- int is_preferred;
uint64_t pixel_clock_khz;
int src; /* enum OUTSRC_* */
uint64_t pixels; /* h*v: easier to compare */
@@ -76,34 +94,57 @@ struct edid_std {
};
struct edid_dtd {
- uint8_t *ptr;
- int cea_ext;
+ edid_addy addy;
+ uint8_t cea_ext; /* in a CEA block vs one of the regular EDID descriptors */
edid_output out;
+ uint8_t bounds_ok;
};
struct edid_svd {
uint8_t v;
- int is_native;
+ uint8_t is_native;
edid_output out;
};
struct edid_sad {
uint8_t v[3];
- int format, channels, freq_bits;
+ uint8_t format, channels, freq_bits;
int depth_bits; /* format 1 */
int max_kbps; /* formats 2-8 */
};
-struct edid_cea_header {
- uint8_t *ptr;
+struct edid_cea_block {
+ edid_addy addy;
int type, len;
+ uint8_t bounds_ok;
};
-struct edid_cea_block {
- struct edid_cea_header header;
- int reserved[8];
+struct edid_descriptor {
+ edid_addy addy;
+ uint8_t type;
+ char text[14];
+};
+
+struct edid_manf_date {
+ uint8_t week;
+ uint8_t is_model_year; /* ignore week */
+ uint16_t year;
+ int std; /* enum STD_* */
+};
+
+enum {
+ VEN_TYPE_INVALID = 0,
+ VEN_TYPE_PNP,
+ VEN_TYPE_OUI,
};
+typedef struct {
+ //TODO: union?
+ char pnp[4];
+ uint32_t oui;
+ uint8_t type; /* enum VEN_TYPE_* */
+} edid_ven;
+
enum {
STD_EDID = 0,
STD_EEDID = 1,
@@ -112,21 +153,20 @@ enum {
STD_DISPLAYID20 = 4,
};
-typedef struct {
+typedef struct _edid {
union {
void* data;
uint8_t* u8;
uint16_t* u16;
- uint32_t* u32;
};
unsigned int len;
/* enum STD_* */
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 ver_major, ver_minor;
+ uint8_t checksum_ok; /* first 128-byte block only */
+ uint8_t ext_blocks, ext_blocks_ok, ext_blocks_fail;
uint8_t *ext_ok;
int etb_count;
@@ -147,34 +187,39 @@ typedef struct {
int sad_count;
struct edid_sad *sads;
- char ven[4];
- int d_type[4];
- char d_text[4][14];
- /* point into d_text */
+ edid_ven ven;
+ struct edid_descriptor d[4];
+ /* point into d[].text */
char *name;
char *serial;
char *ut1;
char *ut2;
- int a_or_d; /* 0 = analog, 1 = digital */
- int interface; /* digital interface */
- int bpc; /* digital bpc */
+ uint8_t a_or_d; /* 0 = analog, 1 = digital */
+ uint8_t interface; /* digital interface */
+ uint8_t bpc; /* digital bpc */
uint16_t product;
uint32_t n_serial;
- int week, year;
+ struct edid_manf_date dom;
edid_output img;
+ edid_output img_svd;
edid_output img_max;
- int speaker_alloc_bits;
+ uint32_t speaker_alloc_bits;
DisplayIDMeta did;
int did_block_count;
DisplayIDBlock *did_blocks;
+ int did_string_count;
+ DisplayIDString *did_strings;
int didt_count;
edid_output *didts;
+
+ GString *msg_log;
} edid;
edid *edid_new(const char *data, unsigned int len);
edid *edid_new_from_hex(const char *hex_string);
+edid *edid_new_from_file(const char *path);
void edid_free(edid *e);
char *edid_dump_hex(edid *e, int tabs, int breaks);
@@ -187,6 +232,7 @@ const char *edid_cea_block_type(int type);
const char *edid_cea_audio_type(int type);
char *edid_output_describe(edid_output *out);
+char *edid_base_descriptor_describe(struct edid_descriptor *d);
char *edid_dtd_describe(struct edid_dtd *dtd, int dump_bytes);
char *edid_cea_block_describe(struct edid_cea_block *blk);
char *edid_cea_audio_describe(struct edid_sad *sad);