This is an automatic generated email to let you know that the following patch were queued:
Subject: edid-decode: check for more dummy serial numbers Author: Hans Verkuil <hverkuil-ci...@xs4all.nl> Date: Thu Dec 7 12:04:21 2023 +0100 Also check if the Display Product Serial Number is one of a known set of dummy values. Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl> edid-decode.h | 2 ++ parse-base-block.cpp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) --- diff --git a/edid-decode.h b/edid-decode.h index 1f9bfbae1e45..b0e26b815ca4 100644 --- a/edid-decode.h +++ b/edid-decode.h @@ -157,6 +157,7 @@ struct edid_state { base.has_640x480p60_est_timing = base.has_spwg = base.preferred_is_also_native = false; base.serial_number = 0; + base.serial_string[0] = 0; base.supports_sec_gtf = false; base.sec_gtf_start_freq = 0; base.C = base.M = base.K = base.J = 0; @@ -245,6 +246,7 @@ struct edid_state { bool has_name_descriptor; bool has_display_range_descriptor; unsigned serial_number; + char serial_string[14]; bool has_serial_string; bool supports_continuous_freq; bool supports_gtf; diff --git a/parse-base-block.cpp b/parse-base-block.cpp index 6bf9c120d33c..fc0c1b19c7f2 100644 --- a/parse-base-block.cpp +++ b/parse-base-block.cpp @@ -1121,6 +1121,7 @@ bool edid_state::preparse_detailed_block(unsigned char *x) } break; case 0xff: + strcpy(base.serial_string, extract_string(x + 5, 13)); if (replace_unique_ids) { // Replace with 123456 static const unsigned char sernum[13] = { @@ -1302,6 +1303,22 @@ void edid_state::detailed_block(const unsigned char *x) } return; case 0xff: { + static const char * const dummy_sn[] = { + "na", + "n/a", + "NA", + "Serial Number", + "SerialNumber", + "Serial_Number", + "121212121212", + "1234567890123", + "20000080", + "SN-000000001", + "demoset-1", + "H1AK500000", // Often used with Samsung displays + NULL + }; + data_block = "Display Product Serial Number"; char *sn = extract_string(x + 5, 13); if (hide_serial_numbers) @@ -1309,6 +1326,24 @@ void edid_state::detailed_block(const unsigned char *x) else printf(" %s: '%s'\n", data_block.c_str(), sn); base.has_serial_string = 1; + bool dummy = true; + // Any serial numbers consisting only of spaces, 0, and/or 1 + // characters are always considered dummy values. + for (unsigned i = 0; i < strlen(base.serial_string); i++) { + if (!strchr(" 01", base.serial_string[i])) { + dummy = false; + break; + } + } + // In addition, check against a list of known dummy S/Ns + for (unsigned i = 0; !dummy && dummy_sn[i]; i++) { + if (!strcmp(base.serial_string, dummy_sn[i])) { + dummy = true; + break; + } + } + if (dummy && base.serial_string[0]) + warn("The serial number is one of the known dummy values, is that intended?\n"); return; } default: _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits