mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-23 23:37:48 -05:00
Convert Corsair Vengeance RGB (non-Pro) controller to use DRAM SPD detector
This commit is contained in:
@@ -56,40 +56,41 @@ bool TestForCorsairVengeanceController(i2c_smbus_interface* bus, unsigned char a
|
||||
* *
|
||||
* Detect Corsair controllers on the enumerated I2C busses. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where Aura device is connected *
|
||||
* dev - I2C address of Aura device *
|
||||
* bus - pointer to i2c_smbus_interface where device is connected *
|
||||
* slots - list of SPD entries with matching JEDEC ID *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairVengeanceControllers(std::vector<i2c_smbus_interface*> &busses)
|
||||
void DetectCorsairVengeanceControllers(i2c_smbus_interface* bus, std::vector<SPDWrapper*> &slots)
|
||||
{
|
||||
for(unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
for(SPDWrapper *slot : slots)
|
||||
{
|
||||
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
|
||||
/*-------------------------------------------------*\
|
||||
| Test first address range 0x58-0x5F |
|
||||
\*-------------------------------------------------*/
|
||||
unsigned char address = slot->address() + 8;
|
||||
|
||||
if(TestForCorsairVengeanceController(bus, address))
|
||||
{
|
||||
for(unsigned char addr = 0x58; addr <= 0x5F; addr++)
|
||||
{
|
||||
if(TestForCorsairVengeanceController(busses[bus], addr))
|
||||
{
|
||||
CorsairVengeanceController* new_controller = new CorsairVengeanceController(busses[bus], addr);
|
||||
RGBController_CorsairVengeance* new_rgbcontroller = new RGBController_CorsairVengeance(new_controller);
|
||||
CorsairVengeanceController* new_controller = new CorsairVengeanceController(bus, address);
|
||||
RGBController_CorsairVengeance* new_rgbcontroller = new RGBController_CorsairVengeance(new_controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(new_rgbcontroller);
|
||||
}
|
||||
}
|
||||
for(unsigned char addr = 0x18; addr <= 0x1F; addr++)
|
||||
{
|
||||
if(TestForCorsairVengeanceController(busses[bus], addr))
|
||||
{
|
||||
CorsairVengeanceController* new_controller = new CorsairVengeanceController(busses[bus], addr);
|
||||
RGBController_CorsairVengeance* new_rgbcontroller = new RGBController_CorsairVengeance(new_controller);
|
||||
ResourceManager::get()->RegisterRGBController(new_rgbcontroller);
|
||||
}
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(new_rgbcontroller);
|
||||
}
|
||||
}
|
||||
/*-------------------------------------------------*\
|
||||
| Test second address range 0x18-0x1F |
|
||||
\*-------------------------------------------------*/
|
||||
address = slot->address() - 0x40 + 8;
|
||||
|
||||
if(TestForCorsairVengeanceController(bus, address))
|
||||
{
|
||||
CorsairVengeanceController* new_controller = new CorsairVengeanceController(bus, address);
|
||||
RGBController_CorsairVengeance* new_rgbcontroller = new RGBController_CorsairVengeance(new_controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(new_rgbcontroller);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectCorsairVengeanceControllers() */
|
||||
|
||||
REGISTER_I2C_DETECTOR("Corsair Vengeance", DetectCorsairVengeanceControllers);
|
||||
REGISTER_I2C_DIMM_DETECTOR("Corsair Vengeance RGB DRAM", DetectCorsairVengeanceControllers, JEDEC_CORSAIR, SPD_DDR4_SDRAM);
|
||||
|
||||
@@ -15,7 +15,7 @@ SPDWrapper::SPDWrapper(const SPDWrapper &wrapper)
|
||||
{
|
||||
this->accessor = wrapper.accessor->copy();
|
||||
}
|
||||
this->address = wrapper.address;
|
||||
this->addr = wrapper.addr;
|
||||
this->mem_type = wrapper.mem_type;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
@@ -35,13 +35,13 @@ SPDWrapper::SPDWrapper(const SPDWrapper &wrapper)
|
||||
|
||||
SPDWrapper::SPDWrapper(const SPDDetector &detector)
|
||||
{
|
||||
this->address = detector.spd_address();
|
||||
this->addr = detector.spd_address();
|
||||
this->mem_type = detector.memory_type();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Allocate a new accessor |
|
||||
\*-----------------------------------------------------*/
|
||||
this->accessor = SPDAccessor::for_memory_type(this->mem_type, detector.smbus(), this->address);
|
||||
this->accessor = SPDAccessor::for_memory_type(this->mem_type, detector.smbus(), this->addr);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Read the JEDEC ID and cache its value |
|
||||
@@ -68,9 +68,14 @@ SPDMemoryType SPDWrapper::memory_type()
|
||||
return mem_type;
|
||||
}
|
||||
|
||||
uint8_t SPDWrapper::address()
|
||||
{
|
||||
return this->addr;
|
||||
}
|
||||
|
||||
int SPDWrapper::index()
|
||||
{
|
||||
return this->address - 0x50;
|
||||
return this->addr - 0x50;
|
||||
}
|
||||
|
||||
uint16_t SPDWrapper::jedec_id()
|
||||
|
||||
@@ -20,6 +20,7 @@ class SPDWrapper
|
||||
SPDWrapper(const SPDDetector &detector);
|
||||
~SPDWrapper();
|
||||
|
||||
uint8_t address();
|
||||
SPDMemoryType memory_type();
|
||||
int index();
|
||||
uint16_t jedec_id();
|
||||
@@ -27,7 +28,7 @@ class SPDWrapper
|
||||
|
||||
private:
|
||||
SPDAccessor *accessor = nullptr;
|
||||
uint8_t address;
|
||||
uint8_t addr;
|
||||
uint16_t jedec_id_val;
|
||||
SPDMemoryType mem_type;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user