Rework RGBControllers and detectors that set string fields other than name outside of the RGBController
This commit is contained in:
parent
6a472437bb
commit
abd34f1810
15 changed files with 40 additions and 27 deletions
|
|
@ -52,6 +52,7 @@ RGBController_ENESMBus::RGBController_ENESMBus(ENESMBusController * controller_p
|
|||
| the ENE controller's version string |
|
||||
\*---------------------------------------------------------*/
|
||||
version = controller->GetDeviceName();
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
if((version.find("DIMM_LED") != std::string::npos) || (version.find("AUDA") != std::string::npos) )
|
||||
{
|
||||
|
|
@ -65,6 +66,12 @@ RGBController_ENESMBus::RGBController_ENESMBus(ENESMBusController * controller_p
|
|||
name = "ASUS ROG Strix Arion";
|
||||
vendor = "ASUS";
|
||||
}
|
||||
else if(location.find("NVMe:") != std::string::npos)
|
||||
{
|
||||
type = DEVICE_TYPE_STORAGE;
|
||||
name = "XPG Spectrix S40G";
|
||||
vendor = "XPG";
|
||||
}
|
||||
else
|
||||
{
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
|
|
@ -72,7 +79,6 @@ RGBController_ENESMBus::RGBController_ENESMBus(ENESMBusController * controller_p
|
|||
vendor = "ASUS";
|
||||
}
|
||||
|
||||
location = controller->GetDeviceLocation();
|
||||
description = "ENE SMBus Device";
|
||||
|
||||
mode Direct;
|
||||
|
|
|
|||
|
|
@ -82,10 +82,6 @@ void DetectSpectrixS40GControllers()
|
|||
ENESMBusController* controller = new ENESMBusController(interface, 0x67);
|
||||
RGBController_ENESMBus* rgb_controller = new RGBController_ENESMBus(controller);
|
||||
|
||||
rgb_controller->name = "XPG Spectrix S40G";
|
||||
rgb_controller->type = DEVICE_TYPE_STORAGE;
|
||||
rgb_controller->vendor = "XPG";
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,10 +116,6 @@ void DetectSpectrixS40GControllers()
|
|||
ENESMBusController* controller = new ENESMBusController(interface, 0x67);
|
||||
RGBController_ENESMBus* rgb_controller = new RGBController_ENESMBus(controller);
|
||||
|
||||
rgb_controller->name = "XPG Spectrix S40G";
|
||||
rgb_controller->type = DEVICE_TYPE_STORAGE;
|
||||
rgb_controller->vendor = "XPG";
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,9 +227,9 @@ void DetectLianLiGAIITrinity(hid_device_info* info, const std::string& /*name*/)
|
|||
|
||||
if(dev)
|
||||
{
|
||||
LianLiGAIITrinityController* controller = new LianLiGAIITrinityController(dev);
|
||||
LianLiGAIITrinityController* controller = new LianLiGAIITrinityController(dev, info->path);
|
||||
RGBController_LianLiGAIITrinity* rgb_controller = new RGBController_LianLiGAIITrinity(controller);
|
||||
rgb_controller->location = "HID: " + std::string(info->path);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@
|
|||
#include "LianLiGAIITrinityController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
LianLiGAIITrinityController::LianLiGAIITrinityController(hid_device* dev_handle)
|
||||
LianLiGAIITrinityController::LianLiGAIITrinityController(hid_device* dev_handle, char* path)
|
||||
{
|
||||
dev = dev_handle;
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
}
|
||||
|
||||
LianLiGAIITrinityController::~LianLiGAIITrinityController()
|
||||
|
|
@ -29,6 +30,11 @@ LianLiGAIITrinityController::~LianLiGAIITrinityController()
|
|||
}
|
||||
}
|
||||
|
||||
std::string LianLiGAIITrinityController::GetLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
LianLiGAIITrinityController::GAII_Info LianLiGAIITrinityController::GetControllerInfo()
|
||||
{
|
||||
GAII_Info controllerInfo;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
|
@ -110,9 +111,11 @@ public:
|
|||
BA_DIRECTION = 0x16,
|
||||
};
|
||||
|
||||
LianLiGAIITrinityController(hid_device* dev_handle);
|
||||
LianLiGAIITrinityController(hid_device* dev_handle, char* path);
|
||||
~LianLiGAIITrinityController();
|
||||
|
||||
std::string GetLocation();
|
||||
|
||||
GAII_Info GetControllerInfo();
|
||||
|
||||
void SetMode_Rainbow(GAII_Brightness brightness, GAII_Speed speed, GAII_Direction direction);
|
||||
|
|
@ -132,6 +135,7 @@ public:
|
|||
void SetMode_ColorsMorph(GAII_Brightness brightness, GAII_Speed speed, GAII_Direction direction);
|
||||
|
||||
private:
|
||||
std::string location;
|
||||
unsigned char* GetRGBControlPacketTemplate();
|
||||
void SetRGB(unsigned char* usb_buf, RGBColor rgb0) { SetRGB(usb_buf, &rgb0, nullptr, nullptr, nullptr); };
|
||||
void SetRGB(unsigned char* usb_buf, RGBColor rgb0, RGBColor rgb1) { SetRGB(usb_buf, &rgb0, &rgb1, nullptr, nullptr); };
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ RGBController_LianLiGAIITrinity::RGBController_LianLiGAIITrinity(LianLiGAIITrini
|
|||
vendor = "Lian Li";
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
description = "Lian Li Galahad II Trinity AIO";
|
||||
location = controller->GetLocation();
|
||||
|
||||
LianLiGAIITrinityController::GAII_Info controllerInfo = controller->GetControllerInfo();
|
||||
version = controllerInfo.version;
|
||||
|
|
|
|||
|
|
@ -11,10 +11,11 @@
|
|||
|
||||
#include "PNYGPUController.h"
|
||||
|
||||
PNYGPUController::PNYGPUController(i2c_smbus_interface* bus, pny_dev_id dev)
|
||||
PNYGPUController::PNYGPUController(i2c_smbus_interface* bus, pny_dev_id dev, std::string name)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
PNYGPUController::~PNYGPUController()
|
||||
|
|
@ -22,6 +23,11 @@ PNYGPUController::~PNYGPUController()
|
|||
|
||||
}
|
||||
|
||||
std::string PNYGPUController::GetDeviceName()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string PNYGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
|
|
|
|||
|
|
@ -37,9 +37,10 @@ enum
|
|||
class PNYGPUController
|
||||
{
|
||||
public:
|
||||
PNYGPUController(i2c_smbus_interface* bus, pny_dev_id dev);
|
||||
PNYGPUController(i2c_smbus_interface* bus, pny_dev_id dev, std::string name);
|
||||
~PNYGPUController();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
|
||||
void SetOff();
|
||||
|
|
@ -50,6 +51,7 @@ public:
|
|||
private:
|
||||
i2c_smbus_interface* bus;
|
||||
pny_dev_id dev;
|
||||
std::string name;
|
||||
|
||||
void WriteI2CData(u8 command, u8 length, u8* data);
|
||||
unsigned char GetMode();
|
||||
|
|
|
|||
|
|
@ -33,10 +33,8 @@ void DetectPNYGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const s
|
|||
return;
|
||||
}
|
||||
|
||||
PNYGPUController* controller = new PNYGPUController(bus, i2c_addr);
|
||||
PNYGPUController* controller = new PNYGPUController(bus, i2c_addr, name);
|
||||
RGBController_PNYGPU* rgb_controller = new RGBController_PNYGPU(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->vendor = name.substr(0, name.find(' '));
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
} /* DetectPNYGPUControllers() */
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ RGBController_PNYGPU::RGBController_PNYGPU(PNYGPUController* controller_ptr)
|
|||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "PNY/Palit GPU";
|
||||
vendor = "PNY/Palit";
|
||||
name = controller->GetDeviceName();
|
||||
vendor = name.substr(0, name.find(' '));
|
||||
description = "PNY/Palit RGB GPU Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ void DetectPNYLovelaceGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr,
|
|||
PNYLovelaceGPUController* controller = new PNYLovelaceGPUController(bus, i2c_addr);
|
||||
RGBController_PNYLovelaceGPU* rgb_controller = new RGBController_PNYLovelaceGPU(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->vendor = name.substr(0, name.find(' '));
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
} /* DetectPNYLovelaceGPUControllers() */
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ void DetectPalitGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const
|
|||
PalitGPUController* controller = new PalitGPUController(bus, i2c_addr);
|
||||
RGBController_PalitGPU* rgb_controller = new RGBController_PalitGPU(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->vendor = name.substr(0, name.find(' '));
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
} /* DetectPalitGPUControllers() */
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ void DetectPhilipsHueControllers()
|
|||
{
|
||||
for(unsigned int controller_idx = 0; controller_idx < ResourceManager::get()->GetRGBControllers().size(); controller_idx++)
|
||||
{
|
||||
if(ResourceManager::get()->GetRGBControllers()[controller_idx]->description == "Philips Hue Entertainment Mode Device")
|
||||
if(ResourceManager::get()->GetRGBControllers()[controller_idx]->GetDescription() == "Philips Hue Entertainment Mode Device")
|
||||
{
|
||||
ResourceManager::get()->GetRGBControllers()[controller_idx]->SetMode(0);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ void RGBController_PhilipsHueEntertainment::DeviceUpdateMode()
|
|||
|
||||
for(unsigned int controller_idx = 0; controller_idx < rgb_controllers.size(); controller_idx++)
|
||||
{
|
||||
if(rgb_controllers[controller_idx] != this && rgb_controllers[controller_idx]->description == "Philips Hue Entertainment Mode Device" && rgb_controllers[controller_idx]->active_mode == 0)
|
||||
if(rgb_controllers[controller_idx] != this && rgb_controllers[controller_idx]->GetDescription() == "Philips Hue Entertainment Mode Device" && rgb_controllers[controller_idx]->active_mode == 0)
|
||||
{
|
||||
rgb_controllers[controller_idx]->SetMode(1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue