From ce2da62288dcbe43388a287b37771ef114b46b59 Mon Sep 17 00:00:00 2001 From: zakk4223 Date: Wed, 10 Aug 2022 07:09:38 -0400 Subject: [PATCH] Test for existence of hdmi clock before querying edid (#676) Don't forget to close fd Co-authored-by: Zakk --- video.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/video.cpp b/video.cpp index 8e4eb26..bb8777e 100644 --- a/video.cpp +++ b/video.cpp @@ -1393,6 +1393,15 @@ static int get_active_edid() return 0; } + //Test if adv7513 senses hdmi clock. If not, don't bother with the edid query + int hpd_state = i2c_smbus_read_byte_data(fd, 0x42); + if (hpd_state < 0 || !(hpd_state & 0x20)) + { + i2c_close(fd); + return 0; + } + + for (int i = 0; i < 10; i++) { i2c_smbus_write_byte_data(fd, 0xC9, 0x03);