From b4ea36f997cb271631fbe2046e1f9675a49ea2e5 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Sun, 2 Oct 2022 21:01:14 -0500 Subject: [PATCH] If read byte fails, use read byte data for detecting ENE controller * The Nuvoton NCT6793D Super-IO SMBus controller does not actually support read byte or quick operations. The driver used for Windows and in the OpenRGB kernel patch will perform a read byte data operation in its place with a dummy address, but the driver I'm submitting upstream is not going to have this hack. All controllers that could be used on a Nuvoton SMBus will need a detection path that doesn't rely only on byte read or quick operations. --- .../ENESMBusController/ENESMBusControllerDetect.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Controllers/ENESMBusController/ENESMBusControllerDetect.cpp b/Controllers/ENESMBusController/ENESMBusControllerDetect.cpp index e5d80312..8f129799 100644 --- a/Controllers/ENESMBusController/ENESMBusControllerDetect.cpp +++ b/Controllers/ENESMBusController/ENESMBusControllerDetect.cpp @@ -128,7 +128,12 @@ bool TestForENESMBusController(i2c_smbus_interface* bus, unsigned char address) int res = bus->i2c_smbus_read_byte(address); - if (res >= 0) + if(res < 0) + { + res = bus->i2c_smbus_read_byte_data(address, 0x00); + } + + if(res >= 0) { pass = true;