This is an automatic generated email to let you know that the following patch were queued:
Subject: edid-decode: let --replace-unique-ids replace dates as well Author: Hans Verkuil <hverkuil-ci...@xs4all.nl> Date: Mon Jan 29 14:09:45 2024 +0100 If --replace-unique-ids is given, then replace the 'Made in' date by the year 2000. Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl> edid-decode.1 | 17 ++++++++++------- edid-decode.cpp | 2 +- edid-decode.h | 2 ++ parse-base-block.cpp | 27 +++++++++++++++++++-------- parse-displayid-block.cpp | 5 +++++ 5 files changed, 37 insertions(+), 16 deletions(-) --- diff --git a/edid-decode.1 b/edid-decode.1 index 47bc45b790a1..2b073c267f47 100644 --- a/edid-decode.1 +++ b/edid-decode.1 @@ -253,14 +253,17 @@ the start. .TP \fB\-\-replace\-unique\-ids\fR Replaces any unique IDs in the EDID by fixed values. Serial numbers will be -replaced by '123456' and Container IDs by all zeroes. This will -also update any checksums in the EDID and update the EDID hex dump at -the start of the output. Note that since this will update checksums, any -checksum errors present in the original EDID will no longer be detected. +replaced by '123456', Container IDs by all zeroes and the 'Made in' date by +the year 2000. This will also update any checksums in the EDID and update +the EDID hex dump at the start of the output. Note that since this will +update checksums, any checksum errors present in the original EDID will +no longer be detected. -Serial numbers can appear in the Base Block, DisplayID Extension Blocks and -Localized String Extension Blocks. Container IDs can appear in the DisplayID -and CTA-861 Extension Blocks. +Serial numbers can appear in the Base Block, CTA-861 Extension Blocks, +DisplayID Extension Blocks and Localized String Extension Blocks. +Container IDs can appear in the DisplayID and CTA-861 Extension Blocks. + +The 'Made in' date appears in the Base Block. .TP \fB\-\-version\fR Show the SHA hash and the last commit date. diff --git a/edid-decode.cpp b/edid-decode.cpp index 250d08c0e711..48e5c4d51eb8 100644 --- a/edid-decode.cpp +++ b/edid-decode.cpp @@ -148,7 +148,7 @@ static void usage(void) " -H, --only-hex-dump Only output the hex dump of the EDID.\n" " --skip-sha Skip the SHA report.\n" " --hide-serial-numbers Hide serial numbers with '...'.\n" - " --replace-unique-ids Replace unique IDs (serial numbers, Container IDs) with fixed values.\n" + " --replace-unique-ids Replace unique IDs (serial numbers, dates, Container IDs) with fixed values.\n" " --version Show the edid-decode version (SHA).\n" " --diagonal <inches> Set the display's diagonal in inches.\n" " --std <byte1>,<byte2> Show the standard timing represented by these two bytes.\n" diff --git a/edid-decode.h b/edid-decode.h index 50abfcbb7bb5..d982f90b72a4 100644 --- a/edid-decode.h +++ b/edid-decode.h @@ -158,6 +158,7 @@ struct edid_state { base.has_640x480p60_est_timing = base.has_spwg = base.preferred_is_also_native = false; base.serial_number = 0; + base.week = base.year = 0; base.supports_sec_gtf = false; base.sec_gtf_start_freq = 0; base.C = base.M = base.K = base.J = 0; @@ -250,6 +251,7 @@ struct edid_state { bool has_name_descriptor; bool has_display_range_descriptor; unsigned serial_number; + unsigned char week, year; bool supports_continuous_freq; bool supports_gtf; bool supports_sec_gtf; diff --git a/parse-base-block.cpp b/parse-base-block.cpp index b58998cd0623..2f2b4f6148fa 100644 --- a/parse-base-block.cpp +++ b/parse-base-block.cpp @@ -1384,6 +1384,14 @@ void edid_state::preparse_base_block(unsigned char *x) update_checksum = true; } + base.week = x[0x10]; + base.year = x[0x11]; + if (replace_unique_ids && base.week != 0xff) { + x[0x10] = 0; + x[0x11] = 10; + update_checksum = true; + } + /* * Need to find the Display Range Limit info before reading * the standard timings. @@ -1448,8 +1456,8 @@ void edid_state::parse_base_block(const unsigned char *x) time(&the_time); ptm = localtime(&the_time); - unsigned char week = x[0x10]; - int year = 1990 + x[0x11]; + unsigned char week = base.week; + int year = 1990 + base.year; if (week) { if (base.edid_minor <= 3 && week == 0xff) @@ -1459,16 +1467,19 @@ void edid_state::parse_base_block(const unsigned char *x) if (base.edid_minor <= 3 && week == 54) fail("EDID 1.3 does not support week 54.\n"); if (week != 0xff && week > 54) - fail("Invalid week %u of manufacture.\n", week); - if (week != 0xff) - printf(" Made in: week %hhu of %d\n", week, year); + fail("Invalid week of manufacture (> 54).\n"); } + if (year - 1 > ptm->tm_year + 1900) + fail("The year is more than one year in the future.\n"); + if (week == 0xff) printf(" Model year: %d\n", year); - else if (!week) + else if (replace_unique_ids) + printf(" Made in: 2000\n"); + else if (week) + printf(" Made in: week %hhu of %d\n", week, year); + else printf(" Made in: %d\n", year); - if (year - 1 > ptm->tm_year + 1900) - fail("The year %d is more than one year in the future.\n", year); /* display section */ diff --git a/parse-displayid-block.cpp b/parse-displayid-block.cpp index aa956e0dd5fb..75a4eb5789b8 100644 --- a/parse-displayid-block.cpp +++ b/parse-displayid-block.cpp @@ -1709,6 +1709,11 @@ void edid_state::preparse_displayid_block(unsigned char *x) x[offset + 0x0b] = 0x00; update_checksum = true; } + if (replace_unique_ids && x[offset + 0x0c] != 0xff) { + x[offset + 0x0c] = 0; + x[offset + 0x0d] = 0; + update_checksum = true; + } break; case 0x12: case 0x28: _______________________________________________ linuxtv-commits mailing list -- linuxtv-commits@linuxtv.org To unsubscribe send an email to linuxtv-commits-le...@linuxtv.org %(web_page_url)slistinfo/%(_internal_name)s