mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-01-22 14:07:53 -05:00
Move HID detector calls to RunHIDDetector/RunHIDWrappedDetector functions and return controller list from detector functions
This commit is contained in:
@@ -18,21 +18,14 @@
|
||||
|
||||
#define GIGABYTEGPU_CONTROLLER_NAME "Gigabyte RGB Fusion GPU"
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForGigabyteRGBFusionGPUController *
|
||||
* *
|
||||
* Tests the given address to see if an RGB Fusion controller exists there. First *
|
||||
* does a quick write to test for a response *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForGigabyteRGBFusionGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
int res;
|
||||
|
||||
//Write out 0xAB 0x00 0x00 0x00 sequence
|
||||
/*-----------------------------------------------------*\
|
||||
| Write out 0xAB 0x00 0x00 0x00 sequence |
|
||||
\*-----------------------------------------------------*/
|
||||
res = bus->i2c_smbus_write_byte(address, 0xAB);
|
||||
|
||||
if (res >= 0)
|
||||
@@ -41,7 +34,10 @@ bool TestForGigabyteRGBFusionGPUController(i2c_smbus_interface* bus, unsigned ch
|
||||
bus->i2c_smbus_write_byte(address, 0x00);
|
||||
bus->i2c_smbus_write_byte(address, 0x00);
|
||||
|
||||
// NVIDIA_RTX3060_DEV requires additional bytes to initialise
|
||||
/*-------------------------------------------------*\
|
||||
| NVIDIA_RTX3060_DEV requires additional bytes to |
|
||||
| initialise |
|
||||
\*-------------------------------------------------*/
|
||||
if (address == 0x62)
|
||||
{
|
||||
bus->i2c_smbus_write_byte(address, 0x00);
|
||||
@@ -71,7 +67,10 @@ bool TestForGigabyteRGBFusionGPUController(i2c_smbus_interface* bus, unsigned ch
|
||||
bus->i2c_smbus_read_byte(address);
|
||||
bus->i2c_smbus_read_byte(address);
|
||||
|
||||
//We don't know what the 0x48 controller returns, so for now just assume it exists
|
||||
/*-------------------------------------------------*\
|
||||
| We don't know what the 0x48 controller returns, |
|
||||
| so for now just assume it exists |
|
||||
\*-------------------------------------------------*/
|
||||
if(address == 0x48)
|
||||
{
|
||||
pass = true;
|
||||
@@ -79,31 +78,25 @@ bool TestForGigabyteRGBFusionGPUController(i2c_smbus_interface* bus, unsigned ch
|
||||
}
|
||||
|
||||
return(pass);
|
||||
}
|
||||
|
||||
} /* TestForRGBFusionGPUController() */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectRGBFusionGPUControllers *
|
||||
* *
|
||||
* Detect GigabyteRGB Fusion controllers on the enumerated I2C busses at address 0x47.*
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where RGB Fusion device is connected *
|
||||
* dev - I2C address of RGB Fusion device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectGigabyteRGBFusionGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const std::string& name)
|
||||
DetectedControllers DetectGigabyteRGBFusionGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const std::string& name)
|
||||
{
|
||||
// Check for RGB Fusion controller
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Check for RGB Fusion controller |
|
||||
\*-----------------------------------------------------*/
|
||||
if(TestForGigabyteRGBFusionGPUController(bus, i2c_addr))
|
||||
{
|
||||
RGBFusionGPUController* controller = new RGBFusionGPUController(bus, i2c_addr, name);
|
||||
RGBController_RGBFusionGPU* rgb_controller = new RGBController_RGBFusionGPU(controller);
|
||||
|
||||
DetectionManager::get()->RegisterRGBController(rgb_controller);
|
||||
detected_controllers.push_back(rgb_controller);
|
||||
}
|
||||
} /* DetectGigabyteRGBFusionGPUControllers() */
|
||||
|
||||
return(detected_controllers);
|
||||
}
|
||||
|
||||
REGISTER_I2C_PCI_DETECTOR("Gigabyte GeForce GTX 1050 Ti G1 Gaming Rev A1", DetectGigabyteRGBFusionGPUControllers, NVIDIA_VEN, NVIDIA_GTX1050TI_DEV, GIGABYTE_SUB_VEN, GIGABYTE_GTX1050TI_G1_GAMING_SUB_DEV, 0x47);
|
||||
REGISTER_I2C_PCI_DETECTOR("Gigabyte GeForce GTX 1050 Ti G1 Gaming", DetectGigabyteRGBFusionGPUControllers, NVIDIA_VEN, NVIDIA_GTX1050TI_DEV, GIGABYTE_SUB_VEN, GIGABYTE_GTX1050TI_G1_GAMING_SUB_DEV, 0x48);
|
||||
|
||||
Reference in New Issue
Block a user