Move HID detector calls to RunHIDDetector/RunHIDWrappedDetector functions and return controller list from detector functions

This commit is contained in:
Adam Honse
2026-01-12 19:05:21 -06:00
parent 1ccaadd5d0
commit 9bb2a4e693
197 changed files with 4481 additions and 4332 deletions

View File

@@ -18,15 +18,8 @@
#include "pci_ids.h"
using namespace std::chrono_literals;
#define PATRIOT_CONTROLLER_NAME "Patriot Viper"
/******************************************************************************************\
* *
* TestForPatriotViperController *
* *
* Tests the given address to see if a Patriot Viper controller exists there. *
* *
\******************************************************************************************/
#define PATRIOT_CONTROLLER_NAME "Patriot Viper"
bool TestForPatriotViperController(i2c_smbus_interface* bus, unsigned char address)
{
@@ -42,26 +35,16 @@ bool TestForPatriotViperController(i2c_smbus_interface* bus, unsigned char addre
}
return(pass);
}
} /* TestForPatriotViperController() */
/******************************************************************************************\
* *
* DetectPatriotViperControllers *
* *
* Detect Patriot Viper RGB controllers on the enumerated I2C busses. *
* *
* bus - pointer to i2c_smbus_interface where Aura device is connected *
* dev - I2C address of Aura device *
* *
\******************************************************************************************/
void DetectPatriotViperControllers(i2c_smbus_interface* bus, std::vector<SPDWrapper*> &slots, const std::string &/*name*/)
DetectedControllers DetectPatriotViperControllers(i2c_smbus_interface* bus, std::vector<SPDWrapper*> &slots, const std::string &/*name*/)
{
unsigned char slots_valid = 0x00;
DetectedControllers detected_controllers;
unsigned char slots_valid = 0x00;
// Check for Patriot Viper controller at 0x77
/*-----------------------------------------------------*\
| Check for Patriot Viper controller at 0x77 |
\*-----------------------------------------------------*/
LOG_DEBUG("[%s] Testing bus %d at address 0x77", PATRIOT_CONTROLLER_NAME, bus->port_id);
if(TestForPatriotViperController(bus, 0x77))
@@ -69,13 +52,13 @@ void DetectPatriotViperControllers(i2c_smbus_interface* bus, std::vector<SPDWrap
for(SPDWrapper *slot : slots)
{
if((slot->manufacturer_data(0x00) == 0x4D)
&&(slot->manufacturer_data(0x01) == 0x49)
&&(slot->manufacturer_data(0x02) == 0x43)
&&(slot->manufacturer_data(0x03) == 0x53)
&&(slot->manufacturer_data(0x04) == 0x59)
&&(slot->manufacturer_data(0x05) == 0x53)
&&(slot->manufacturer_data(0x06) == 0x5f)
&&(slot->manufacturer_data(0x07) == 0x44))
&&(slot->manufacturer_data(0x01) == 0x49)
&&(slot->manufacturer_data(0x02) == 0x43)
&&(slot->manufacturer_data(0x03) == 0x53)
&&(slot->manufacturer_data(0x04) == 0x59)
&&(slot->manufacturer_data(0x05) == 0x53)
&&(slot->manufacturer_data(0x06) == 0x5f)
&&(slot->manufacturer_data(0x07) == 0x44))
{
LOG_DEBUG("[%s] The RAM module detected in slot %d", PATRIOT_CONTROLLER_NAME, slot->index());
slots_valid |= (1 << (slot->index()));
@@ -86,11 +69,13 @@ void DetectPatriotViperControllers(i2c_smbus_interface* bus, std::vector<SPDWrap
{
PatriotViperController* controller = new PatriotViperController(bus, 0x77, slots_valid);
RGBController_PatriotViper* rgb_controller = new RGBController_PatriotViper(controller);
DetectionManager::get()->RegisterRGBController(rgb_controller);
detected_controllers.push_back(rgb_controller);
}
}
} /* DetectPatriotViperControllers() */
return(detected_controllers);
}
REGISTER_I2C_DRAM_DETECTOR(PATRIOT_CONTROLLER_NAME, DetectPatriotViperControllers, JEDEC_PATRIOT, SPD_DDR4_SDRAM);