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 <Friedemann.Kleint@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
Jonathan Liu 2022-02-03 23:30:56 +11:00
parent 8aacf83a76
commit 0083cde53e

View File

@ -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)