From 0083cde53e38531ae77b74435218d94344a50323 Mon Sep 17 00:00:00 2001 From: Jonathan Liu Date: Thu, 3 Feb 2022 23:30:56 +1100 Subject: QEdidParser: fix number of data blocks The EDID standard defines 4 x 18 byte descriptors: 54-71: Descriptor 1 72-89: Descriptor 2 90-107: Descriptor 3 108-125: Descriptor 4 Immediately following the 4th 18 byte descriptor are the following: 126: Number of extensions 127: Checksum Therefore the number of data blocks (known as descriptors in the EDID standard) should be 4 instead of 5. Pick-to: 5.15 6.2 6.3 Change-Id: I63555b9142125df17b26401d81a6717936832162 Reviewed-by: Friedemann Kleint Reviewed-by: Liang Qi --- src/gui/util/qedidparser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui/util') diff --git a/src/gui/util/qedidparser.cpp b/src/gui/util/qedidparser.cpp index b989503ec2..191eea710b 100644 --- a/src/gui/util/qedidparser.cpp +++ b/src/gui/util/qedidparser.cpp @@ -12,6 +12,7 @@ #define EDID_DESCRIPTOR_PRODUCT_NAME 0xfc #define EDID_DESCRIPTOR_SERIAL_NUMBER 0xff +#define EDID_DATA_BLOCK_COUNT 4 #define EDID_OFFSET_DATA_BLOCKS 0x36 #define EDID_OFFSET_LAST_BLOCK 0x6c #define EDID_OFFSET_PNP_ID 0x08 @@ -104,7 +105,7 @@ bool QEdidParser::parse(const QByteArray &blob) serialNumber = QString(); // Parse EDID data - for (int i = 0; i < 5; ++i) { + for (int i = 0; i < EDID_DATA_BLOCK_COUNT; ++i) { const uint offset = EDID_OFFSET_DATA_BLOCKS + i * 18; if (data[offset] != 0 || data[offset + 1] != 0 || data[offset + 2] != 0) -- cgit v1.2.3