aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--edid-decode.15
-rw-r--r--edid-decode.cpp5
-rw-r--r--edid-decode.h4
-rw-r--r--parse-base-block.cpp22
-rw-r--r--parse-displayid-block.cpp17
-rw-r--r--parse-ls-ext-block.cpp7
6 files changed, 46 insertions, 14 deletions
diff --git a/edid-decode.1 b/edid-decode.1
index 211d50a..2fb5e17 100644
--- a/edid-decode.1
+++ b/edid-decode.1
@@ -220,6 +220,11 @@ failures. But it will also change the output of edid-decode for every new commit
in the git repository, even if nothing else changed in the edid-decode output.
Use this option to avoid including the SHA in the edid-decode output.
.TP
+\fB\-\-hide\-serial\-numbers\fR
+Replace any serial numbers in the human readable output by '...'.
+Note that they are still easily extracted from the EDID hex dump at
+the start.
+.TP
\fB\-\-version\fR
Show the SHA hash and the last commit date.
.TP
diff --git a/edid-decode.cpp b/edid-decode.cpp
index 61ffe30..aae7a6b 100644
--- a/edid-decode.cpp
+++ b/edid-decode.cpp
@@ -55,6 +55,7 @@ enum Option {
OptV4L2Timings = 'V',
OptSkipHexDump = 's',
OptSkipSHA = 128,
+ OptHideSerialNumbers,
OptVersion,
OptLast = 256
};
@@ -70,6 +71,7 @@ static struct option long_options[] = {
{ "physical-address", no_argument, 0, OptPhysicalAddress },
{ "skip-hex-dump", no_argument, 0, OptSkipHexDump },
{ "skip-sha", no_argument, 0, OptSkipSHA },
+ { "hide-serial-numbers", no_argument, 0, OptHideSerialNumbers },
{ "version", no_argument, 0, OptVersion },
{ "check-inline", no_argument, 0, OptCheckInline },
{ "check", no_argument, 0, OptCheck },
@@ -110,6 +112,7 @@ static void usage(void)
" -V, --v4l2-timings report all long video timings in v4l2-dv-timings.h format\n"
" -s, --skip-hex-dump skip the initial hex dump of the EDID\n"
" --skip-sha skip the SHA report\n"
+ " --hide-serial-numbers replace serial numbers with '...'\n"
" --version show the edid-decode version (SHA)\n"
" -e, --extract extract the contents of the first block in hex values\n"
" -h, --help display this help message\n");
@@ -1084,6 +1087,8 @@ void edid_state::parse_extension(const unsigned char *x)
int edid_state::parse_edid()
{
+ hide_serial_numbers = options[OptHideSerialNumbers];
+
for (unsigned i = 1; i < num_blocks; i++)
preparse_extension(edid + i * EDID_PAGE_SIZE);
diff --git a/edid-decode.h b/edid-decode.h
index bb00e9b..72d75a0 100644
--- a/edid-decode.h
+++ b/edid-decode.h
@@ -94,6 +94,7 @@ struct edid_state {
min_vert_freq_hz = 0xffffffff;
warnings = failures = 0;
has_cta = has_dispid = false;
+ hide_serial_numbers = false;
// Base block state
base.edid_minor = 0;
@@ -144,6 +145,7 @@ struct edid_state {
std::string data_block;
bool has_cta;
bool has_dispid;
+ bool hide_serial_numbers;
unsigned min_hor_freq_hz;
unsigned max_hor_freq_hz;
@@ -285,6 +287,7 @@ struct edid_state {
void parse_displayid_type_3_timing(const unsigned char *x);
void parse_displayid_type_4_8_timing(unsigned char type, unsigned short id);
void parse_displayid_type_5_timing(const unsigned char *x);
+ void parse_displayid_tiled_display_topology(const unsigned char *x, bool is_v2);
void parse_displayid_type_6_timing(const unsigned char *x);
void parse_displayid_type_9_timing(const unsigned char *x);
void preparse_displayid_block(const unsigned char *x);
@@ -294,6 +297,7 @@ struct edid_state {
void parse_vtb_ext_block(const unsigned char *x);
+ void parse_string_table(const unsigned char *x);
void parse_ls_ext_block(const unsigned char *x);
void parse_block_map(const unsigned char *x);
diff --git a/parse-base-block.cpp b/parse-base-block.cpp
index 0042a39..965d04c 100644
--- a/parse-base-block.cpp
+++ b/parse-base-block.cpp
@@ -1511,12 +1511,16 @@ void edid_state::detailed_block(const unsigned char *x)
fail("Invalid trailing data.\n");
}
return;
- case 0xff:
+ case 0xff: {
data_block = "Display Product Serial Number";
- printf(" %s: '%s'\n", data_block.c_str(),
- extract_string(x + 5, 13));
+ char *sn = extract_string(x + 5, 13);
+ if (hide_serial_numbers)
+ printf(" %s: ...\n", data_block.c_str());
+ else
+ printf(" %s: '%s'\n", data_block.c_str(), sn);
base.has_serial_string = 1;
return;
+ }
default:
printf(" %s Display Descriptor (0x%02hhx):",
x[3] <= 0x0f ? "Manufacturer-Specified" : "Unknown", x[3]);
@@ -1553,10 +1557,14 @@ void edid_state::parse_base_block(const unsigned char *x)
manufacturer_name(x + 0x08),
(unsigned short)(x[0x0a] + (x[0x0b] << 8)));
base.has_serial_number = x[0x0c] || x[0x0d] || x[0x0e] || x[0x0f];
- if (base.has_serial_number)
- printf(" Serial Number: %u\n",
- (unsigned)(x[0x0c] + (x[0x0d] << 8) +
- (x[0x0e] << 16) + (x[0x0f] << 24)));
+ if (base.has_serial_number) {
+ if (hide_serial_numbers)
+ printf(" Serial Number: ...\n");
+ else
+ printf(" Serial Number: %u\n",
+ (unsigned)(x[0x0c] + (x[0x0d] << 8) +
+ (x[0x0e] << 16) + (x[0x0f] << 24)));
+ }
time(&the_time);
ptm = localtime(&the_time);
diff --git a/parse-displayid-block.cpp b/parse-displayid-block.cpp
index ad873a3..545f948 100644
--- a/parse-displayid-block.cpp
+++ b/parse-displayid-block.cpp
@@ -89,8 +89,12 @@ void edid_state::parse_displayid_product_id(const unsigned char *x)
}
printf(" Product Code: %u\n", x[6] | (x[7] << 8));
unsigned sn = x[8] | (x[9] << 8) | (x[10] << 16) | (x[11] << 24);
- if (sn)
- printf(" Serial Number: %u\n", sn);
+ if (sn) {
+ if (hide_serial_numbers)
+ printf(" Serial Number: ...\n");
+ else
+ printf(" Serial Number: %u\n", sn);
+ }
unsigned week = x[12];
unsigned year = 2000 + x[13];
printf(" %s: %u",
@@ -899,7 +903,7 @@ void edid_state::parse_displayid_type_5_timing(const unsigned char *x)
// tag 0x12 and 0x28
-static void parse_displayid_tiled_display_topology(const unsigned char *x, bool is_v2)
+void edid_state::parse_displayid_tiled_display_topology(const unsigned char *x, bool is_v2)
{
check_displayid_datablock_revision(x);
@@ -963,8 +967,11 @@ static void parse_displayid_tiled_display_topology(const unsigned char *x, bool
x[0x10], x[0x11], x[0x12]);
printf(" Tiled Display Product ID Code: %u\n",
x[0x13] | (x[0x14] << 8));
- printf(" Tiled Display Serial Number: %u\n",
- x[0x15] | (x[0x16] << 8) | (x[0x17] << 16)| (x[0x18] << 24));
+ if (hide_serial_numbers)
+ printf(" Tiled Display Serial Number: ...\n");
+ else
+ printf(" Tiled Display Serial Number: %u\n",
+ x[0x15] | (x[0x16] << 8) | (x[0x17] << 16)| (x[0x18] << 24));
}
// tag 0x13
diff --git a/parse-ls-ext-block.cpp b/parse-ls-ext-block.cpp
index e997744..1643f7d 100644
--- a/parse-ls-ext-block.cpp
+++ b/parse-ls-ext-block.cpp
@@ -15,7 +15,7 @@ static void parse_string(const char *name, const unsigned char *x)
hex_block("", x + 1, *x, true, *x);
}
-static void parse_string_table(const unsigned char *x)
+void edid_state::parse_string_table(const unsigned char *x)
{
printf(" UTF Type: ");
switch (x[0] & 7) {
@@ -46,7 +46,10 @@ static void parse_string_table(const unsigned char *x)
x += x[0] + 1;
parse_string("Model Name", x);
x += x[0] + 1;
- parse_string("Serial Number", x);
+ if (hide_serial_numbers)
+ printf(" Serial Number: ...\n");
+ else
+ parse_string("Serial Number", x);
}
void edid_state::parse_ls_ext_block(const unsigned char *x)

Privacy Policy