11#include " Detector.h"
22#include " AsusAuraSMBusController.h"
3+ #include " LogManager.h"
34#include " RGBController.h"
45#include " RGBController_AsusAuraSMBus.h"
56#include " i2c_smbus.h"
@@ -88,21 +89,32 @@ bool TestForAsusAuraSMBusController(i2c_smbus_interface* bus, unsigned char addr
8889{
8990 bool pass = false ;
9091
92+ LOG_DEBUG (" Testing address %02X for Aura SMBus controller" , address);
93+
9194 int res = bus->i2c_smbus_write_quick (address, I2C_SMBUS_WRITE);
9295
9396 if (res >= 0 )
9497 {
9598 pass = true ;
9699
100+ LOG_DEBUG (" Detected an I2C device at address %02X, testing register range for Aura SMBus" , address);
101+
97102 for (int i = 0xA0 ; i < 0xB0 ; i++)
98103 {
99104 res = bus->i2c_smbus_read_byte_data (address, i);
100105
101106 if (res != (i - 0xA0 ))
102107 {
108+ LOG_DEBUG (" Detection failed testing register %02X. Expected %02X, got %02X." , i, (i - 0xA0 ), res);
109+
103110 pass = false ;
104111 }
105112 }
113+
114+ if (pass)
115+ {
116+ LOG_DEBUG (" Detection successful, address %02X appears to be an Aura SMBus controller" , address);
117+ }
106118 }
107119
108120 return (pass);
@@ -131,13 +143,16 @@ void DetectAsusAuraSMBusDRAMControllers(std::vector<i2c_smbus_interface*> &busse
131143
132144 IF_DRAM_SMBUS (busses[bus]->pci_vendor , busses[bus]->pci_device )
133145 {
134- // Remap Aura-enabled RAM modules on 0x77
146+ LOG_DEBUG (" Remapping Aura SMBus RAM modules on 0x77" );
147+
135148 for (unsigned int slot = 0 ; slot < 8 ; slot++)
136149 {
137150 int res = busses[bus]->i2c_smbus_write_quick (0x77 , I2C_SMBUS_WRITE);
138151
139152 if (res < 0 )
140153 {
154+ LOG_DEBUG (" No device detected at address 0x77, aborting remap" );
155+
141156 break ;
142157 }
143158
@@ -147,6 +162,8 @@ void DetectAsusAuraSMBusDRAMControllers(std::vector<i2c_smbus_interface*> &busse
147162
148163 if (address_list_idx < AURA_RAM_ADDRESS_COUNT)
149164 {
165+ LOG_DEBUG (" Testing address %02X to see if there is a device there" , aura_ram_addresses[address_list_idx]);
166+
150167 res = busses[bus]->i2c_smbus_write_quick (aura_ram_addresses[address_list_idx], I2C_SMBUS_WRITE);
151168 }
152169 else
@@ -157,6 +174,8 @@ void DetectAsusAuraSMBusDRAMControllers(std::vector<i2c_smbus_interface*> &busse
157174
158175 if (address_list_idx < AURA_RAM_ADDRESS_COUNT)
159176 {
177+ LOG_DEBUG (" Remapping slot %d to address %02X" , slot, aura_ram_addresses[address_list_idx]);
178+
160179 AsusAuraRegisterWrite (busses[bus], 0x77 , AURA_REG_SLOT_INDEX, slot);
161180 AsusAuraRegisterWrite (busses[bus], 0x77 , AURA_REG_I2C_ADDRESS, (aura_ram_addresses[address_list_idx] << 1 ));
162181 }
0 commit comments