diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2018-08-13 13:30:13 +0200 |
---|---|---|
committer | Hans Verkuil <hans.verkuil@cisco.com> | 2018-08-13 13:30:13 +0200 |
commit | b2da1516df3cc2756bfe8d1fa06d7bf2562ba1f4 (patch) | |
tree | 83442af0b769599dd9e152b0883e5ec7dd002a77 | |
parent | e9ffafc3d7aa54f854388fc06a06007c2557377e (diff) |
edid-decode: add --extract and --check options
Use --extract to extract the contents of the first EDID block
as hex values. The was the default in old versions, use this
option to see this data again. I don't see the use of this
hex dump, so I turned it off by default.
If you want to check the EDID if it conforms to the standards,
then use the --check option.
So now the default behavior of edid-decode when run without these
options is to just parse the EDID and show it in human-readable text,
which is what you want.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r-- | edid-decode.1 | 8 | ||||
-rw-r--r-- | edid-decode.c | 26 |
2 files changed, 28 insertions, 6 deletions
diff --git a/edid-decode.1 b/edid-decode.1 index 652ad56..7c9789a 100644 --- a/edid-decode.1 +++ b/edid-decode.1 @@ -39,6 +39,14 @@ hex: hex numbers in ascii text (default for stdout) raw: binary data (default unless writing to stdout) .br carray: c-program struct +.TP +\fB\-c\fR, \fB\-\-check\fR +Check if the EDID conforms to the standards. +.TP +\fB\-e\fR, \fB\-\-extract\fR +Extract the contents of the first block in hex values. +This was always done in old edid-decode versions. To get +the same behavior add this option. .PP .SH NOTES diff --git a/edid-decode.c b/edid-decode.c index c643454..6b02514 100644 --- a/edid-decode.c +++ b/edid-decode.c @@ -111,8 +111,14 @@ enum output_format { OUT_FMT_CARRAY }; -/* Options */ +/* + * Options + * Please keep in alphabetical order of the short option. + * That makes it easier to see which options are still free. + */ enum Option { + OptCheck = 'c', + OptExtract = 'e', OptHelp = 'h', OptOutputFormat = 'o', OptLast = 256 @@ -121,10 +127,10 @@ enum Option { static char options[OptLast]; static struct option long_options[] = { - /* Please keep in alphabetical order of the short option. - That makes it easier to see which options are still free. */ { "help", no_argument, 0, OptHelp }, { "output-format", required_argument, 0, OptOutputFormat }, + { "extract", no_argument, 0, OptExtract }, + { "check", no_argument, 0, OptCheck }, { 0, 0, 0, 0 } }; @@ -136,13 +142,15 @@ static void usage(void) " [out] Output the read EDID to this file. Write to standard output\n" " if the output filename is '-'.\n" "\nOptions:\n" - " -h, --help display this help message\n" " -o, --output-format=<fmt>\n" " if [out] is specified, then write the EDID in this format\n" " <fmt> is one of:\n" " hex: hex numbers in ascii text (default for stdout)\n" " raw: binary data (default unless writing to stdout)\n" - " carray: c-program struct\n"); + " carray: c-program struct\n" + " -c, --check check if the EDID conforms to the standards\n" + " -e, --extract extract the contents of the first block in hex values\n" + " -h, --help display this help message\n"); } struct value { @@ -2902,7 +2910,8 @@ static int edid_from_file(const char *from_file, const char *to_file, fclose(out); } - dump_breakdown(edid); + if (options[OptExtract]) + dump_breakdown(edid); if (!edid || memcmp(edid, "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00", 8)) { fprintf(stderr, "No header found\n"); @@ -3156,6 +3165,11 @@ static int edid_from_file(const char *from_file, const char *to_file, nonconformant_extension += parse_extension(x); } + if (!options[OptCheck]) { + free(edid); + return 0; + } + if (claims_one_point_three) { if (nonconformant_digital_display || nonconformant_hf_vsdb_position || |