| 1 |
#include <cctype> |
| 2 |
#include <cstring> |
| 3 |
|
| 4 |
#include <linux/v4l2-subdev.h> |
| 5 |
|
| 6 |
#include "compiler.h" |
| 7 |
#include "v4l2-ctl.h" |
| 8 |
|
| 9 |
/* |
| 10 |
* The 24-bit IEEE Registration Identifier for the HDMI-LLC Vendor |
| 11 |
* Specific Data Block. |
| 12 |
*/ |
| 13 |
#define HDMI_VSDB_EXT_TAG 0x000c03 |
| 14 |
/* |
| 15 |
* The 24-bit IEEE Registration Identifier for the HDMI-Forum Vendor |
| 16 |
* Specific Data Block. |
| 17 |
*/ |
| 18 |
#define HF_VSDB_EXT_TAG 0xc45dd8 |
| 19 |
|
| 20 |
#define VID_CAP_EXT_TAG 0 |
| 21 |
#define COLORIMETRY_EXT_TAG 5 |
| 22 |
#define HDR_MD_EXT_TAG 6 |
| 23 |
|
| 24 |
#define VSDB_TAG 3 |
| 25 |
#define SPEAKER_TAG 4 |
| 26 |
#define EXTENDED_TAG 7 |
| 27 |
|
| 28 |
enum format { |
| 29 |
HEX, |
| 30 |
RAW, |
| 31 |
CARRAY |
| 32 |
}; |
| 33 |
|
| 34 |
static struct v4l2_edid sedid; |
| 35 |
static char *file_in; |
| 36 |
|
| 37 |
static struct v4l2_edid gedid; |
| 38 |
static struct v4l2_edid info_edid; |
| 39 |
static char *file_out; |
| 40 |
static enum format gformat; |
| 41 |
static enum format sformat; |
| 42 |
static unsigned clear_pad; |
| 43 |
static long phys_addr = -1; |
| 44 |
|
| 45 |
static __u8 toggle_cta861_hdr_flags; |
| 46 |
#define CTA861_HDR_UNDERSCAN (1 << 6) |
| 47 |
#define CTA861_HDR_AUDIO (1 << 6) |
| 48 |
#define CTA861_HDR_YCBCR444 (1 << 5) |
| 49 |
#define CTA861_HDR_YCBCR422 (1 << 4) |
| 50 |
|
| 51 |
static __u8 toggle_speaker1_flags; |
| 52 |
#define SPEAKER1_FL_FR (1 << 0) |
| 53 |
#define SPEAKER1_LFE (1 << 1) |
| 54 |
#define SPEAKER1_FC (1 << 2) |
| 55 |
#define SPEAKER1_BL_BR (1 << 3) |
| 56 |
#define SPEAKER1_BC (1 << 4) |
| 57 |
#define SPEAKER1_FLC_FRC (1 << 5) |
| 58 |
#define SPEAKER1_RLC_RRC (1 << 6) |
| 59 |
#define SPEAKER1_FLW_FRW (1 << 7) |
| 60 |
|
| 61 |
static __u8 toggle_speaker2_flags; |
| 62 |
#define SPEAKER2_TPFL_TPFR (1 << 0) |
| 63 |
#define SPEAKER2_TPC (1 << 1) |
| 64 |
#define SPEAKER2_TPFC (1 << 2) |
| 65 |
#define SPEAKER2_LS_RS (1 << 3) |
| 66 |
#define SPEAKER2_LFE2 (1 << 4) |
| 67 |
#define SPEAKER2_TPBC (1 << 5) |
| 68 |
#define SPEAKER2_SIL_SIR (1 << 6) |
| 69 |
#define SPEAKER2_TPSIL_TPSIR (1 << 7) |
| 70 |
|
| 71 |
static __u8 toggle_speaker3_flags; |
| 72 |
#define SPEAKER3_TPBL_TPBR (1 << 0) |
| 73 |
#define SPEAKER3_BTFC (1 << 1) |
| 74 |
#define SPEAKER3_BTFL_BTFR (1 << 2) |
| 75 |
#define SPEAKER3_TPLS_TPRS (1 << 3) |
| 76 |
|
| 77 |
static __u8 toggle_hdmi_vsdb_dc_flags; |
| 78 |
#define HDMI_VSDB_Y444_BIT (1 << 3) |
| 79 |
#define HDMI_VSDB_30_BIT (1 << 4) |
| 80 |
#define HDMI_VSDB_36_BIT (1 << 5) |
| 81 |
#define HDMI_VSDB_48_BIT (1 << 6) |
| 82 |
static __u8 toggle_hdmi_vsdb_cnc_flags; |
| 83 |
#define HDMI_VSDB_GRAPHICS (1 << 0) |
| 84 |
#define HDMI_VSDB_PHOTO (1 << 1) |
| 85 |
#define HDMI_VSDB_CINEMA (1 << 2) |
| 86 |
#define HDMI_VSDB_GAME (1 << 3) |
| 87 |
#define HDMI_VSDB_I_LATENCY (1 << 6) |
| 88 |
#define HDMI_VSDB_LATENCY (1 << 7) |
| 89 |
|
| 90 |
static __u8 toggle_hf_vsdb_flags; |
| 91 |
#define HF_VSDB_SCDC_PRESENT (1 << 7) |
| 92 |
#define HF_VSDB_CABLE_STATUS (1 << 5) |
| 93 |
|
| 94 |
static int mod_s_pt = -1; |
| 95 |
static int mod_s_it = -1; |
| 96 |
static int mod_s_ce = -1; |
| 97 |
static __u8 toggle_vid_cap_flags; |
| 98 |
#define VID_CAP_QS (1 << 6) |
| 99 |
#define VID_CAP_QY (1 << 7) |
| 100 |
|
| 101 |
static __u8 toggle_colorimetry_flags1; |
| 102 |
#define COLORIMETRY_XVYCC601 (1 << 0) |
| 103 |
#define COLORIMETRY_XVYCC709 (1 << 1) |
| 104 |
#define COLORIMETRY_SYCC (1 << 2) |
| 105 |
#define COLORIMETRY_OPYCC (1 << 3) |
| 106 |
#define COLORIMETRY_OPRGB (1 << 4) |
| 107 |
#define COLORIMETRY_BT2020CYCC (1 << 5) |
| 108 |
#define COLORIMETRY_BT2020YCC (1 << 6) |
| 109 |
#define COLORIMETRY_BT2020RGB (1 << 7) |
| 110 |
|
| 111 |
static __u8 toggle_colorimetry_flags2; |
| 112 |
#define COLORIMETRY_DCIP3 (1 << 0) |
| 113 |
|
| 114 |
static __u8 toggle_hdr_md_flags; |
| 115 |
#define HDR_MD_SDR (1 << 0) |
| 116 |
#define HDR_MD_HDR (1 << 1) |
| 117 |
#define HDR_MD_SMPTE_2084 (1 << 2) |
| 118 |
#define HDR_MD_HLG (1 << 3) |
| 119 |
|
| 120 |
void edid_usage() |
| 121 |
{ |
| 122 |
printf("\nEDID options:\n" |
| 123 |
" --set-edid pad=<pad>[,type=<type>|file=<file>][,format=<fmt>][modifiers]\n" |
| 124 |
" <pad> is the input index for which to set the EDID.\n" |
| 125 |
" <type> can be one of:\n" |
| 126 |
" list: list all EDID types\n" |
| 127 |
" vga: Base Block supporting VGA interface (1920x1200p60)\n" |
| 128 |
" dvid: Base Block supporting DVI-D interface (1920x1200p60)\n" |
| 129 |
" hdmi: CTA-861 with HDMI support up to 1080p60\n" |
| 130 |
" hdmi-4k-170mhz: CTA-861 with HDMI support up to 1080p60 or 4kp30 4:2:0\n" |
| 131 |
" hdmi-4k-300mhz: CTA-861 with HDMI support up to 4kp30\n" |
| 132 |
" hdmi-4k-600mhz: CTA-861 with HDMI support up to 4kp60\n" |
| 133 |
" hdmi-4k-600mhz-with-displayid: Block Map Extension Block, CTA-861 with\n" |
| 134 |
" HDMI support up to 4kp60, DisplayID Extension Block\n" |
| 135 |
" hdmi-4k-600mhz-with-displayid-eeodb: CTA-861 with EEODB and\n" |
| 136 |
" HDMI support up to 4kp60, DisplayID Extension Block\n" |
| 137 |
" displayport: DisplayID supporting a DisplayPort interface (1920x1200)\n" |
| 138 |
" displayport-with-cta861: DisplayID supporting a DisplayPort interface,\n" |
| 139 |
" CTA-861 Extension Block (1080p60)\n" |
| 140 |
"\n" |
| 141 |
" If <file> is '-', then the data is read from stdin, otherwise it is\n" |
| 142 |
" read from the given file. The file format must be in hex as in get-edid.\n" |
| 143 |
" The 'type' or 'file' arguments are mutually exclusive. One of the two\n" |
| 144 |
" must be specified.\n" |
| 145 |
" <fmt> is one of:\n" |
| 146 |
" hex: hex numbers in ascii text (default)\n" |
| 147 |
" raw: raw binary EDID content\n" |
| 148 |
"\n" |
| 149 |
" [modifiers] is a comma-separate list of EDID modifiers:\n" |
| 150 |
"\n" |
| 151 |
" CTA-861 Header modifiers:\n" |
| 152 |
" underscan: toggle the underscan bit.\n" |
| 153 |
" audio: toggle the audio bit.\n" |
| 154 |
" ycbcr444: toggle the YCbCr 4:4:4 bit.\n" |
| 155 |
" ycbcr422: toggle the YCbCr 4:2:2 bit.\n" |
| 156 |
"\n" |
| 157 |
" Speaker Allocation Data Block modifiers:\n" |
| 158 |
" fl-fr: Front Left/Right.\n" |
| 159 |
" lfe: Low Frequency Effects.\n" |
| 160 |
" fc: Front Center.\n" |
| 161 |
" bl-br: Back Left/Right.\n" |
| 162 |
" bc: Back Center.\n" |
| 163 |
" rlc-frc: Front Left/Right of Center.\n" |
| 164 |
" rlc-rrc: Rear Left/Right of Center.\n" |
| 165 |
" flw-frw: Front Left/Right Wide.\n" |
| 166 |
" tpfl-tpfr: Top Front Left/Right.\n" |
| 167 |
" tpc: Top Center.\n" |
| 168 |
" tpfc: Top Front Center.\n" |
| 169 |
" ls-rs: Left/Right Surround.\n" |
| 170 |
" lfe2: Low Frequency Effects 2.\n" |
| 171 |
" tpbc: Top Back Center.\n" |
| 172 |
" sil-sir: Side Left/Right\n" |
| 173 |
" tpsil-tpsir: Top Side Left/Right.\n" |
| 174 |
" tpbl-tpbr: Top Back Left/Right.\n" |
| 175 |
" btfc: Bottom Front Center.\n" |
| 176 |
" btfl-btbr: Bottom Front Left/Right.\n" |
| 177 |
" tpls-tprs: Top Left/Right Surround.\n" |
| 178 |
"\n" |
| 179 |
" HDMI Vendor-Specific Data Block modifiers:\n" |
| 180 |
" pa=<pa>: change the physical address.\n" |
| 181 |
" y444: toggle the YCbCr 4:4:4 Deep Color bit.\n" |
| 182 |
" 30-bit: toggle the 30 bits/pixel bit.\n" |
| 183 |
" 36-bit: toggle the 36 bits/pixel bit.\n" |
| 184 |
" 48-bit: toggle the 48 bits/pixel bit.\n" |
| 185 |
" graphics: toggle the Graphics Content Type bit.\n" |
| 186 |
" photo: toggle the Photo Content Type bit.\n" |
| 187 |
" cinema: toggle the Cinema Content Type bit.\n" |
| 188 |
" game: toggle the Game Content Type bit.\n" |
| 189 |
"\n" |
| 190 |
" HDMI Forum Vendor-Specific Data Block modifiers:\n" |
| 191 |
" scdc: toggle the SCDC Present bit.\n" |
| 192 |
" cable-status: toggle the Cable Status bit.\n" |
| 193 |
"\n" |
| 194 |
" CTA-861 Video Capability Descriptor modifiers:\n" |
| 195 |
" qy: toggle the QY YCC Quantization Range bit.\n" |
| 196 |
" qs: toggle the QS RGB Quantization Range bit.\n" |
| 197 |
" s-pt=<0-3>: set the PT Preferred Format Over/underscan bits.\n" |
| 198 |
" s-it=<0-3>: set the IT Over/underscan bits.\n" |
| 199 |
" s-ce=<0-3>: set the CE Over/underscan bits.\n" |
| 200 |
"\n" |
| 201 |
" CTA-861 Colorimetry Data Block modifiers:\n" |
| 202 |
" xvycc-601: toggle the xvYCC 601 bit.\n" |
| 203 |
" xvycc-709: toggle the xvYCC 709 bit.\n" |
| 204 |
" sycc: toggle the sYCC 601 bit.\n" |
| 205 |
" opycc: toggle the opYCC 601 bit.\n" |
| 206 |
" oprgb: toggle the opRGB bit.\n" |
| 207 |
" bt2020-rgb: toggle the BT2020 RGB bit.\n" |
| 208 |
" bt2020-ycc: toggle the BT2020 YCC bit.\n" |
| 209 |
" bt2020-cycc: toggle the BT2020 cYCC bit.\n" |
| 210 |
" dci-p3: toggle the DCI-P3 bit.\n" |
| 211 |
"\n" |
| 212 |
" CTA-861 HDR Static Metadata Data Block modifiers:\n" |
| 213 |
" sdr: toggle the Traditional gamma SDR bit.\n" |
| 214 |
" hdr: toggle the Traditional gamma HDR bit.\n" |
| 215 |
" smpte2084: toggle the SMPTE ST 2084 bit.\n" |
| 216 |
" hlg: toggle the Hybrid Log-Gamma bit.\n" |
| 217 |
" --clear-edid <pad> clear the EDID for the input index <pad>.\n" |
| 218 |
" --info-edid <pad> print the current EDID's modifiers\n" |
| 219 |
" <pad> is the input or output index for which to get the EDID.\n" |
| 220 |
" --show-edid [type=<type>|file=<file>][,format=<fmt>][modifiers]\n" |
| 221 |
" Same as --set-edid, but only dumps the resulting EDID in hex\n" |
| 222 |
" instead of actually setting the EDID.\n" |
| 223 |
" --get-edid pad=<pad>,startblock=<startblock>,blocks=<blocks>,format=<fmt>,file=<file>\n" |
| 224 |
" <pad> is the input or output index for which to get the EDID.\n" |
| 225 |
" <startblock> is the first block number you want to read. Default 0.\n" |
| 226 |
" <blocks> is the number of blocks you want to read. Default is\n" |
| 227 |
" all blocks.\n" |
| 228 |
" <fmt> is one of:\n" |
| 229 |
" hex: hex numbers in ascii text (default)\n" |
| 230 |
" raw: can be piped directly into the edid-decode tool\n" |
| 231 |
" carray: c-program struct\n" |
| 232 |
" If <file> is '-' or not the 'file' argument is not supplied, then the data\n" |
| 233 |
" is written to stdout.\n" |
| 234 |
" --keep-edid-checksums\n" |
| 235 |
" If specified then any checksum errors will be kept.\n" |
| 236 |
); |
| 237 |
} |
| 238 |
|
| 239 |
static void edid_add_block(struct v4l2_edid *e) |
| 240 |
{ |
| 241 |
e->blocks++; |
| 242 |
if (e->blocks > 256) { |
| 243 |
fprintf(stderr, "edid file error: too long\n"); |
| 244 |
free(e->edid); |
| 245 |
e->edid = nullptr; |
| 246 |
std::exit(EXIT_FAILURE); |
| 247 |
} |
| 248 |
e->edid = static_cast<unsigned char *>(realloc(e->edid, e->blocks * 128)); |
| 249 |
} |
| 250 |
|
| 251 |
static void read_edid_file(FILE *f, struct v4l2_edid *e) |
| 252 |
{ |
| 253 |
static const char *ignore_chars = ",:;"; |
| 254 |
char value[3] = { 0 }; |
| 255 |
char buf[256]; |
| 256 |
unsigned i = 0; |
| 257 |
int c; |
| 258 |
|
| 259 |
fseek(f, SEEK_SET, 0); |
| 260 |
e->edid = nullptr; |
| 261 |
e->blocks = 0; |
| 262 |
|
| 263 |
/* |
| 264 |
* Skip the first line if it matches the edid-decode output. |
| 265 |
* After that first line the hex dump starts, and that's what we |
| 266 |
* want to use here. |
| 267 |
* |
| 268 |
* This makes it possible to use the edid-decode output as EDID |
| 269 |
* file. |
| 270 |
*/ |
| 271 |
if (fgets(buf, sizeof(buf), f) && |
| 272 |
!strstr(buf, "EDID (hex):") && |
| 273 |
!strstr(buf, "edid-decode (hex):")) |
| 274 |
fseek(f, SEEK_SET, 0); |
| 275 |
|
| 276 |
while ((c = fgetc(f)) != EOF) { |
| 277 |
if (sformat == RAW) { |
| 278 |
if (i % 256 == 0) |
| 279 |
edid_add_block(e); |
| 280 |
e->edid[i / 2] = c; |
| 281 |
i += 2; |
| 282 |
continue; |
| 283 |
} |
| 284 |
/* Handle '0x' prefix */ |
| 285 |
if ((i & 1) && value[0] == '0' && (c == 'x' || c == 'X')) |
| 286 |
i--; |
| 287 |
if (isspace(c) || strchr(ignore_chars, c)) |
| 288 |
continue; |
| 289 |
if (!isxdigit(c)) |
| 290 |
break; |
| 291 |
if (i & 0x01) { |
| 292 |
value[1] = c; |
| 293 |
if (i % 256 == 1) |
| 294 |
edid_add_block(e); |
| 295 |
e->edid[i / 2] = strtoul(value, nullptr, 16); |
| 296 |
} else { |
| 297 |
value[0] = c; |
| 298 |
} |
| 299 |
i++; |
| 300 |
} |
| 301 |
} |
| 302 |
|
| 303 |
static unsigned char crc_calc(const unsigned char *b) |
| 304 |
{ |
| 305 |
unsigned char sum = 0; |
| 306 |
int i; |
| 307 |
|
| 308 |
for (i = 0; i < 127; i++) |
| 309 |
sum += b[i]; |
| 310 |
return 256 - sum; |
| 311 |
} |
| 312 |
|
| 313 |
static bool crc_ok(const unsigned char *b) |
| 314 |
{ |
| 315 |
return crc_calc(b) == b[127]; |
| 316 |
} |
| 317 |
|
| 318 |
static void fix_edid(struct v4l2_edid *e) |
| 319 |
{ |
| 320 |
for (unsigned b = 0; b < e->blocks; b++) { |
| 321 |
unsigned char *buf = e->edid + 128 * b; |
| 322 |
|
| 323 |
if (!crc_ok(buf)) |
| 324 |
buf[127] = crc_calc(buf); |
| 325 |
} |
| 326 |
} |
| 327 |
|
| 328 |
static void hexdumpedid(FILE *f, struct v4l2_edid *e) |
| 329 |
{ |
| 330 |
for (unsigned b = 0; b < e->blocks; b++) { |
| 331 |
unsigned char *buf = e->edid + 128 * b; |
| 332 |
|
| 333 |
if (b) |
| 334 |
fprintf(f, "\n"); |
| 335 |
for (unsigned i = 0; i < 128; i += 0x10) { |
| 336 |
fprintf(f, "%02x", buf[i]); |
| 337 |
for (unsigned j = 1; j < 0x10; j++) { |
| 338 |
fprintf(f, " %02x", buf[i + j]); |
| 339 |
} |
| 340 |
fprintf(f, "\n"); |
| 341 |
} |
| 342 |
if (!crc_ok(buf)) |
| 343 |
fprintf(stderr, "Block %u has a checksum error (should be 0x%02x)\n", |
| 344 |
b, crc_calc(buf)); |
| 345 |
} |
| 346 |
} |
| 347 |
|
| 348 |
static void rawdumpedid(FILE *f, struct v4l2_edid *e) |
| 349 |
{ |
| 350 |
for (unsigned b = 0; b < e->blocks; b++) { |
| 351 |
unsigned char *buf = e->edid + 128 * b; |
| 352 |
|
| 353 |
for (unsigned i = 0; i < 128; i++) |
| 354 |
fprintf(f, "%c", buf[i]); |
| 355 |
if (!crc_ok(buf)) |
| 356 |
fprintf(stderr, "Block %u has a checksum error (should be %02x)\n", |
| 357 |
b, crc_calc(buf)); |
| 358 |
} |
| 359 |
} |
| 360 |
|
| 361 |
static void carraydumpedid(FILE *f, struct v4l2_edid *e) |
| 362 |
{ |
| 363 |
fprintf(f, "unsigned char edid[] = {\n"); |
| 364 |
for (unsigned b = 0; b < e->blocks; b++) { |
| 365 |
unsigned char *buf = e->edid + 128 * b; |
| 366 |
|
| 367 |
if (b) |
| 368 |
fprintf(f, "\n"); |
| 369 |
for (unsigned i = 0; i < 128; i += 8) { |
| 370 |
fprintf(f, "\t0x%02x,", buf[i]); |
| 371 |
for (unsigned j = 1; j < 8; j++) { |
| 372 |
fprintf(f, " 0x%02x,", buf[i + j]); |
| 373 |
} |
| 374 |
fprintf(f, "\n"); |
| 375 |
} |
| 376 |
if (!crc_ok(buf)) |
| 377 |
fprintf(stderr, "Block %u has a checksum error (should be 0x%02x)\n", |
| 378 |
b, crc_calc(buf)); |
| 379 |
} |
| 380 |
fprintf(f, "};\n"); |
| 381 |
} |
| 382 |
|
| 383 |
static void printedid(FILE *f, struct v4l2_edid *e, enum format gf) |
| 384 |
{ |
| 385 |
switch (gf) { |
| 386 |
default: |
| 387 |
case HEX: |
| 388 |
hexdumpedid(f, e); |
| 389 |
break; |
| 390 |
case RAW: |
| 391 |
rawdumpedid(f, e); |
| 392 |
break; |
| 393 |
case CARRAY: |
| 394 |
carraydumpedid(f, e); |
| 395 |
break; |
| 396 |
} |
| 397 |
} |
| 398 |
|
| 399 |
static unsigned find_cta_offset(const unsigned char *edid, unsigned size) |
| 400 |
{ |
| 401 |
for (unsigned i = 1; i < size / 128; i++) |
| 402 |
if (edid[i * 128] == 0x02) |
| 403 |
return i * 128; |
| 404 |
return 0; |
| 405 |
} |
| 406 |
|
| 407 |
static int get_edid_tag_location(const unsigned char *edid, unsigned size, |
| 408 |
unsigned char want_tag, __u32 ext_tag) |
| 409 |
{ |
| 410 |
unsigned offset = find_cta_offset(edid, size); |
| 411 |
unsigned char d; |
| 412 |
|
| 413 |
if (!offset) |
| 414 |
return -1; |
| 415 |
edid += offset; |
| 416 |
|
| 417 |
/* search tag */ |
| 418 |
d = edid[0x02] & 0x7f; |
| 419 |
if (d <= 4) |
| 420 |
return -1; |
| 421 |
|
| 422 |
int i = 0x04; |
| 423 |
int end = 0x00 + d; |
| 424 |
|
| 425 |
do { |
| 426 |
unsigned char tag = edid[i] >> 5; |
| 427 |
unsigned char len = edid[i] & 0x1f; |
| 428 |
|
| 429 |
if (tag != want_tag || i + len > end) { |
| 430 |
i += len + 1; |
| 431 |
continue; |
| 432 |
} |
| 433 |
|
| 434 |
/* |
| 435 |
* Tag 3 (Vendor-Specific Data Block) has |
| 436 |
* a 24 bit IEEE identifier. |
| 437 |
*/ |
| 438 |
if (tag == VSDB_TAG && len >= 3 && |
| 439 |
edid[i + 1] == (ext_tag & 0xff) && |
| 440 |
edid[i + 2] == ((ext_tag >> 8) & 0xff) && |
| 441 |
edid[i + 3] == ((ext_tag >> 16) & 0xff)) |
| 442 |
return offset + i; |
| 443 |
/* |
| 444 |
* Tag 7 has an extended tag, others (0-2, 4-6) |
| 445 |
* have no identifiers. |
| 446 |
*/ |
| 447 |
if ((tag < EXTENDED_TAG && tag != VSDB_TAG) || |
| 448 |
(tag == EXTENDED_TAG && len >= 1 && edid[i + 1] == ext_tag)) |
| 449 |
return offset + i; |
| 450 |
i += len + 1; |
| 451 |
} while (i < end); |
| 452 |
return -1; |
| 453 |
} |
| 454 |
|
| 455 |
static int get_edid_cta861_hdr_location(const unsigned char *edid, unsigned size) |
| 456 |
{ |
| 457 |
unsigned offset = find_cta_offset(edid, size); |
| 458 |
|
| 459 |
return offset ? offset + 3 : -1; |
| 460 |
} |
| 461 |
|
| 462 |
static int get_edid_spa_location(const unsigned char *edid, unsigned size) |
| 463 |
{ |
| 464 |
int loc = get_edid_tag_location(edid, size, VSDB_TAG, HDMI_VSDB_EXT_TAG); |
| 465 |
|
| 466 |
if (loc < 0) |
| 467 |
return loc; |
| 468 |
|
| 469 |
return (edid[loc] & 0x1f) >= 5 ? loc + 4 : -1; |
| 470 |
} |
| 471 |
|
| 472 |
static int get_edid_hdmi_vsdb_location(const unsigned char *edid, unsigned size) |
| 473 |
{ |
| 474 |
int loc = get_edid_tag_location(edid, size, VSDB_TAG, HDMI_VSDB_EXT_TAG); |
| 475 |
|
| 476 |
if (loc < 0) |
| 477 |
return loc; |
| 478 |
|
| 479 |
return (edid[loc] & 0x1f) >= 5 ? loc : -1; |
| 480 |
} |
| 481 |
|
| 482 |
static int get_edid_hf_vsdb_location(const unsigned char *edid, unsigned size) |
| 483 |
{ |
| 484 |
int loc = get_edid_tag_location(edid, size, VSDB_TAG, HF_VSDB_EXT_TAG); |
| 485 |
|
| 486 |
if (loc < 0) |
| 487 |
return loc; |
| 488 |
|
| 489 |
return (edid[loc] & 0x1f) >= 6 ? loc + 5 : -1; |
| 490 |
} |
| 491 |
|
| 492 |
static int get_edid_speaker_location(const unsigned char *edid, unsigned size) |
| 493 |
{ |
| 494 |
int loc = get_edid_tag_location(edid, size, SPEAKER_TAG, 0); |
| 495 |
|
| 496 |
if (loc < 0) |
| 497 |
return loc; |
| 498 |
|
| 499 |
return (edid[loc] & 0x1f) >= 3 ? loc + 1 : -1; |
| 500 |
} |
| 501 |
|
| 502 |
static int get_edid_vid_cap_location(const unsigned char *edid, unsigned size) |
| 503 |
{ |
| 504 |
int loc = get_edid_tag_location(edid, size, EXTENDED_TAG, VID_CAP_EXT_TAG); |
| 505 |
|
| 506 |
if (loc < 0) |
| 507 |
return loc; |
| 508 |
|
| 509 |
return (edid[loc] & 0x1f) >= 2 ? loc + 2 : -1; |
| 510 |
} |
| 511 |
|
| 512 |
static int get_edid_colorimetry_location(const unsigned char *edid, unsigned size) |
| 513 |
{ |
| 514 |
int loc = get_edid_tag_location(edid, size, EXTENDED_TAG, COLORIMETRY_EXT_TAG); |
| 515 |
|
| 516 |
if (loc < 0) |
| 517 |
return loc; |
| 518 |
|
| 519 |
return (edid[loc] & 0x1f) >= 3 ? loc + 2 : -1; |
| 520 |
} |
| 521 |
|
| 522 |
static int get_edid_hdr_md_location(const unsigned char *edid, unsigned size) |
| 523 |
{ |
| 524 |
int loc = get_edid_tag_location(edid, size, EXTENDED_TAG, HDR_MD_EXT_TAG); |
| 525 |
|
| 526 |
if (loc < 0) |
| 527 |
return loc; |
| 528 |
|
| 529 |
return (edid[loc] & 0x1f) >= 3 ? loc + 2 : -1; |
| 530 |
} |
| 531 |
|
| 532 |
static void set_edid_phys_addr(unsigned char *edid, unsigned size, unsigned short phys_addr) |
| 533 |
{ |
| 534 |
int loc = get_edid_spa_location(edid, size); |
| 535 |
unsigned char sum = 0; |
| 536 |
int i; |
| 537 |
|
| 538 |
if (loc < 0) |
| 539 |
return; |
| 540 |
edid[loc] = phys_addr >> 8; |
| 541 |
edid[loc + 1] = phys_addr & 0xff; |
| 542 |
loc &= ~0x7f; |
| 543 |
|
| 544 |
for (i = loc; i < loc + 127; i++) |
| 545 |
sum += edid[i]; |
| 546 |
edid[i] = 256 - sum; |
| 547 |
} |
| 548 |
|
| 549 |
static unsigned short get_edid_phys_addr(const unsigned char *edid, unsigned size) |
| 550 |
{ |
| 551 |
int loc = get_edid_spa_location(edid, size); |
| 552 |
|
| 553 |
if (loc < 0) |
| 554 |
return 0xffff; |
| 555 |
return (edid[loc] << 8) | edid[loc + 1]; |
| 556 |
} |
| 557 |
|
| 558 |
static void print_edid_mods(const struct v4l2_edid *e) |
| 559 |
{ |
| 560 |
unsigned short pa = get_edid_phys_addr(e->edid, e->blocks * 128); |
| 561 |
int loc; |
| 562 |
|
| 563 |
loc = get_edid_cta861_hdr_location(e->edid, e->blocks * 128); |
| 564 |
if (loc >= 0) { |
| 565 |
__u8 v = e->edid[loc]; |
| 566 |
|
| 567 |
printf("\nCTA-861 Header\n"); |
| 568 |
printf(" IT Formats Underscanned: %s\n", (v & CTA861_HDR_UNDERSCAN) ? "yes" : "no"); |
| 569 |
printf(" Audio: %s\n", (v & CTA861_HDR_AUDIO) ? "yes" : "no"); |
| 570 |
printf(" YCbCr 4:4:4: %s\n", (v & CTA861_HDR_YCBCR444) ? "yes" : "no"); |
| 571 |
printf(" YCbCr 4:2:2: %s\n", (v & CTA861_HDR_YCBCR422) ? "yes" : "no"); |
| 572 |
} |
| 573 |
loc = get_edid_speaker_location(e->edid, e->blocks * 128); |
| 574 |
if (loc >= 0) { |
| 575 |
__u8 v = e->edid[loc]; |
| 576 |
|
| 577 |
printf("\nSpeaker Allocation Data Block\n"); |
| 578 |
printf(" FL/FR: %s\n", (v & SPEAKER1_FL_FR) ? "yes" : "no"); |
| 579 |
printf(" LFE: %s\n", (v & SPEAKER1_LFE) ? "yes" : "no"); |
| 580 |
printf(" FC: %s\n", (v & SPEAKER1_FC) ? "yes" : "no"); |
| 581 |
printf(" BL/BR: %s\n", (v & SPEAKER1_BL_BR) ? "yes" : "no"); |
| 582 |
printf(" BC: %s\n", (v & SPEAKER1_BC) ? "yes" : "no"); |
| 583 |
printf(" FLC/FRC: %s\n", (v & SPEAKER1_FLC_FRC) ? "yes" : "no"); |
| 584 |
printf(" RLC/RRC: %s\n", (v & SPEAKER1_RLC_RRC) ? "yes" : "no"); |
| 585 |
printf(" FLW/FRW: %s\n", (v & SPEAKER1_FLW_FRW) ? "yes" : "no"); |
| 586 |
|
| 587 |
v = e->edid[loc + 1]; |
| 588 |
printf(" TpFL/TpFR: %s\n", (v & SPEAKER2_TPFL_TPFR) ? "yes" : "no"); |
| 589 |
printf(" TpC: %s\n", (v & SPEAKER2_TPC) ? "yes" : "no"); |
| 590 |
printf(" TpFC: %s\n", (v & SPEAKER2_TPFC) ? "yes" : "no"); |
| 591 |
printf(" LS/RS: %s\n", (v & SPEAKER2_LS_RS) ? "yes" : "no"); |
| 592 |
printf(" LFE2: %s\n", (v & SPEAKER2_LFE2) ? "yes" : "no"); |
| 593 |
printf(" TpBC: %s\n", (v & SPEAKER2_TPBC) ? "yes" : "no"); |
| 594 |
printf(" SiL/SiR: %s\n", (v & SPEAKER2_SIL_SIR) ? "yes" : "no"); |
| 595 |
printf(" TpSiL/TpSiR: %s\n", (v & SPEAKER2_TPSIL_TPSIR) ? "yes" : "no"); |
| 596 |
|
| 597 |
v = e->edid[loc + 2]; |
| 598 |
printf(" TpBL/TpBR: %s\n", (v & SPEAKER3_TPBL_TPBR) ? "yes" : "no"); |
| 599 |
printf(" BtFC: %s\n", (v & SPEAKER3_BTFC) ? "yes" : "no"); |
| 600 |
printf(" BtLS/BtRS: %s\n", (v & SPEAKER3_BTFL_BTFR) ? "yes" : "no"); |
| 601 |
printf(" TpLS/TpRS: %s\n", (v & SPEAKER3_TPLS_TPRS) ? "yes" : "no"); |
| 602 |
} |
| 603 |
loc = get_edid_hdmi_vsdb_location(e->edid, e->blocks * 128); |
| 604 |
if (loc >= 0) { |
| 605 |
__u8 len = e->edid[loc] & 0x1f; |
| 606 |
__u8 v = len >= 7 ? e->edid[loc + 7] : 0; |
| 607 |
|
| 608 |
printf("\nHDMI Vendor-Specific Data Block\n"); |
| 609 |
if (v) |
| 610 |
printf(" Max TMDS Clock: %u MHz\n", v * 5); |
| 611 |
printf(" Physical Address: %x.%x.%x.%x\n", |
| 612 |
pa >> 12, (pa >> 8) & 0xf, (pa >> 4) & 0xf, pa & 0xf); |
| 613 |
if (len >= 6) { |
| 614 |
v = e->edid[loc + 6]; |
| 615 |
printf(" YCbCr 4:4:4 Deep Color: %s\n", (v & HDMI_VSDB_Y444_BIT) ? "yes" : "no"); |
| 616 |
printf(" 30-bit: %s\n", (v & HDMI_VSDB_30_BIT) ? "yes" : "no"); |
| 617 |
printf(" 36-bit: %s\n", (v & HDMI_VSDB_36_BIT) ? "yes" : "no"); |
| 618 |
printf(" 48-bit: %s\n", (v & HDMI_VSDB_48_BIT) ? "yes" : "no"); |
| 619 |
} |
| 620 |
if (len >= 8) { |
| 621 |
v = e->edid[loc + 8]; |
| 622 |
printf(" Graphics: %s\n", (v & HDMI_VSDB_GRAPHICS) ? "yes" : "no"); |
| 623 |
printf(" Photo: %s\n", (v & HDMI_VSDB_PHOTO) ? "yes" : "no"); |
| 624 |
printf(" Cinema: %s\n", (v & HDMI_VSDB_CINEMA) ? "yes" : "no"); |
| 625 |
printf(" Game: %s\n", (v & HDMI_VSDB_GAME) ? "yes" : "no"); |
| 626 |
if ((v & HDMI_VSDB_LATENCY) && len >= 10) { |
| 627 |
__u8 lat = e->edid[loc + 9]; |
| 628 |
if (lat == 255) |
| 629 |
printf(" Video Latency: unsupported\n"); |
| 630 |
else if (lat > 0) |
| 631 |
printf(" Video Latency: %u.%ums\n", |
| 632 |
(lat - 1) / 2, ((lat - 1) & 1) ? 0 : 5); |
| 633 |
lat = e->edid[loc + 10]; |
| 634 |
if (lat == 255) |
| 635 |
printf(" Audio Latency: unsupported\n"); |
| 636 |
else if (lat > 0) |
| 637 |
printf(" Audio Latency: %u.%ums\n", |
| 638 |
(lat - 1) / 2, ((lat - 1) & 1) ? 0 : 5); |
| 639 |
} |
| 640 |
if ((v & HDMI_VSDB_I_LATENCY) && len >= 12) { |
| 641 |
__u8 lat = e->edid[loc + 11]; |
| 642 |
if (lat == 255) |
| 643 |
printf(" IL Video Latency: unsupported\n"); |
| 644 |
else if (lat > 0) |
| 645 |
printf(" IL Video Latency: %u.%ums\n", |
| 646 |
(lat - 1) / 2, ((lat - 1) & 1) ? 0 : 5); |
| 647 |
lat = e->edid[loc + 12]; |
| 648 |
if (lat == 255) |
| 649 |
printf(" IL Audio Latency: unsupported\n"); |
| 650 |
else if (lat > 0) |
| 651 |
printf(" IL Audio Latency: %u.%ums\n", |
| 652 |
(lat - 1) / 2, ((lat - 1) & 1) ? 0 : 5); |
| 653 |
} |
| 654 |
} |
| 655 |
} |
| 656 |
loc = get_edid_hf_vsdb_location(e->edid, e->blocks * 128); |
| 657 |
if (loc >= 0) { |
| 658 |
__u8 v = e->edid[loc]; |
| 659 |
|
| 660 |
printf("\nHDMI Forum Vendor-Specific Data Block\n"); |
| 661 |
if (v) |
| 662 |
printf(" Max TMDS Character Rate: %u MHz\n", v * 5); |
| 663 |
v = e->edid[loc + 1]; |
| 664 |
printf(" SCDC Present: %s\n", (v & HF_VSDB_SCDC_PRESENT) ? "yes" : "no"); |
| 665 |
printf(" Cable Status: %s\n", (v & HF_VSDB_CABLE_STATUS) ? "yes" : "no"); |
| 666 |
} |
| 667 |
loc = get_edid_vid_cap_location(e->edid, e->blocks * 128); |
| 668 |
if (loc >= 0) { |
| 669 |
static constexpr const char *pt_scan[] = { |
| 670 |
"No Data", |
| 671 |
"Always Overscanned", |
| 672 |
"Always Underscanned", |
| 673 |
"Supports both over- and underscan" |
| 674 |
}; |
| 675 |
static constexpr const char *it_scan[] = { |
| 676 |
"IT Formats not supported", |
| 677 |
"Always Overscanned", |
| 678 |
"Always Underscanned", |
| 679 |
"Supports both over- and underscan" |
| 680 |
}; |
| 681 |
static constexpr const char *ce_scan[] = { |
| 682 |
"CE Formats not supported", |
| 683 |
"Always Overscanned", |
| 684 |
"Always Underscanned", |
| 685 |
"Supports both over- and underscan" |
| 686 |
}; |
| 687 |
__u8 v = e->edid[loc]; |
| 688 |
|
| 689 |
printf("\nCTA-861 Video Capability Descriptor\n"); |
| 690 |
printf(" RGB Quantization Range: %s\n", (v & VID_CAP_QS) ? "yes" : "no"); |
| 691 |
printf(" YCC Quantization Range: %s\n", (v & VID_CAP_QY) ? "yes" : "no"); |
| 692 |
printf(" PT: %s\n", pt_scan[(v >> 4) & 3]); |
| 693 |
printf(" IT: %s\n", it_scan[(v >> 2) & 3]); |
| 694 |
printf(" CE: %s\n", ce_scan[(v >> 0) & 3]); |
| 695 |
} |
| 696 |
loc = get_edid_colorimetry_location(e->edid, e->blocks * 128); |
| 697 |
if (loc >= 0) { |
| 698 |
__u8 v1 = e->edid[loc]; |
| 699 |
__u8 v2 = e->edid[loc + 1]; |
| 700 |
|
| 701 |
printf("\nCTA-861 Colorimetry Data Block\n"); |
| 702 |
printf(" xvYCC 601: %s\n", (v1 & COLORIMETRY_XVYCC601) ? "yes" : "no"); |
| 703 |
printf(" xvYCC 709: %s\n", (v1 & COLORIMETRY_XVYCC709) ? "yes" : "no"); |
| 704 |
printf(" sYCC: %s\n", (v1 & COLORIMETRY_SYCC) ? "yes" : "no"); |
| 705 |
printf(" opRGB: %s\n", (v1 & COLORIMETRY_OPRGB) ? "yes" : "no"); |
| 706 |
printf(" opYCC: %s\n", (v1 & COLORIMETRY_OPYCC) ? "yes" : "no"); |
| 707 |
printf(" BT.2020 RGB: %s\n", (v1 & COLORIMETRY_BT2020RGB) ? "yes" : "no"); |
| 708 |
printf(" BT.2020 YCC: %s\n", (v1 & COLORIMETRY_BT2020YCC) ? "yes" : "no"); |
| 709 |
printf(" BT.2020 cYCC: %s\n", (v1 & COLORIMETRY_BT2020CYCC) ? "yes" : "no"); |
| 710 |
printf(" DCI-P3: %s\n", (v2 & COLORIMETRY_DCIP3) ? "yes" : "no"); |
| 711 |
} |
| 712 |
loc = get_edid_hdr_md_location(e->edid, e->blocks * 128); |
| 713 |
if (loc >= 0) { |
| 714 |
__u8 v = e->edid[loc]; |
| 715 |
|
| 716 |
printf("\nCTA-861 HDR Static Metadata Data Block\n"); |
| 717 |
printf(" SDR (Traditional Gamma): %s\n", (v & HDR_MD_SDR) ? "yes" : "no"); |
| 718 |
printf(" HDR (Traditional Gamma): %s\n", (v & HDR_MD_HDR) ? "yes" : "no"); |
| 719 |
printf(" SMPTE 2084: %s\n", (v & HDR_MD_SMPTE_2084) ? "yes" : "no"); |
| 720 |
printf(" Hybrid Log-Gamma: %s\n", (v & HDR_MD_HLG) ? "yes" : "no"); |
| 721 |
} |
| 722 |
} |
| 723 |
|
| 724 |
static unsigned short parse_phys_addr(const char *value) |
| 725 |
{ |
| 726 |
unsigned p1, p2, p3, p4; |
| 727 |
|
| 728 |
if (!std::strchr(value, '.')) |
| 729 |
return strtoul(value, nullptr, 0); |
| 730 |
if (sscanf(value, "%x.%x.%x.%x", &p1, &p2, &p3, &p4) != 4) { |
| 731 |
fprintf(stderr, "Expected a physical address of the form x.x.x.x\n"); |
| 732 |
return 0xffff; |
| 733 |
} |
| 734 |
if (p1 > 0xf || p2 > 0xf || p3 > 0xf || p4 > 0xf) { |
| 735 |
fprintf(stderr, "Physical address components should never be larger than 0xf\n"); |
| 736 |
return 0xffff; |
| 737 |
} |
| 738 |
return (p1 << 12) | (p2 << 8) | (p3 << 4) | p4; |
| 739 |
} |
| 740 |
|
| 741 |
/****************** EDIDs *****************************/ |
| 742 |
static uint8_t vga_edid[128] = { |
| 743 |
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, |
| 744 |
0x31, 0xd8, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, |
| 745 |
0x22, 0x1a, 0x01, 0x04, 0x08, 0x30, 0x1e, 0x78, |
| 746 |
0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, |
| 747 |
0x0f, 0x50, 0x54, 0x2f, 0xcf, 0x00, 0x31, 0x59, |
| 748 |
0x45, 0x59, 0x61, 0x59, 0x81, 0x40, 0x81, 0x80, |
| 749 |
0x95, 0x00, 0xa9, 0x40, 0xb3, 0x00, 0x28, 0x3c, |
| 750 |
0x80, 0xa0, 0x70, 0xb0, 0x23, 0x40, 0x30, 0x20, |
| 751 |
0x36, 0x00, 0xe0, 0x2c, 0x11, 0x00, 0x00, 0x1a, |
| 752 |
0x00, 0x00, 0x00, 0xfd, 0x00, 0x31, 0x55, 0x18, |
| 753 |
0x5e, 0x11, 0x04, 0x12, 0x00, 0xf0, 0xf8, 0x58, |
| 754 |
0xf0, 0x3c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x76, |
| 755 |
0x67, 0x61, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, |
| 756 |
0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x10, |
| 757 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 758 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, |
| 759 |
}; |
| 760 |
|
| 761 |
static uint8_t dvid_edid[128] = { |
| 762 |
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, |
| 763 |
0x31, 0xd8, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, |
| 764 |
0x22, 0x1a, 0x01, 0x04, 0xa1, 0x30, 0x1e, 0x78, |
| 765 |
0x07, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, |
| 766 |
0x0f, 0x50, 0x54, 0x2f, 0xcf, 0x00, 0x31, 0x59, |
| 767 |
0x45, 0x59, 0x81, 0x80, 0x81, 0x40, 0x90, 0x40, |
| 768 |
0x95, 0x00, 0xa9, 0x40, 0xb3, 0x00, 0x28, 0x3c, |
| 769 |
0x80, 0xa0, 0x70, 0xb0, 0x23, 0x40, 0x30, 0x20, |
| 770 |
0x36, 0x00, 0xe0, 0x2c, 0x11, 0x00, 0x00, 0x1a, |
| 771 |
0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x55, 0x18, |
| 772 |
0x5e, 0x11, 0x04, 0x12, 0x00, 0xf0, 0xf8, 0x58, |
| 773 |
0xf0, 0x3c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x64, |
| 774 |
0x76, 0x69, 0x2d, 0x64, 0x0a, 0x20, 0x20, 0x20, |
| 775 |
0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x10, |
| 776 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 777 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xea, |
| 778 |
}; |
| 779 |
|
| 780 |
static uint8_t hdmi_edid[256] = { |
| 781 |
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, |
| 782 |
0x31, 0xd8, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, |
| 783 |
0x22, 0x1a, 0x01, 0x03, 0x80, 0x30, 0x1b, 0x78, |
| 784 |
0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, |
| 785 |
0x0f, 0x50, 0x54, 0x2f, 0xcf, 0x00, 0x31, 0x59, |
| 786 |
0x45, 0x59, 0x81, 0x80, 0x81, 0x40, 0x90, 0x40, |
| 787 |
0x95, 0x00, 0xa9, 0x40, 0xb3, 0x00, 0x02, 0x3a, |
| 788 |
0x80, 0x18, 0x71, 0x38, 0x2d, 0x40, 0x58, 0x2c, |
| 789 |
0x45, 0x00, 0xe0, 0x0e, 0x11, 0x00, 0x00, 0x1e, |
| 790 |
0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x55, 0x18, |
| 791 |
0x5e, 0x11, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, |
| 792 |
0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x68, |
| 793 |
0x64, 0x6d, 0x69, 0x0a, 0x20, 0x20, 0x20, 0x20, |
| 794 |
0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x10, |
| 795 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 796 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc4, |
| 797 |
|
| 798 |
0x02, 0x03, 0x30, 0xf1, 0x4c, 0x10, 0x1f, 0x04, |
| 799 |
0x13, 0x22, 0x21, 0x20, 0x05, 0x14, 0x02, 0x11, |
| 800 |
0x01, 0x23, 0x09, 0x07, 0x07, 0x83, 0x01, 0x00, |
| 801 |
0x00, 0x68, 0x03, 0x0c, 0x00, 0x10, 0x00, 0x00, |
| 802 |
0x22, 0x01, 0xe2, 0x00, 0xca, 0xe3, 0x05, 0x00, |
| 803 |
0x00, 0xe3, 0x06, 0x01, 0x00, 0xe2, 0x0d, 0x10, |
| 804 |
0x1a, 0x36, 0x80, 0xa0, 0x70, 0x38, 0x1f, 0x40, |
| 805 |
0x30, 0x20, 0x35, 0x00, 0xe0, 0x0e, 0x11, 0x00, |
| 806 |
0x00, 0x1a, 0x1a, 0x1d, 0x00, 0x80, 0x51, 0xd0, |
| 807 |
0x1c, 0x20, 0x40, 0x80, 0x35, 0x00, 0xe0, 0x0e, |
| 808 |
0x11, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, |
| 809 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 810 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 811 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 812 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 813 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, |
| 814 |
}; |
| 815 |
|
| 816 |
static uint8_t hdmi_edid_4k_170[256] = { |
| 817 |
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, |
| 818 |
0x31, 0xd8, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, |
| 819 |
0x22, 0x1a, 0x01, 0x03, 0x80, 0x60, 0x36, 0x78, |
| 820 |
0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, |
| 821 |
0x0f, 0x50, 0x54, 0x2f, 0xcf, 0x00, 0x31, 0x59, |
| 822 |
0x45, 0x59, 0x81, 0x80, 0x81, 0x40, 0x90, 0x40, |
| 823 |
0x95, 0x00, 0xa9, 0x40, 0xb3, 0x00, 0x02, 0x3a, |
| 824 |
0x80, 0x18, 0x71, 0x38, 0x2d, 0x40, 0x58, 0x2c, |
| 825 |
0x45, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1e, |
| 826 |
0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x55, 0x18, |
| 827 |
0x5e, 0x11, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, |
| 828 |
0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x68, |
| 829 |
0x64, 0x6d, 0x69, 0x2d, 0x34, 0x6b, 0x2d, 0x31, |
| 830 |
0x37, 0x30, 0x0a, 0x20, 0x00, 0x00, 0x00, 0x10, |
| 831 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 832 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb9, |
| 833 |
|
| 834 |
0x02, 0x03, 0x36, 0xf1, 0x4c, 0x10, 0x1f, 0x04, |
| 835 |
0x13, 0x22, 0x21, 0x20, 0x05, 0x14, 0x02, 0x11, |
| 836 |
0x01, 0x23, 0x09, 0x07, 0x07, 0x83, 0x01, 0x00, |
| 837 |
0x00, 0x68, 0x03, 0x0c, 0x00, 0x10, 0x00, 0x00, |
| 838 |
0x22, 0x01, 0xe2, 0x00, 0xca, 0xe4, 0x0e, 0x5f, |
| 839 |
0x5e, 0x5d, 0xe3, 0x05, 0x00, 0x00, 0xe3, 0x06, |
| 840 |
0x01, 0x00, 0xe3, 0x0d, 0x10, 0x5f, 0x1a, 0x36, |
| 841 |
0x80, 0xa0, 0x70, 0x38, 0x1f, 0x40, 0x30, 0x20, |
| 842 |
0x35, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1a, |
| 843 |
0x1a, 0x1d, 0x00, 0x80, 0x51, 0xd0, 0x1c, 0x20, |
| 844 |
0x40, 0x80, 0x35, 0x00, 0xc0, 0x1c, 0x32, 0x00, |
| 845 |
0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 846 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 847 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 848 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 849 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, |
| 850 |
}; |
| 851 |
|
| 852 |
static uint8_t hdmi_edid_4k_300[256] = { |
| 853 |
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, |
| 854 |
0x31, 0xd8, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, |
| 855 |
0x22, 0x1a, 0x01, 0x03, 0x80, 0x60, 0x36, 0x78, |
| 856 |
0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, |
| 857 |
0x0f, 0x50, 0x54, 0x2f, 0xcf, 0x00, 0x31, 0x59, |
| 858 |
0x45, 0x59, 0x81, 0x80, 0x81, 0x40, 0x90, 0x40, |
| 859 |
0x95, 0x00, 0xa9, 0x40, 0xb3, 0x00, 0x04, 0x74, |
| 860 |
0x00, 0x30, 0xf2, 0x70, 0x5a, 0x80, 0xb0, 0x58, |
| 861 |
0x8a, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1e, |
| 862 |
0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x55, 0x18, |
| 863 |
0x87, 0x1e, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, |
| 864 |
0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x68, |
| 865 |
0x64, 0x6d, 0x69, 0x2d, 0x34, 0x6b, 0x2d, 0x33, |
| 866 |
0x30, 0x30, 0x0a, 0x20, 0x00, 0x00, 0x00, 0x10, |
| 867 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 868 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc5, |
| 869 |
|
| 870 |
0x02, 0x03, 0x40, 0xf1, 0x4f, 0x5f, 0x5e, 0x5d, |
| 871 |
0x10, 0x1f, 0x04, 0x13, 0x22, 0x21, 0x20, 0x05, |
| 872 |
0x14, 0x02, 0x11, 0x01, 0x23, 0x09, 0x07, 0x07, |
| 873 |
0x83, 0x01, 0x00, 0x00, 0x6d, 0x03, 0x0c, 0x00, |
| 874 |
0x10, 0x00, 0x00, 0x3c, 0x21, 0x00, 0x60, 0x01, |
| 875 |
0x02, 0x03, 0x67, 0xd8, 0x5d, 0xc4, 0x01, 0x00, |
| 876 |
0x00, 0x00, 0xe2, 0x00, 0xca, 0xe3, 0x05, 0x00, |
| 877 |
0x00, 0xe3, 0x06, 0x01, 0x00, 0xe2, 0x0d, 0x5f, |
| 878 |
0xa3, 0x66, 0x00, 0xa0, 0xf0, 0x70, 0x1f, 0x80, |
| 879 |
0x30, 0x20, 0x35, 0x00, 0xc0, 0x1c, 0x32, 0x00, |
| 880 |
0x00, 0x1e, 0x1a, 0x36, 0x80, 0xa0, 0x70, 0x38, |
| 881 |
0x1f, 0x40, 0x30, 0x20, 0x35, 0x00, 0xc0, 0x1c, |
| 882 |
0x32, 0x00, 0x00, 0x1a, 0x1a, 0x1d, 0x00, 0x80, |
| 883 |
0x51, 0xd0, 0x1c, 0x20, 0x40, 0x80, 0x35, 0x00, |
| 884 |
0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1c, 0x00, 0x00, |
| 885 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa1, |
| 886 |
}; |
| 887 |
|
| 888 |
static uint8_t hdmi_edid_4k_600[256] = { |
| 889 |
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, |
| 890 |
0x31, 0xd8, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, |
| 891 |
0x22, 0x1a, 0x01, 0x03, 0x80, 0x60, 0x36, 0x78, |
| 892 |
0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, |
| 893 |
0x0f, 0x50, 0x54, 0x2f, 0xcf, 0x00, 0x31, 0x59, |
| 894 |
0x45, 0x59, 0x81, 0x80, 0x81, 0x40, 0x90, 0x40, |
| 895 |
0x95, 0x00, 0xa9, 0x40, 0xb3, 0x00, 0x08, 0xe8, |
| 896 |
0x00, 0x30, 0xf2, 0x70, 0x5a, 0x80, 0xb0, 0x58, |
| 897 |
0x8a, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1e, |
| 898 |
0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x55, 0x18, |
| 899 |
0x87, 0x3c, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, |
| 900 |
0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x68, |
| 901 |
0x64, 0x6d, 0x69, 0x2d, 0x34, 0x6b, 0x2d, 0x36, |
| 902 |
0x30, 0x30, 0x0a, 0x20, 0x00, 0x00, 0x00, 0x10, |
| 903 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 904 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x2c, |
| 905 |
|
| 906 |
0x02, 0x03, 0x42, 0xf1, 0x51, 0x61, 0x60, 0x5f, |
| 907 |
0x5e, 0x5d, 0x10, 0x1f, 0x04, 0x13, 0x22, 0x21, |
| 908 |
0x20, 0x05, 0x14, 0x02, 0x11, 0x01, 0x23, 0x09, |
| 909 |
0x07, 0x07, 0x83, 0x01, 0x00, 0x00, 0x6d, 0x03, |
| 910 |
0x0c, 0x00, 0x10, 0x00, 0x00, 0x3c, 0x21, 0x00, |
| 911 |
0x60, 0x01, 0x02, 0x03, 0x67, 0xd8, 0x5d, 0xc4, |
| 912 |
0x01, 0x78, 0x80, 0x08, 0xe2, 0x00, 0xca, 0xe3, |
| 913 |
0x05, 0x00, 0x00, 0xe3, 0x06, 0x01, 0x00, 0xe2, |
| 914 |
0x0d, 0x61, 0x4d, 0xd0, 0x00, 0xa0, 0xf0, 0x70, |
| 915 |
0x3e, 0x80, 0x30, 0x20, 0x35, 0x00, 0xc0, 0x1c, |
| 916 |
0x32, 0x00, 0x00, 0x1e, 0x1a, 0x36, 0x80, 0xa0, |
| 917 |
0x70, 0x38, 0x1f, 0x40, 0x30, 0x20, 0x35, 0x00, |
| 918 |
0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1a, 0x1a, 0x1d, |
| 919 |
0x00, 0x80, 0x51, 0xd0, 0x1c, 0x20, 0x40, 0x80, |
| 920 |
0x35, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1c, |
| 921 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, |
| 922 |
}; |
| 923 |
|
| 924 |
static uint8_t hdmi_edid_4k_600_with_displayid[512] = { |
| 925 |
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, |
| 926 |
0x31, 0xd8, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, |
| 927 |
0x22, 0x1a, 0x01, 0x03, 0x80, 0x60, 0x36, 0x78, |
| 928 |
0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, |
| 929 |
0x0f, 0x50, 0x54, 0x2f, 0xcf, 0x00, 0x31, 0x59, |
| 930 |
0x45, 0x59, 0x81, 0x80, 0x81, 0x40, 0x90, 0x40, |
| 931 |
0x95, 0x00, 0xa9, 0x40, 0xb3, 0x00, 0x08, 0xe8, |
| 932 |
0x00, 0x30, 0xf2, 0x70, 0x5a, 0x80, 0xb0, 0x58, |
| 933 |
0x8a, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1e, |
| 934 |
0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x55, 0x18, |
| 935 |
0x87, 0x3c, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, |
| 936 |
0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x68, |
| 937 |
0x64, 0x6d, 0x69, 0x20, 0x34, 0x2d, 0x62, 0x6c, |
| 938 |
0x6f, 0x63, 0x6b, 0x73, 0x00, 0x00, 0x00, 0x10, |
| 939 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 940 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe4, |
| 941 |
|
| 942 |
0xf0, 0x02, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 943 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 944 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 945 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 946 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 947 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 948 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 949 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 950 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 951 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 952 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 953 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 954 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 955 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 956 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 957 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, |
| 958 |
|
| 959 |
0x02, 0x03, 0x3f, 0xf1, 0x51, 0x61, 0x60, 0x5f, |
| 960 |
0x5e, 0x5d, 0x10, 0x1f, 0x04, 0x13, 0x22, 0x21, |
| 961 |
0x20, 0x05, 0x14, 0x02, 0x11, 0x01, 0x23, 0x09, |
| 962 |
0x07, 0x07, 0x83, 0x01, 0x00, 0x00, 0x6d, 0x03, |
| 963 |
0x0c, 0x00, 0x10, 0x00, 0x00, 0x3c, 0x21, 0x00, |
| 964 |
0x60, 0x01, 0x02, 0x03, 0x67, 0xd8, 0x5d, 0xc4, |
| 965 |
0x01, 0x78, 0x00, 0x00, 0xe2, 0x00, 0xca, 0xe3, |
| 966 |
0x05, 0x00, 0x00, 0xe3, 0x06, 0x01, 0x00, 0x4d, |
| 967 |
0xd0, 0x00, 0xa0, 0xf0, 0x70, 0x3e, 0x80, 0x30, |
| 968 |
0x20, 0x35, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00, |
| 969 |
0x1e, 0x1a, 0x36, 0x80, 0xa0, 0x70, 0x38, 0x1f, |
| 970 |
0x40, 0x30, 0x20, 0x35, 0x00, 0xc0, 0x1c, 0x32, |
| 971 |
0x00, 0x00, 0x1a, 0x1a, 0x1d, 0x00, 0x80, 0x51, |
| 972 |
0xd0, 0x1c, 0x20, 0x40, 0x80, 0x35, 0x00, 0xc0, |
| 973 |
0x1c, 0x32, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, |
| 974 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, |
| 975 |
|
| 976 |
0x70, 0x12, 0x79, 0x03, 0x00, 0x00, 0x00, 0x1c, |
| 977 |
0x4c, 0x4e, 0x58, 0x34, 0x12, 0x56, 0x34, 0x12, |
| 978 |
0x00, 0x22, 0x10, 0x10, 0x48, 0x44, 0x4d, 0x49, |
| 979 |
0x20, 0x2b, 0x20, 0x44, 0x69, 0x73, 0x70, 0x6c, |
| 980 |
0x61, 0x79, 0x49, 0x44, 0x01, 0x00, 0x0c, 0x80, |
| 981 |
0x25, 0x18, 0x15, 0x00, 0x0f, 0x70, 0x08, 0x80, |
| 982 |
0x78, 0x4e, 0x77, 0x0f, 0x00, 0x0a, 0x71, 0x20, |
| 983 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 984 |
0x03, 0x01, 0x14, 0x07, 0xe8, 0x00, 0x84, 0xff, |
| 985 |
0x0e, 0x2f, 0x02, 0xaf, 0x80, 0x57, 0x00, 0x6f, |
| 986 |
0x08, 0x59, 0x00, 0x07, 0x80, 0x09, 0x00, 0x00, |
| 987 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 988 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 989 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 990 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 991 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x90, |
| 992 |
}; |
| 993 |
|
| 994 |
static uint8_t hdmi_edid_4k_600_with_displayid_eeodb[384] = { |
| 995 |
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, |
| 996 |
0x31, 0xd8, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, |
| 997 |
0x22, 0x1a, 0x01, 0x03, 0x80, 0x60, 0x36, 0x78, |
| 998 |
0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, |
| 999 |
0x0f, 0x50, 0x54, 0x2f, 0xcf, 0x00, 0x31, 0x59, |
| 1000 |
0x45, 0x59, 0x81, 0x80, 0x81, 0x40, 0x90, 0x40, |
| 1001 |
0x95, 0x00, 0xa9, 0x40, 0xb3, 0x00, 0x08, 0xe8, |
| 1002 |
0x00, 0x30, 0xf2, 0x70, 0x5a, 0x80, 0xb0, 0x58, |
| 1003 |
0x8a, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1e, |
| 1004 |
0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x55, 0x18, |
| 1005 |
0x87, 0x3c, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, |
| 1006 |
0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x68, |
| 1007 |
0x64, 0x6d, 0x69, 0x20, 0x33, 0x2d, 0x62, 0x6c, |
| 1008 |
0x6f, 0x63, 0x6b, 0x73, 0x00, 0x00, 0x00, 0x10, |
| 1009 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1010 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xe7, |
| 1011 |
|
| 1012 |
0x02, 0x03, 0x42, 0xf1, 0xe2, 0x78, 0x02, 0x51, |
| 1013 |
0x61, 0x60, 0x5f, 0x5e, 0x5d, 0x10, 0x1f, 0x04, |
| 1014 |
0x13, 0x22, 0x21, 0x20, 0x05, 0x14, 0x02, 0x11, |
| 1015 |
0x01, 0x23, 0x09, 0x07, 0x07, 0x83, 0x01, 0x00, |
| 1016 |
0x00, 0x6d, 0x03, 0x0c, 0x00, 0x10, 0x00, 0x00, |
| 1017 |
0x3c, 0x21, 0x00, 0x60, 0x01, 0x02, 0x03, 0x67, |
| 1018 |
0xd8, 0x5d, 0xc4, 0x01, 0x78, 0x00, 0x00, 0xe2, |
| 1019 |
0x00, 0xca, 0xe3, 0x05, 0x00, 0x00, 0xe3, 0x06, |
| 1020 |
0x01, 0x00, 0x4d, 0xd0, 0x00, 0xa0, 0xf0, 0x70, |
| 1021 |
0x3e, 0x80, 0x30, 0x20, 0x35, 0x00, 0xc0, 0x1c, |
| 1022 |
0x32, 0x00, 0x00, 0x1e, 0x1a, 0x36, 0x80, 0xa0, |
| 1023 |
0x70, 0x38, 0x1f, 0x40, 0x30, 0x20, 0x35, 0x00, |
| 1024 |
0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1a, 0x1a, 0x1d, |
| 1025 |
0x00, 0x80, 0x51, 0xd0, 0x1c, 0x20, 0x40, 0x80, |
| 1026 |
0x35, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1c, |
| 1027 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, |
| 1028 |
|
| 1029 |
0x70, 0x12, 0x79, 0x03, 0x00, 0x00, 0x00, 0x1c, |
| 1030 |
0x4c, 0x4e, 0x58, 0x34, 0x12, 0x56, 0x34, 0x12, |
| 1031 |
0x00, 0x22, 0x10, 0x10, 0x48, 0x44, 0x4d, 0x49, |
| 1032 |
0x20, 0x2b, 0x20, 0x44, 0x69, 0x73, 0x70, 0x6c, |
| 1033 |
0x61, 0x79, 0x49, 0x44, 0x01, 0x00, 0x0c, 0x80, |
| 1034 |
0x25, 0x18, 0x15, 0x00, 0x0f, 0x70, 0x08, 0x80, |
| 1035 |
0x78, 0x4e, 0x77, 0x0f, 0x00, 0x0a, 0x71, 0x20, |
| 1036 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1037 |
0x03, 0x01, 0x14, 0x07, 0xe8, 0x00, 0x84, 0xff, |
| 1038 |
0x0e, 0x2f, 0x02, 0xaf, 0x80, 0x57, 0x00, 0x6f, |
| 1039 |
0x08, 0x59, 0x00, 0x07, 0x80, 0x09, 0x00, 0x00, |
| 1040 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1041 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1042 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1043 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1044 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x90, |
| 1045 |
}; |
| 1046 |
|
| 1047 |
static uint8_t displayport_edid[256] = { |
| 1048 |
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, |
| 1049 |
0x31, 0xd8, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, |
| 1050 |
0x22, 0x1a, 0x01, 0x04, 0xa1, 0x30, 0x1e, 0x78, |
| 1051 |
0x07, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, |
| 1052 |
0x0f, 0x50, 0x54, 0x2f, 0xcf, 0x00, 0x31, 0x59, |
| 1053 |
0x45, 0x59, 0x81, 0x80, 0x81, 0x40, 0x90, 0x40, |
| 1054 |
0x95, 0x00, 0xa9, 0x40, 0xb3, 0x00, 0x28, 0x3c, |
| 1055 |
0x80, 0xa0, 0x70, 0xb0, 0x23, 0x40, 0x30, 0x20, |
| 1056 |
0x36, 0x00, 0xe0, 0x2c, 0x11, 0x00, 0x00, 0x1a, |
| 1057 |
0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x55, 0x18, |
| 1058 |
0x5e, 0x11, 0x04, 0x12, 0x00, 0xf0, 0xf8, 0x58, |
| 1059 |
0xf0, 0x3c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x64, |
| 1060 |
0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x70, 0x6f, |
| 1061 |
0x72, 0x74, 0x0a, 0x20, 0x00, 0x00, 0x00, 0x10, |
| 1062 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1063 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc2, |
| 1064 |
|
| 1065 |
0x70, 0x12, 0x79, 0x03, 0x00, 0x00, 0x00, 0x17, |
| 1066 |
0x4c, 0x4e, 0x58, 0x34, 0x12, 0x56, 0x34, 0x12, |
| 1067 |
0x00, 0x22, 0x10, 0x0b, 0x44, 0x69, 0x73, 0x70, |
| 1068 |
0x6c, 0x61, 0x79, 0x50, 0x6f, 0x72, 0x74, 0x01, |
| 1069 |
0x00, 0x0c, 0xc0, 0x12, 0xb8, 0x0b, 0x80, 0x07, |
| 1070 |
0xb0, 0x04, 0x10, 0x78, 0x3c, 0x77, 0x0f, 0x00, |
| 1071 |
0x0a, 0xa4, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1072 |
0x45, 0x00, 0x00, 0x03, 0x01, 0x14, 0x27, 0x3c, |
| 1073 |
0x00, 0x84, 0x7f, 0x07, 0x9f, 0x00, 0x2f, 0x80, |
| 1074 |
0x1f, 0x00, 0xaf, 0x04, 0x22, 0x00, 0x02, 0x00, |
| 1075 |
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1076 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1077 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1078 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1079 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1080 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x90, |
| 1081 |
}; |
| 1082 |
|
| 1083 |
static uint8_t displayport_edid_with_cta861[384] = { |
| 1084 |
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, |
| 1085 |
0x31, 0xd8, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, |
| 1086 |
0x22, 0x1a, 0x01, 0x04, 0xa5, 0x30, 0x1b, 0x78, |
| 1087 |
0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, |
| 1088 |
0x0f, 0x50, 0x54, 0x2f, 0xcf, 0x00, 0x31, 0x59, |
| 1089 |
0x45, 0x59, 0x81, 0x80, 0x81, 0x40, 0x90, 0x40, |
| 1090 |
0x95, 0x00, 0xa9, 0x40, 0xb3, 0x00, 0x02, 0x3a, |
| 1091 |
0x80, 0x18, 0x71, 0x38, 0x2d, 0x40, 0x58, 0x2c, |
| 1092 |
0x45, 0x00, 0xe0, 0x0e, 0x11, 0x00, 0x00, 0x1e, |
| 1093 |
0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x55, 0x18, |
| 1094 |
0x5e, 0x11, 0x04, 0x12, 0x04, 0xf0, 0xf8, 0x38, |
| 1095 |
0xf0, 0x3c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x44, |
| 1096 |
0x50, 0x2b, 0x43, 0x54, 0x41, 0x38, 0x36, 0x31, |
| 1097 |
0x0a, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x10, |
| 1098 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1099 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0d, |
| 1100 |
|
| 1101 |
0x02, 0x03, 0x24, 0xf1, 0x4c, 0x10, 0x1f, 0x04, |
| 1102 |
0x13, 0x22, 0x21, 0x20, 0x05, 0x14, 0x02, 0x11, |
| 1103 |
0x01, 0x23, 0x09, 0x07, 0x07, 0x83, 0x01, 0x00, |
| 1104 |
0x00, 0xe2, 0x00, 0xca, 0xe3, 0x05, 0x00, 0x00, |
| 1105 |
0xe3, 0x06, 0x01, 0x00, 0x1a, 0x36, 0x80, 0xa0, |
| 1106 |
0x70, 0x38, 0x1f, 0x40, 0x30, 0x20, 0x35, 0x00, |
| 1107 |
0xe0, 0x0e, 0x11, 0x00, 0x00, 0x1a, 0x1a, 0x1d, |
| 1108 |
0x00, 0x80, 0x51, 0xd0, 0x1c, 0x20, 0x40, 0x80, |
| 1109 |
0x35, 0x00, 0xe0, 0x0e, 0x11, 0x00, 0x00, 0x1c, |
| 1110 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1111 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1112 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1113 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1114 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1115 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1116 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4f, |
| 1117 |
|
| 1118 |
0x70, 0x12, 0x79, 0x03, 0x00, 0x00, 0x00, 0x24, |
| 1119 |
0x4c, 0x4e, 0x58, 0x34, 0x12, 0x56, 0x34, 0x12, |
| 1120 |
0x00, 0x22, 0x10, 0x18, 0x44, 0x69, 0x73, 0x70, |
| 1121 |
0x6c, 0x61, 0x79, 0x50, 0x6f, 0x72, 0x74, 0x20, |
| 1122 |
0x77, 0x69, 0x74, 0x68, 0x20, 0x43, 0x54, 0x41, |
| 1123 |
0x2d, 0x38, 0x36, 0x31, 0x0f, 0x00, 0x0a, 0xa4, |
| 1124 |
0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1125 |
0x00, 0x01, 0x00, 0x0c, 0xc0, 0x12, 0x8c, 0x0a, |
| 1126 |
0x80, 0x07, 0x38, 0x04, 0x90, 0x78, 0x4e, 0x77, |
| 1127 |
0x03, 0x01, 0x14, 0x01, 0x3a, 0x00, 0x84, 0x7f, |
| 1128 |
0x07, 0x17, 0x01, 0x57, 0x80, 0x2b, 0x00, 0x37, |
| 1129 |
0x04, 0x2c, 0x00, 0x03, 0x80, 0x04, 0x00, 0x00, |
| 1130 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1131 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1132 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1133 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x90, |
| 1134 |
}; |
| 1135 |
|
| 1136 |
/******************************************************/ |
| 1137 |
|
| 1138 |
void edid_cmd(int ch, char *optarg) |
| 1139 |
{ |
| 1140 |
char *value, *subs; |
| 1141 |
|
| 1142 |
switch (ch) { |
| 1143 |
case OptSetEdid: |
| 1144 |
case OptShowEdid: |
| 1145 |
memset(&sedid, 0, sizeof(sedid)); |
| 1146 |
file_in = nullptr; |
| 1147 |
if (!optarg) |
| 1148 |
break; |
| 1149 |
subs = optarg; |
| 1150 |
while (*subs != '\0') { |
| 1151 |
static constexpr const char *subopts[] = { |
| 1152 |
"pad", |
| 1153 |
"type", |
| 1154 |
"edid", |
| 1155 |
"file", |
| 1156 |
"format", |
| 1157 |
"pa", |
| 1158 |
"s-pt", |
| 1159 |
"s-it", |
| 1160 |
"s-ce", |
| 1161 |
"y444", |
| 1162 |
"30-bit", |
| 1163 |
"36-bit", |
| 1164 |
"48-bit", |
| 1165 |
"graphics", |
| 1166 |
"photo", |
| 1167 |
"cinema", |
| 1168 |
"game", |
| 1169 |
"scdc", |
| 1170 |
"underscan", |
| 1171 |
"audio", |
| 1172 |
"ycbcr444", |
| 1173 |
"ycbcr422", |
| 1174 |
"qy", |
| 1175 |
"qs", |
| 1176 |
"xvycc-601", |
| 1177 |
"xvycc-709", |
| 1178 |
"sycc", |
| 1179 |
"opycc", |
| 1180 |
"oprgb", |
| 1181 |
"bt2020-rgb", |
| 1182 |
"bt2020-ycc", |
| 1183 |
"bt2020-cycc", |
| 1184 |
"dci-p3", |
| 1185 |
"sdr", |
| 1186 |
"hdr", |
| 1187 |
"smpte2084", |
| 1188 |
"hlg", |
| 1189 |
"fl-fr", |
| 1190 |
"lfe", |
| 1191 |
"fc", |
| 1192 |
"bl-br", |
| 1193 |
"bc", |
| 1194 |
"flc-frc", |
| 1195 |
"rlc-rrc", |
| 1196 |
"flw-frw", |
| 1197 |
"tpfl-tpfr", |
| 1198 |
"tpc", |
| 1199 |
"tpfc", |
| 1200 |
"ls-rs", |
| 1201 |
"lfe2", |
| 1202 |
"tpbc", |
| 1203 |
"sil-sir", |
| 1204 |
"tpsil-tpsir", |
| 1205 |
"tpbl-tpbr", |
| 1206 |
"btfc", |
| 1207 |
"btfl-btbr", |
| 1208 |
"tpls-tprs", |
| 1209 |
"cable-status", |
| 1210 |
nullptr |
| 1211 |
}; |
| 1212 |
|
| 1213 |
int opt = v4l_getsubopt(&subs, (char* const*)subopts, &value); |
| 1214 |
|
| 1215 |
if (opt == -1) { |
| 1216 |
fprintf(stderr, "Invalid suboptions specified\n"); |
| 1217 |
edid_usage(); |
| 1218 |
std::exit(EXIT_FAILURE); |
| 1219 |
} |
| 1220 |
if (value == nullptr && opt <= 8) { |
| 1221 |
fprintf(stderr, "No value given to suboption <%s>\n", |
| 1222 |
subopts[opt]); |
| 1223 |
edid_usage(); |
| 1224 |
std::exit(EXIT_FAILURE); |
| 1225 |
} |
| 1226 |
switch (opt) { |
| 1227 |
case 1: |
| 1228 |
case 2: /* keep edid for compat reasons, it's the same as type */ |
| 1229 |
if (!strcmp(value, "dvid")) { |
| 1230 |
sedid.edid = dvid_edid; |
| 1231 |
sedid.blocks = sizeof(dvid_edid) / 128; |
| 1232 |
} else if (!strcmp(value, "vga")) { |
| 1233 |
sedid.edid = vga_edid; |
| 1234 |
sedid.blocks = sizeof(vga_edid) / 128; |
| 1235 |
} else if (!strcmp(value, "hdmi-4k-170mhz")) { |
| 1236 |
sedid.edid = hdmi_edid_4k_170; |
| 1237 |
sedid.blocks = sizeof(hdmi_edid_4k_170) / 128; |
| 1238 |
} else if (!strcmp(value, "hdmi-4k-300mhz")) { |
| 1239 |
sedid.edid = hdmi_edid_4k_300; |
| 1240 |
sedid.blocks = sizeof(hdmi_edid_4k_300) / 128; |
| 1241 |
} else if (!strcmp(value, "hdmi-4k-600mhz-with-displayid")) { |
| 1242 |
sedid.edid = hdmi_edid_4k_600_with_displayid; |
| 1243 |
sedid.blocks = sizeof(hdmi_edid_4k_600_with_displayid) / 128; |
| 1244 |
} else if (!strcmp(value, "hdmi-4k-600mhz-with-displayid-eeodb")) { |
| 1245 |
sedid.edid = hdmi_edid_4k_600_with_displayid_eeodb; |
| 1246 |
sedid.blocks = sizeof(hdmi_edid_4k_600_with_displayid_eeodb) / 128; |
| 1247 |
} else if (!strcmp(value, "hdmi-4k-600mhz")) { |
| 1248 |
sedid.edid = hdmi_edid_4k_600; |
| 1249 |
sedid.blocks = sizeof(hdmi_edid_4k_600) / 128; |
| 1250 |
} else if (!strcmp(value, "hdmi")) { |
| 1251 |
sedid.edid = hdmi_edid; |
| 1252 |
sedid.blocks = sizeof(hdmi_edid) / 128; |
| 1253 |
} else if (!strcmp(value, "displayport-with-cta861")) { |
| 1254 |
sedid.edid = displayport_edid_with_cta861; |
| 1255 |
sedid.blocks = sizeof(displayport_edid_with_cta861) / 128; |
| 1256 |
} else if (!strcmp(value, "displayport")) { |
| 1257 |
sedid.edid = displayport_edid; |
| 1258 |
sedid.blocks = sizeof(displayport_edid) / 128; |
| 1259 |
} else if (!strcmp(value, "list")) { |
| 1260 |
printf("EDID types:\n"); |
| 1261 |
printf("vga: Base Block supporting VGA interface (1920x1200p60)\n"); |
| 1262 |
printf("dvid: Base Block supporting DVI-D interface (1920x1200p60)\n"); |
| 1263 |
printf("hdmi: CTA-861 with HDMI support up to 1080p60\n"); |
| 1264 |
printf("hdmi-4k-170mhz: CTA-861 with HDMI support up to 1080p60 or 4kp30 4:2:0\n"); |
| 1265 |
printf("hdmi-4k-300mhz: CTA-861 with HDMI support up to 4kp30\n"); |
| 1266 |
printf("hdmi-4k-600mhz: CTA-861 with HDMI support up to 4kp60\n"); |
| 1267 |
printf("hdmi-4k-600mhz-with-displayid: Block Map Extension Block, CTA-861 with\n"); |
| 1268 |
printf("hdmi-4k-600mhz-with-displayid-eeodb: CTA-861 with EEODB and\n"); |
| 1269 |
printf("\tHDMI support up to 4kp60, DisplayID Extension Block\n"); |
| 1270 |
printf("displayport: DisplayID supporting a DisplayPort interface (1920x1200)\n"); |
| 1271 |
printf("displayport-with-cta861: DisplayID supporting a DisplayPort interface,\n"); |
| 1272 |
printf("\tCTA-861 Extension Block (1080p60)\n"); |
| 1273 |
std::exit(EXIT_FAILURE); |
| 1274 |
} else { |
| 1275 |
edid_usage(); |
| 1276 |
std::exit(EXIT_FAILURE); |
| 1277 |
} |
| 1278 |
if (file_in) { |
| 1279 |
fprintf(stderr, "The edid and file options can't be used together.\n"); |
| 1280 |
std::exit(EXIT_FAILURE); |
| 1281 |
} |
| 1282 |
break; |
| 1283 |
case 3: |
| 1284 |
if (value) { |
| 1285 |
file_in = value; |
| 1286 |
if (sedid.edid) { |
| 1287 |
fprintf(stderr, "The edid and file options can't be used together.\n"); |
| 1288 |
std::exit(EXIT_FAILURE); |
| 1289 |
} |
| 1290 |
} |
| 1291 |
break; |
| 1292 |
case 4: |
| 1293 |
if (!strcmp(value, "hex")) { |
| 1294 |
sformat = HEX; |
| 1295 |
} else if (!strcmp(value, "raw")) { |
| 1296 |
sformat = RAW; |
| 1297 |
} else { |
| 1298 |
edid_usage(); |
| 1299 |
std::exit(EXIT_FAILURE); |
| 1300 |
} |
| 1301 |
break; |
| 1302 |
case 5: |
| 1303 |
if (value) |
| 1304 |
phys_addr = parse_phys_addr(value); |
| 1305 |
break; |
| 1306 |
case 6: |
| 1307 |
mod_s_pt = strtoul(value, nullptr, 0) & 3; |
| 1308 |
break; |
| 1309 |
case 7: |
| 1310 |
mod_s_it = strtoul(value, nullptr, 0) & 3; |
| 1311 |
break; |
| 1312 |
case 8: |
| 1313 |
mod_s_ce = strtoul(value, nullptr, 0) & 3; |
| 1314 |
break; |
| 1315 |
case 9: toggle_hdmi_vsdb_dc_flags |= HDMI_VSDB_Y444_BIT; break; |
| 1316 |
case 10: toggle_hdmi_vsdb_dc_flags |= HDMI_VSDB_30_BIT; break; |
| 1317 |
case 11: toggle_hdmi_vsdb_dc_flags |= HDMI_VSDB_36_BIT; break; |
| 1318 |
case 12: toggle_hdmi_vsdb_dc_flags |= HDMI_VSDB_48_BIT; break; |
| 1319 |
case 13: toggle_hdmi_vsdb_cnc_flags |= HDMI_VSDB_GRAPHICS; break; |
| 1320 |
case 14: toggle_hdmi_vsdb_cnc_flags |= HDMI_VSDB_PHOTO; break; |
| 1321 |
case 15: toggle_hdmi_vsdb_cnc_flags |= HDMI_VSDB_CINEMA; break; |
| 1322 |
case 16: toggle_hdmi_vsdb_cnc_flags |= HDMI_VSDB_GAME; break; |
| 1323 |
case 17: toggle_hf_vsdb_flags |= HF_VSDB_SCDC_PRESENT; break; |
| 1324 |
case 18: toggle_cta861_hdr_flags |= CTA861_HDR_UNDERSCAN; break; |
| 1325 |
case 19: toggle_cta861_hdr_flags |= CTA861_HDR_AUDIO; break; |
| 1326 |
case 20: toggle_cta861_hdr_flags |= CTA861_HDR_YCBCR444; break; |
| 1327 |
case 21: toggle_cta861_hdr_flags |= CTA861_HDR_YCBCR422; break; |
| 1328 |
case 22: toggle_vid_cap_flags |= VID_CAP_QY; break; |
| 1329 |
case 23: toggle_vid_cap_flags |= VID_CAP_QS; break; |
| 1330 |
case 24: toggle_colorimetry_flags1 |= COLORIMETRY_XVYCC601; break; |
| 1331 |
case 25: toggle_colorimetry_flags1 |= COLORIMETRY_XVYCC709; break; |
| 1332 |
case 26: toggle_colorimetry_flags1 |= COLORIMETRY_SYCC; break; |
| 1333 |
case 27: toggle_colorimetry_flags1 |= COLORIMETRY_OPYCC; break; |
| 1334 |
case 28: toggle_colorimetry_flags1 |= COLORIMETRY_OPRGB; break; |
| 1335 |
case 29: toggle_colorimetry_flags1 |= COLORIMETRY_BT2020RGB; break; |
| 1336 |
case 30: toggle_colorimetry_flags1 |= COLORIMETRY_BT2020YCC; break; |
| 1337 |
case 31: toggle_colorimetry_flags1 |= COLORIMETRY_BT2020CYCC; break; |
| 1338 |
case 32: toggle_colorimetry_flags2 |= COLORIMETRY_DCIP3; break; |
| 1339 |
case 33: toggle_hdr_md_flags |= HDR_MD_SDR; break; |
| 1340 |
case 34: toggle_hdr_md_flags |= HDR_MD_HDR; break; |
| 1341 |
case 35: toggle_hdr_md_flags |= HDR_MD_SMPTE_2084; break; |
| 1342 |
case 36: toggle_hdr_md_flags |= HDR_MD_HLG; break; |
| 1343 |
case 37: toggle_speaker1_flags |= SPEAKER1_FL_FR; break; |
| 1344 |
case 38: toggle_speaker1_flags |= SPEAKER1_LFE; break; |
| 1345 |
case 39: toggle_speaker1_flags |= SPEAKER1_FC; break; |
| 1346 |
case 40: toggle_speaker1_flags |= SPEAKER1_BL_BR; break; |
| 1347 |
case 41: toggle_speaker1_flags |= SPEAKER1_BC; break; |
| 1348 |
case 42: toggle_speaker1_flags |= SPEAKER1_FLC_FRC; break; |
| 1349 |
case 43: toggle_speaker1_flags |= SPEAKER1_RLC_RRC; break; |
| 1350 |
case 44: toggle_speaker1_flags |= SPEAKER1_FLW_FRW; break; |
| 1351 |
case 45: toggle_speaker2_flags |= SPEAKER2_TPFL_TPFR; break; |
| 1352 |
case 46: toggle_speaker2_flags |= SPEAKER2_TPC; break; |
| 1353 |
case 47: toggle_speaker2_flags |= SPEAKER2_TPFC; break; |
| 1354 |
case 48: toggle_speaker2_flags |= SPEAKER2_LS_RS; break; |
| 1355 |
case 49: toggle_speaker2_flags |= SPEAKER2_LFE2; break; |
| 1356 |
case 50: toggle_speaker2_flags |= SPEAKER2_TPBC; break; |
| 1357 |
case 51: toggle_speaker2_flags |= SPEAKER2_SIL_SIR; break; |
| 1358 |
case 52: toggle_speaker2_flags |= SPEAKER2_TPSIL_TPSIR; break; |
| 1359 |
case 53: toggle_speaker3_flags |= SPEAKER3_TPBL_TPBR; break; |
| 1360 |
case 54: toggle_speaker3_flags |= SPEAKER3_BTFC; break; |
| 1361 |
case 55: toggle_speaker3_flags |= SPEAKER3_BTFL_BTFR; break; |
| 1362 |
case 56: toggle_speaker3_flags |= SPEAKER3_TPLS_TPRS; break; |
| 1363 |
case 57: toggle_hf_vsdb_flags |= HF_VSDB_CABLE_STATUS; break; |
| 1364 |
case 0: |
| 1365 |
if (ch == OptSetEdid) { |
| 1366 |
sedid.pad = strtoul(value, nullptr, 0); |
| 1367 |
break; |
| 1368 |
} |
| 1369 |
fallthrough; |
| 1370 |
default: |
| 1371 |
edid_usage(); |
| 1372 |
std::exit(EXIT_FAILURE); |
| 1373 |
} |
| 1374 |
} |
| 1375 |
break; |
| 1376 |
|
| 1377 |
case OptClearEdid: |
| 1378 |
if (optarg) |
| 1379 |
clear_pad = strtoul(optarg, nullptr, 0); |
| 1380 |
break; |
| 1381 |
|
| 1382 |
case OptGetEdid: |
| 1383 |
memset(&gedid, 0, sizeof(gedid)); |
| 1384 |
gedid.blocks = 256; /* default all blocks */ |
| 1385 |
gformat = HEX; /* default hex output */ |
| 1386 |
file_out = nullptr; |
| 1387 |
if (!optarg) |
| 1388 |
break; |
| 1389 |
subs = optarg; |
| 1390 |
while (*subs != '\0') { |
| 1391 |
static constexpr const char *subopts[] = { |
| 1392 |
"pad", |
| 1393 |
"startblock", |
| 1394 |
"blocks", |
| 1395 |
"format", |
| 1396 |
"file", |
| 1397 |
nullptr |
| 1398 |
}; |
| 1399 |
|
| 1400 |
switch (parse_subopt(&subs, subopts, &value)) { |
| 1401 |
case 0: |
| 1402 |
gedid.pad = strtoul(value, nullptr, 0); |
| 1403 |
break; |
| 1404 |
case 1: |
| 1405 |
gedid.start_block = strtoul(value, nullptr, 0); |
| 1406 |
if (gedid.start_block > 255) { |
| 1407 |
fprintf(stderr, "startblock %d too large, max 255\n", gedid.start_block); |
| 1408 |
std::exit(EXIT_FAILURE); |
| 1409 |
} |
| 1410 |
break; |
| 1411 |
case 2: |
| 1412 |
gedid.blocks = strtoul(value, nullptr, 0); |
| 1413 |
break; |
| 1414 |
case 3: |
| 1415 |
if (!strcmp(value, "hex")) { |
| 1416 |
gformat = HEX; |
| 1417 |
} else if (!strcmp(value, "raw")) { |
| 1418 |
gformat = RAW; |
| 1419 |
} else if (!strcmp(value, "carray")) { |
| 1420 |
gformat = CARRAY; |
| 1421 |
} else { |
| 1422 |
edid_usage(); |
| 1423 |
std::exit(EXIT_FAILURE); |
| 1424 |
} |
| 1425 |
break; |
| 1426 |
case 4: |
| 1427 |
if (value) |
| 1428 |
file_out = value; |
| 1429 |
break; |
| 1430 |
default: |
| 1431 |
edid_usage(); |
| 1432 |
std::exit(EXIT_FAILURE); |
| 1433 |
} |
| 1434 |
} |
| 1435 |
if (gedid.start_block + gedid.blocks > 256) |
| 1436 |
gedid.blocks = 256 - gedid.start_block; |
| 1437 |
break; |
| 1438 |
|
| 1439 |
case OptInfoEdid: |
| 1440 |
memset(&info_edid, 0, sizeof(info_edid)); |
| 1441 |
if (optarg) |
| 1442 |
info_edid.pad = strtoul(optarg, nullptr, 0); |
| 1443 |
break; |
| 1444 |
} |
| 1445 |
} |
| 1446 |
|
| 1447 |
void edid_set(cv4l_fd &_fd) |
| 1448 |
{ |
| 1449 |
int fd = _fd.g_fd(); |
| 1450 |
int loc; |
| 1451 |
|
| 1452 |
if (options[OptClearEdid]) { |
| 1453 |
struct v4l2_edid edid; |
| 1454 |
|
| 1455 |
memset(&edid, 0, sizeof(edid)); |
| 1456 |
edid.pad = clear_pad; |
| 1457 |
doioctl(fd, VIDIOC_S_EDID, &edid); |
| 1458 |
} |
| 1459 |
|
| 1460 |
if (options[OptSetEdid] || options[OptShowEdid]) { |
| 1461 |
FILE *fin = nullptr; |
| 1462 |
|
| 1463 |
if (file_in) { |
| 1464 |
if (!strcmp(file_in, "-")) |
| 1465 |
fin = stdin; |
| 1466 |
else |
| 1467 |
fin = fopen(file_in, "r"); |
| 1468 |
if (!fin) { |
| 1469 |
fprintf(stderr, "Failed to open %s: %s\n", file_in, |
| 1470 |
strerror(errno)); |
| 1471 |
std::exit(EXIT_FAILURE); |
| 1472 |
} |
| 1473 |
} |
| 1474 |
if (fin) { |
| 1475 |
read_edid_file(fin, &sedid); |
| 1476 |
if (sedid.blocks == 0) { |
| 1477 |
fprintf(stderr, "%s contained an empty EDID, ignoring.\n", |
| 1478 |
file_in ? file_in : "stdin"); |
| 1479 |
std::exit(EXIT_FAILURE); |
| 1480 |
} |
| 1481 |
} |
| 1482 |
if (toggle_cta861_hdr_flags || phys_addr >= 0) { |
| 1483 |
loc = get_edid_cta861_hdr_location(sedid.edid, sedid.blocks * 128); |
| 1484 |
if (loc >= 0) { |
| 1485 |
sedid.edid[loc] ^= toggle_cta861_hdr_flags; |
| 1486 |
if (phys_addr >= 0) |
| 1487 |
set_edid_phys_addr(sedid.edid, sedid.blocks * 128, phys_addr); |
| 1488 |
} |
| 1489 |
} |
| 1490 |
if (toggle_speaker1_flags || toggle_speaker2_flags || toggle_speaker3_flags) { |
| 1491 |
loc = get_edid_speaker_location(sedid.edid, sedid.blocks * 128); |
| 1492 |
if (loc >= 0) { |
| 1493 |
sedid.edid[loc] ^= toggle_speaker1_flags; |
| 1494 |
sedid.edid[loc + 1] ^= toggle_speaker2_flags; |
| 1495 |
sedid.edid[loc + 2] ^= toggle_speaker3_flags; |
| 1496 |
} |
| 1497 |
} |
| 1498 |
if (toggle_hdmi_vsdb_dc_flags || toggle_hdmi_vsdb_cnc_flags) { |
| 1499 |
loc = get_edid_hdmi_vsdb_location(sedid.edid, sedid.blocks * 128); |
| 1500 |
|
| 1501 |
if (loc >= 0) { |
| 1502 |
__u8 len = sedid.edid[loc] & 0x1f; |
| 1503 |
|
| 1504 |
if (len >= 6) |
| 1505 |
sedid.edid[loc + 6] ^= toggle_hdmi_vsdb_dc_flags; |
| 1506 |
if (len >= 8) |
| 1507 |
sedid.edid[loc + 8] ^= toggle_hdmi_vsdb_cnc_flags; |
| 1508 |
} |
| 1509 |
} |
| 1510 |
if (toggle_hf_vsdb_flags) { |
| 1511 |
loc = get_edid_hf_vsdb_location(sedid.edid, sedid.blocks * 128); |
| 1512 |
if (loc >= 0) |
| 1513 |
sedid.edid[loc + 1] ^= toggle_hf_vsdb_flags; |
| 1514 |
} |
| 1515 |
if (toggle_vid_cap_flags || mod_s_pt >= 0 || |
| 1516 |
mod_s_ce >= 0 || mod_s_it >= 0) { |
| 1517 |
loc = get_edid_vid_cap_location(sedid.edid, sedid.blocks * 128); |
| 1518 |
if (loc >= 0) { |
| 1519 |
sedid.edid[loc] ^= toggle_vid_cap_flags; |
| 1520 |
if (mod_s_ce >= 0) { |
| 1521 |
sedid.edid[loc] &= 0xfc; |
| 1522 |
sedid.edid[loc] |= mod_s_ce << 0; |
| 1523 |
} |
| 1524 |
if (mod_s_it >= 0) { |
| 1525 |
sedid.edid[loc] &= 0xf3; |
| 1526 |
sedid.edid[loc] |= mod_s_it << 2; |
| 1527 |
} |
| 1528 |
if (mod_s_pt >= 0) { |
| 1529 |
sedid.edid[loc] &= 0xcf; |
| 1530 |
sedid.edid[loc] |= mod_s_pt << 4; |
| 1531 |
} |
| 1532 |
} |
| 1533 |
} |
| 1534 |
if (toggle_colorimetry_flags1 || toggle_colorimetry_flags2) { |
| 1535 |
loc = get_edid_colorimetry_location(sedid.edid, sedid.blocks * 128); |
| 1536 |
if (loc >= 0) { |
| 1537 |
sedid.edid[loc] ^= toggle_colorimetry_flags1; |
| 1538 |
sedid.edid[loc + 1] ^= toggle_colorimetry_flags2; |
| 1539 |
} |
| 1540 |
} |
| 1541 |
if (toggle_hdr_md_flags) { |
| 1542 |
loc = get_edid_hdr_md_location(sedid.edid, sedid.blocks * 128); |
| 1543 |
if (loc >= 0) |
| 1544 |
sedid.edid[loc] ^= toggle_hdr_md_flags; |
| 1545 |
} |
| 1546 |
if (!options[OptKeepEdidChecksums]) |
| 1547 |
fix_edid(&sedid); |
| 1548 |
if (verbose && options[OptSetEdid]) |
| 1549 |
print_edid_mods(&sedid); |
| 1550 |
if (options[OptShowEdid]) { |
| 1551 |
for (unsigned b = 0; b < sedid.blocks; b++) { |
| 1552 |
if (b) |
| 1553 |
printf("\n"); |
| 1554 |
for (unsigned i = 0; i < 128; i += 16) { |
| 1555 |
for (unsigned j = i; j < i + 16; j++) { |
| 1556 |
if (j > i) |
| 1557 |
printf(" "); |
| 1558 |
printf("%02x", sedid.edid[b * 128 + j]); |
| 1559 |
} |
| 1560 |
printf("\n"); |
| 1561 |
} |
| 1562 |
} |
| 1563 |
} else { |
| 1564 |
doioctl(fd, VIDIOC_S_EDID, &sedid); |
| 1565 |
} |
| 1566 |
if (fin) { |
| 1567 |
if (sedid.edid) { |
| 1568 |
free(sedid.edid); |
| 1569 |
sedid.edid = nullptr; |
| 1570 |
} |
| 1571 |
if (fin != stdin) |
| 1572 |
fclose(fin); |
| 1573 |
} |
| 1574 |
} |
| 1575 |
} |
| 1576 |
|
| 1577 |
void edid_get(cv4l_fd &_fd) |
| 1578 |
{ |
| 1579 |
int fd = _fd.g_fd(); |
| 1580 |
|
| 1581 |
if (options[OptGetEdid]) { |
| 1582 |
FILE *fout = stdout; |
| 1583 |
|
| 1584 |
if (file_out) { |
| 1585 |
if (!strcmp(file_out, "-")) |
| 1586 |
fout = stdout; |
| 1587 |
else |
| 1588 |
fout = fopen(file_out, "w+"); |
| 1589 |
if (!fout) { |
| 1590 |
fprintf(stderr, "Failed to open %s: %s\n", file_out, |
| 1591 |
strerror(errno)); |
| 1592 |
std::exit(EXIT_FAILURE); |
| 1593 |
} |
| 1594 |
} |
| 1595 |
gedid.edid = static_cast<unsigned char *>(malloc(gedid.blocks * 128)); |
| 1596 |
if (doioctl(fd, VIDIOC_G_EDID, &gedid) == 0) |
| 1597 |
printedid(fout, &gedid, gformat); |
| 1598 |
if (file_out && fout != stdout) |
| 1599 |
fclose(fout); |
| 1600 |
free(gedid.edid); |
| 1601 |
} |
| 1602 |
if (options[OptInfoEdid]) { |
| 1603 |
info_edid.blocks = 2; |
| 1604 |
info_edid.edid = static_cast<unsigned char *>(malloc(info_edid.blocks * 128)); |
| 1605 |
if (doioctl(fd, VIDIOC_G_EDID, &info_edid) == 0) |
| 1606 |
print_edid_mods(&info_edid); |
| 1607 |
free(info_edid.edid); |
| 1608 |
} |
| 1609 |
} |