All of lore.kernel.org
 help / color / mirror / Atom feed
From: joevt <joevt@shaw.ca>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, joevt <joevt@shaw.ca>
Subject: [PATCH 08/10] edid-decode: Dump hex of non-decoded extension blocks
Date: Sat, 23 Nov 2019 08:46:02 -0800	[thread overview]
Message-ID: <20191123164604.268-9-joevt@shaw.ca> (raw)
In-Reply-To: <20191123164604.268-1-joevt@shaw.ca>

- Extension blocks that are not decoded will at least have their contents output as hex. With this, two EDIDs with different data in an undecoded extension block will not be considered equal.
- For unknown extension blocks, include the Extension Block tag number.
- Renamed conformant_extension to nonconformant_extension in parse_extension because boolean value of 1 = nonconformant according to return result of parse_cta and parse_displayid; matches interpretation in edid_from_file.

Signed-off-by: Joe van Tunen <joevt@shaw.ca>
---
 edid-decode.c | 80 +++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 62 insertions(+), 18 deletions(-)

diff --git a/edid-decode.c b/edid-decode.c
index a40ee96..2f2f1c5 100644
--- a/edid-decode.c
+++ b/edid-decode.c
@@ -2474,7 +2474,7 @@ static void cta_block(const unsigned char *x)
 
 static int parse_cta(const unsigned char *x)
 {
-	int ret = 0;
+	int ret = 0; // 0 = conformant
 	unsigned version = x[1];
 	unsigned offset = x[2];
 	const unsigned char *detailed;
@@ -2483,7 +2483,7 @@ static int parse_cta(const unsigned char *x)
 
 	if (version >= 1) do {
 		if (version == 1 && x[3] != 0)
-			ret = 1;
+			ret = 1; // 1 = nonconformant
 
 		if (offset < 4)
 			break;
@@ -2866,28 +2866,72 @@ static void extension_version(const unsigned char *x)
 
 static int parse_extension(const unsigned char *x)
 {
-	int conformant_extension = 0;
+	int nonconformant_extension = 0;
 
 	printf("\n");
 
 	switch (x[0]) {
-	case 0x02: printf("CTA Extension Block\n");
-		   extension_version(x);
-		   conformant_extension = parse_cta(x);
-		   break;
-	case 0x10: printf("VTB Extension Block\n"); break;
-	case 0x40: printf("DI Extension Block\n"); break;
-	case 0x50: printf("LS Extension Block\n"); break;
-	case 0x60: printf("DPVL Extension Block\n"); break;
-	case 0x70: printf("DisplayID Extension Block\n");
-		   conformant_extension = parse_displayid(x);
-		   break;
-	case 0xf0: printf("Block map\n"); break;
-	case 0xff: printf("Manufacturer-specific Extension Block\n"); break;
-	default:   printf("Unknown Extension Block\n"); break;
+	case 0x02:
+		printf("CTA Extension Block\n");
+		extension_version(x);
+		nonconformant_extension = parse_cta(x);
+		break;
+	case 0x10:
+		printf("VTB Extension Block\n");
+		extension_version(x);
+		printf("  ");
+		hex_block(x + 2, 125);
+		do_checksum(x, EDID_PAGE_SIZE);
+		break;
+	case 0x40:
+		printf("DI Extension Block\n");
+		extension_version(x);
+		printf("  ");
+		hex_block(x + 2, 125);
+		do_checksum(x, EDID_PAGE_SIZE);
+		break;
+	case 0x50:
+		printf("LS Extension Block\n");
+		extension_version(x);
+		printf("  ");
+		hex_block(x + 2, 125);
+		do_checksum(x, EDID_PAGE_SIZE);
+		break;
+	case 0x60:
+		printf("DPVL Extension Block\n");
+		extension_version(x);
+		printf("  ");
+		hex_block(x + 2, 125);
+		do_checksum(x, EDID_PAGE_SIZE);
+		break;
+	case 0x70:
+		printf("DisplayID Extension Block\n");
+		nonconformant_extension = parse_displayid(x);
+		do_checksum(x, EDID_PAGE_SIZE);
+		break;
+	case 0xf0:
+		printf("Block map\n");
+		printf("  ");
+		hex_block(x + 1, 126);
+		do_checksum(x, EDID_PAGE_SIZE);
+		break;
+	case 0xff:
+		printf("Manufacturer-specific Extension Block\n");
+		extension_version(x);
+		printf("  ");
+		hex_block(x + 2, 125);
+		do_checksum(x, EDID_PAGE_SIZE);
+		break;
+	default:
+		printf("Unknown Extension Block (%02Xh)\n", x[0]);
+		extension_version(x);
+		printf("  ");
+		hex_block(x + 2, 125);
+		do_checksum(x, EDID_PAGE_SIZE);
+		break;
 	}
 
-	return conformant_extension;
+	return nonconformant_extension;
 }
 
 static int edid_lines = 0;
-- 
2.21.0 (Apple Git-122.2)


  parent reply	other threads:[~2019-11-23 16:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-23 16:45 [PATCH 00/10] edid-decode: bug fixes, additions, changes joevt
2019-11-23 16:45 ` [PATCH 01/10] edid-decode: change horizontal refresh rates to kHz joevt
2019-11-23 16:45 ` [PATCH 02/10] edid-decode: correct horizontal range in Monitor Ranges joevt
2019-11-23 16:45 ` [PATCH 03/10] edid-decode: correct calculation of DisplayID type 1 timings joevt
2019-11-23 16:45 ` [PATCH 04/10] edid-decode: add front porch, pulse width, and back porch joevt
2019-11-23 16:45 ` [PATCH 05/10] edid-decode: output timings for YCbCr 4:2:0 cmdb joevt
2019-11-24 10:26   ` Hans Verkuil
2019-11-25  6:32     ` Joe van Tunen
2019-11-25  8:20       ` Hans Verkuil
2019-11-23 16:46 ` [PATCH 06/10] edid-decode: Dump hex of unknown CTA Vendor-Specific blocks joevt
2019-11-23 16:46 ` [PATCH 07/10] edid-decode: cleanup printf format string compiler warnings joevt
2019-11-23 16:46 ` joevt [this message]
2019-11-23 16:46 ` [PATCH 09/10] edid-decode: DisplayID additions joevt
2019-11-24 10:03   ` Hans Verkuil
2019-11-25  6:30     ` Joe van Tunen
2019-11-25  9:15       ` Hans Verkuil
2019-11-23 16:46 ` [PATCH 10/10] edid-decode: add example EDIDs joevt
2019-11-24 11:10   ` Hans Verkuil
2019-11-24 11:12 ` [PATCH 00/10] edid-decode: bug fixes, additions, changes Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191123164604.268-9-joevt@shaw.ca \
    --to=joevt@shaw.ca \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.