aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoevt <joevt@shaw.ca>2021-09-26 01:33:16 -0700
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-09-27 12:19:33 +0200
commitb6361986212d3e031d78e2970996369107e109fc (patch)
tree8bd2f2b36a48fa400095b5f0980d41e5de911485
parent8bf78e443e0487b2dff5845366cd4d4e04ea72f6 (diff)
edid-decode: change unknown CTA block names
Make consistent the Unknown CTA-861 Data Block names and warnings. - Add " Data Block" suffix for normal tags (like unknown extended tags and known normal tags have). - Put tag in parenthesis (like unknown extended tags). - Output colon after unknown block name (like known tags). - Make warning same as block name (so the block mentioned in the warning section can be found more easily in the edid output). 1) Unknown normal tags: Before: - name: "Unknown CTA-861 tag 0x$$" - warning: "Unknown CTA-861 Data Block #." After: "Unknown CTA-861 Data Block (tag 0x$$):" (with period instead of colon for warning) 2) Unknown extended tags: Before: - name: "Unknown CTA-861 @Data Block (extended tag 0x$$)" (@ = "", "Video-Related ", "Audio-Related ", "HDMI-Related ") - warning: "Unknown Extended CTA-861 Data Block 0x$$." After: - "Unknown CTA-861 @Data Block (extended tag 0x$$):" (with period instead of colon for warning) We still have the following from a previous commit: 3) Truncated extended tag (when length is not enough to get the extended tag): Before: name: "Unknown CTA-861 Data Block (extended tag truncated):" failure: "Extended tag cannot have zero length." Since the name is different than the failure message, we should set data_block so both are output to the failure section: After: failure: "Unknown CTA-861 Data Block (extended tag truncated): Extended tag cannot have zero length." Signed-off-by: Joe van Tunen <joevt@shaw.ca> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--parse-cta-block.cpp33
1 files changed, 12 insertions, 21 deletions
diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp
index 6df5a50..4a66ce8 100644
--- a/parse-cta-block.cpp
+++ b/parse-cta-block.cpp
@@ -2057,7 +2057,7 @@ void edid_state::cta_block(const unsigned char *x, bool duplicate)
case 0x04: data_block = "Speaker Allocation Data Block"; audio_block = true; break;
case 0x05: data_block = "VESA Display Transfer Characteristics Data Block"; break;
- case 0x07: data_block.clear(); break;
+ case 0x07: data_block = "Unknown CTA-861 Data Block (extended tag truncated)"; break;
case 0x700: data_block = "Video Capability Data Block"; break;
case 0x701: data_block.clear(); break;
@@ -2088,22 +2088,16 @@ void edid_state::cta_block(const unsigned char *x, bool duplicate)
default:
data_block.clear();
- if (tag < 0x700) {
- printf(" Unknown CTA-861 tag 0x%02x\n", tag);
- warn("Unknown CTA-861 Data Block %u.\n", tag);
- }
- else {
- if (tag < 0x70d)
- printf(" Unknown CTA-861 Video-Related");
- else if (tag < 0x720)
- printf(" Unknown CTA-861 Audio-Related");
- else if (tag >= 0x778 && tag <= 0x77f)
- printf(" Unknown CTA-861 HDMI-Related");
- else
- printf(" Unknown CTA-861");
- printf(" Data Block (extended tag 0x%02x)\n", tag & 0xff);
- warn("Unknown Extended CTA-861 Data Block 0x%02x.\n", tag & 0xff);
- }
+ std::string unknown_name;
+ if (tag < 0x700) unknown_name = "Unknown CTA-861 Data Block";
+ else if (tag < 0x70d) unknown_name = "Unknown CTA-861 Video-Related Data Block";
+ else if (tag < 0x720) unknown_name = "Unknown CTA-861 Audio-Related Data Block";
+ else if (tag < 0x778) unknown_name = "Unknown CTA-861 Data Block";
+ else if (tag < 0x780) unknown_name = "Unknown CTA-861 HDMI-Related Data Block";
+ else unknown_name = "Unknown CTA-861 Data Block";
+ unknown_name += std::string(" (") + (extended ? "extended " : "") + "tag " + utohex(tag & 0xff) + ")";
+ printf(" %s:\n", unknown_name.c_str());
+ warn("%s.\n", unknown_name.c_str());
}
if (data_block.length())
@@ -2169,10 +2163,7 @@ void edid_state::cta_block(const unsigned char *x, bool duplicate)
break;
case 0x04: cta_sadb(x, length); break;
case 0x05: cta_vesa_dtcdb(x, length); break;
- case 0x07:
- printf(" Unknown CTA-861 Data Block (extended tag truncated):\n");
- fail("Extended tag cannot have zero length.\n");
- break;
+ case 0x07: fail("Extended tag cannot have zero length.\n"); break;
case 0x700: cta_vcdb(x, length); break;
case 0x701:
data_block_o("Vendor-Specific Video Data Block");

Privacy Policy