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 0ccdd5329f
commit 3c4a72bda9
197 changed files with 4481 additions and 4332 deletions

View File

@@ -13,18 +13,10 @@
#include "DetectionManager.h"
#include "GainwardGPUv1Controller.h"
#include "GainwardGPUv2Controller.h"
#include "RGBController_GainwardGPUv1.h"
#include "RGBController_GainwardGPUv2.h"
#include "i2c_smbus.h"
#include "pci_ids.h"
/******************************************************************************************\
* *
* TestForGainwardGPUController *
* *
* Tests the given address to see if a Gainward GPU controller exists there. *
* *
\******************************************************************************************/
#include "RGBController_GainwardGPUv1.h"
#include "RGBController_GainwardGPUv2.h"
bool TestForGainwardGPUController(i2c_smbus_interface* bus, uint8_t i2c_addr)
{
@@ -32,21 +24,22 @@ bool TestForGainwardGPUController(i2c_smbus_interface* bus, uint8_t i2c_addr)
switch(i2c_addr)
{
/*-----------------------------------------------------------------*\
| V1 Controller |
\*-----------------------------------------------------------------*/
/*-------------------------------------------------*\
| V1 Controller |
\*-------------------------------------------------*/
case 0x08:
pass = bus->i2c_smbus_write_quick(i2c_addr, I2C_SMBUS_WRITE);
break;
/*-----------------------------------------------------------------*\
| V2 Controller |
\*-----------------------------------------------------------------*/
/*-------------------------------------------------*\
| V2 Controller |
\*-------------------------------------------------*/
case 0x49:
/*-------------------------------------------------------------*\
| This detection might need some modifications |
| Reading 0x6F*0x73 and comparing to 0x64 might be a possibility|
\*-------------------------------------------------------------*/
/*---------------------------------------------*\
| This detection might need some modifications |
| Reading 0x6F*0x73 and comparing to 0x64 might |
| be a possibility |
\*---------------------------------------------*/
s32 data = bus->i2c_smbus_read_byte_data(i2c_addr, 0x0);
s32 mode_data = bus->i2c_smbus_read_byte_data(i2c_addr, 0xe0);
pass = (data == 0x0) && (mode_data < 0x5);
@@ -54,50 +47,44 @@ bool TestForGainwardGPUController(i2c_smbus_interface* bus, uint8_t i2c_addr)
}
return(pass);
}
} /* TestForGainwardGPUController() */
/******************************************************************************************\
* *
* DetectGainwardGPUControllers *
* *
* Detect Gainward GPU controllers on the enumerated I2C busses. *
* *
\******************************************************************************************/
void DetectGainwardGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const std::string& name)
DetectedControllers DetectGainwardGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const std::string& name)
{
DetectedControllers detected_controllers;
if(TestForGainwardGPUController(bus, i2c_addr))
{
switch(i2c_addr)
{
/*-----------------------------------------------------------------*\
| V1 Controller |
\*-----------------------------------------------------------------*/
/*---------------------------------------------*\
| V1 Controller |
\*---------------------------------------------*/
case 0x08:
{
GainwardGPUv1Controller* controller = new GainwardGPUv1Controller(bus, i2c_addr, name);
RGBController_GainwardGPUv1* rgb_controller = new RGBController_GainwardGPUv1(controller);
DetectionManager::get()->RegisterRGBController(rgb_controller);
detected_controllers.push_back(rgb_controller);
}
break;
/*-----------------------------------------------------------------*\
| V2 Controller |
\*-----------------------------------------------------------------*/
/*---------------------------------------------*\
| V2 Controller |
\*---------------------------------------------*/
case 0x49:
{
GainwardGPUv2Controller* controller = new GainwardGPUv2Controller(bus, i2c_addr, name);
RGBController_GainwardGPUv2* rgb_controller = new RGBController_GainwardGPUv2(controller);
DetectionManager::get()->RegisterRGBController(rgb_controller);
detected_controllers.push_back(rgb_controller);
}
break;
}
}
} /* DetectGainwardGPUControllers() */
return(detected_controllers);
}
REGISTER_I2C_PCI_DETECTOR("Gainward GeForce GTX 1080 Phoenix", DetectGainwardGPUControllers, NVIDIA_VEN, NVIDIA_GTX1080_DEV, GAINWARD_SUB_VEN, GAINWARD_GTX_1080_PHOENIX, 0x08);
REGISTER_I2C_PCI_DETECTOR("Gainward GeForce GTX 1080 Ti Phoenix", DetectGainwardGPUControllers, NVIDIA_VEN, NVIDIA_GTX1080TI_DEV, GAINWARD_SUB_VEN, GAINWARD_GTX_1080TI_PHOENIX, 0x08);