mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-05-24 06:25:01 -04:00
Implement network request to get list of I2C buses so that the Get Hardware IDs dialog works in local client mode
This commit is contained in:
@@ -36,7 +36,7 @@ ASRockASRRGBSMBusController::~ASRockASRRGBSMBusController()
|
||||
|
||||
std::string ASRockASRRGBSMBusController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -36,7 +36,7 @@ ASRockPolychromeV1SMBusController::~ASRockPolychromeV1SMBusController()
|
||||
|
||||
std::string ASRockPolychromeV1SMBusController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -37,7 +37,7 @@ ASRockPolychromeV2SMBusController::~ASRockPolychromeV2SMBusController()
|
||||
|
||||
std::string ASRockPolychromeV2SMBusController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -91,9 +91,9 @@ DetectedControllers DetectASRockSMBusControllers(std::vector<i2c_smbus_interface
|
||||
|
||||
for(unsigned int bus = 0; bus < buses.size(); bus++)
|
||||
{
|
||||
IF_MOBO_SMBUS(buses[bus]->pci_vendor, buses[bus]->pci_device)
|
||||
IF_MOBO_SMBUS(buses[bus]->info.pci_vendor, buses[bus]->info.pci_device)
|
||||
{
|
||||
if(buses[bus]->pci_subsystem_vendor == ASROCK_SUB_VEN)
|
||||
if(buses[bus]->info.pci_subsystem_vendor == ASROCK_SUB_VEN)
|
||||
{
|
||||
LOG_DEBUG(SMBUS_CHECK_DEVICE_MESSAGE_EN, ASROCK_DETECTOR_NAME, bus, VENDOR_NAME, SMBUS_ADDRESS);
|
||||
// Check for Polychrome controller at 0x6A
|
||||
|
||||
@@ -32,7 +32,7 @@ std::string AuraGPUController::GetDeviceName()
|
||||
|
||||
std::string AuraGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
@@ -79,7 +79,7 @@ void AuraGPUController::AuraGPURegisterWrite(unsigned char reg, unsigned char va
|
||||
|
||||
bool AuraGPUController::SaveOnlyApplies()
|
||||
{
|
||||
switch (bus->pci_subsystem_device)
|
||||
switch (bus->info.pci_subsystem_device)
|
||||
{
|
||||
case ASUS_VEGA64_STRIX:
|
||||
return false;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
bool TestForAsusAuraGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
if(bus->pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
|
||||
if(bus->info.pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ ColorfulGPUController::~ColorfulGPUController()
|
||||
|
||||
std::string ColorfulGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
@@ -45,7 +45,7 @@ void ColorfulGPUController::SetDirect(RGBColor color)
|
||||
uint8_t g = RGBGetGValue(color);
|
||||
uint8_t b = RGBGetBValue(color);
|
||||
|
||||
if(this->bus->pci_subsystem_device == COLORFUL_IGAME_RTX_4070_VULCAN_OCV)
|
||||
if(this->bus->info.pci_subsystem_device == COLORFUL_IGAME_RTX_4070_VULCAN_OCV)
|
||||
{
|
||||
uint8_t data_pkt[COLORFUL_PACKET_LENGTH_V2] = { 0xAA, 0xEF, 0x01, 0x04, 0x88, 0x26 };
|
||||
for(int i=6; i < COLORFUL_PACKET_LENGTH_V2 -2; i = i + 3)
|
||||
|
||||
@@ -24,7 +24,7 @@ ColorfulTuringGPUController::~ColorfulTuringGPUController()
|
||||
|
||||
std::string ColorfulTuringGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -17,7 +17,7 @@ DetectedControllers DetectColorfulTuringGPUControllers(i2c_smbus_interface* bus,
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
if(bus->port_id == 1)
|
||||
if(bus->info.port_id == 1)
|
||||
{
|
||||
ColorfulTuringGPUController* controller = new ColorfulTuringGPUController(bus, i2c_addr, name);
|
||||
RGBController_ColorfulTuringGPU* rgb_controller = new RGBController_ColorfulTuringGPU(controller);
|
||||
|
||||
@@ -52,7 +52,7 @@ unsigned char CorsairDRAMController::GetProtocolVersion()
|
||||
|
||||
std::string CorsairDRAMController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -59,7 +59,7 @@ DetectedControllers DetectCorsairDRAMControllers(std::vector<i2c_smbus_interface
|
||||
|
||||
for(unsigned int bus = 0; bus < buses.size(); bus++)
|
||||
{
|
||||
IF_DRAM_SMBUS(buses[bus]->pci_vendor, buses[bus]->pci_device)
|
||||
IF_DRAM_SMBUS(buses[bus]->info.pci_vendor, buses[bus]->info.pci_device)
|
||||
{
|
||||
LOG_DEBUG("[%s] Testing bus %d", CORSAIR_DRAM_NAME, bus);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ std::string CorsairVengeanceController::GetDeviceName()
|
||||
|
||||
std::string CorsairVengeanceController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -35,7 +35,7 @@ std::string CrucialController::GetDeviceVersion()
|
||||
|
||||
std::string CrucialController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -145,7 +145,7 @@ DetectedControllers DetectCrucialControllers(std::vector<i2c_smbus_interface*> &
|
||||
{
|
||||
int address_list_idx = -1;
|
||||
|
||||
IF_DRAM_SMBUS(buses[bus]->pci_vendor, buses[bus]->pci_device)
|
||||
IF_DRAM_SMBUS(buses[bus]->info.pci_vendor, buses[bus]->info.pci_device)
|
||||
{
|
||||
for(unsigned int slot = 0; slot < 4; slot++)
|
||||
{
|
||||
@@ -182,7 +182,7 @@ DetectedControllers DetectCrucialControllers(std::vector<i2c_smbus_interface*> &
|
||||
std::this_thread::sleep_for(1ms);
|
||||
}
|
||||
|
||||
LOG_DEBUG("[%s] In bus: %02X:%02X looking for devices at [%s]", CRUCIAL_CONTROLLER_NAME, buses[bus]->pci_vendor, buses[bus]->pci_device, TESTING_ADDRESSES);
|
||||
LOG_DEBUG("[%s] In bus: %02X:%02X looking for devices at [%s]", CRUCIAL_CONTROLLER_NAME, buses[bus]->info.pci_vendor, buses[bus]->info.pci_device, TESTING_ADDRESSES);
|
||||
|
||||
// Add Crucial controllers
|
||||
for(unsigned int address_list_idx = 0; address_list_idx < CRUCIAL_ADDRESS_COUNT; address_list_idx++)
|
||||
|
||||
@@ -154,7 +154,7 @@ DetectedControllers DetectENESMBusDRAMControllers(std::vector<i2c_smbus_interfac
|
||||
{
|
||||
int address_list_idx = -1;
|
||||
|
||||
IF_DRAM_SMBUS(buses[bus]->pci_vendor, buses[bus]->pci_device)
|
||||
IF_DRAM_SMBUS(buses[bus]->info.pci_vendor, buses[bus]->info.pci_device)
|
||||
{
|
||||
LOG_DEBUG("[ENE SMBus DRAM] Remapping ENE SMBus RAM modules on 0x77");
|
||||
|
||||
@@ -220,9 +220,9 @@ DetectedControllers DetectENESMBusMotherboardControllers(std::vector<i2c_smbus_i
|
||||
for(unsigned int bus = 0; bus < buses.size(); bus++)
|
||||
{
|
||||
// Add ENE (ASUS Aura) motherboard controllers
|
||||
IF_MOBO_SMBUS(buses[bus]->pci_vendor, buses[bus]->pci_device)
|
||||
IF_MOBO_SMBUS(buses[bus]->info.pci_vendor, buses[bus]->info.pci_device)
|
||||
{
|
||||
if(buses[bus]->pci_subsystem_vendor == ASUS_SUB_VEN || buses[bus]->pci_subsystem_vendor == 0 || buses[bus]->pci_subsystem_vendor == 0xFFFF)
|
||||
if(buses[bus]->info.pci_subsystem_vendor == ASUS_SUB_VEN || buses[bus]->info.pci_subsystem_vendor == 0 || buses[bus]->info.pci_subsystem_vendor == 0xFFFF)
|
||||
{
|
||||
for(unsigned int address_list_idx = 0; address_list_idx < AURA_MOBO_ADDRESS_COUNT; address_list_idx++)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ ene_interface_type ENESMBusInterface_i2c_smbus::GetInterfaceType()
|
||||
|
||||
std::string ENESMBusInterface_i2c_smbus::GetLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
return("I2C: " + return_string);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ DetectedControllers DetectEVGAAmpereGPUControllers(i2c_smbus_interface* bus, uin
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
if(bus->port_id == 1)
|
||||
if(bus->info.port_id == 1)
|
||||
{
|
||||
EVGAGPUv3Controller* controller;
|
||||
RGBController_EVGAGPUv3* rgb_controller;
|
||||
|
||||
@@ -26,7 +26,7 @@ EVGAGPUv3Controller::~EVGAGPUv3Controller()
|
||||
|
||||
std::string EVGAGPUv3Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
|
||||
@@ -25,7 +25,7 @@ EVGAGP102Controller::~EVGAGP102Controller()
|
||||
|
||||
std::string EVGAGP102Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", zi.dev_addr);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -21,7 +21,7 @@ DetectedControllers DetectEVGAGP102GPUControllers(i2c_smbus_interface* bus, uint
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
if(bus->port_id == 1)
|
||||
if(bus->info.port_id == 1)
|
||||
{
|
||||
std::vector<EVGAGP102Controller*> controllers;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ EVGAGPUv1Controller::~EVGAGPUv1Controller()
|
||||
|
||||
std::string EVGAGPUv1Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -20,7 +20,7 @@ DetectedControllers DetectEVGAPascalGPUControllers(i2c_smbus_interface* bus, uin
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
if(bus->port_id == 1)
|
||||
if(bus->info.port_id == 1)
|
||||
{
|
||||
EVGAGPUv1Controller* controller = new EVGAGPUv1Controller(bus, address, name);
|
||||
RGBController_EVGAGPUv1* rgb_controller = new RGBController_EVGAGPUv1(controller);
|
||||
|
||||
@@ -32,7 +32,7 @@ EVGAACX30SMBusController::~EVGAACX30SMBusController()
|
||||
|
||||
std::string EVGAACX30SMBusController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -46,9 +46,9 @@ DetectedControllers DetectAcx30SMBusControllers(std::vector<i2c_smbus_interface
|
||||
|
||||
for(unsigned int bus = 0; bus < buses.size(); bus++)
|
||||
{
|
||||
IF_MOBO_SMBUS(buses[bus]->pci_vendor, buses[bus]->pci_device)
|
||||
IF_MOBO_SMBUS(buses[bus]->info.pci_vendor, buses[bus]->info.pci_device)
|
||||
{
|
||||
if(buses[bus]->pci_subsystem_vendor == EVGA_SUB_VEN)
|
||||
if(buses[bus]->info.pci_subsystem_vendor == EVGA_SUB_VEN)
|
||||
{
|
||||
LOG_DEBUG(SMBUS_CHECK_DEVICE_MESSAGE_EN, EVGA_DETECTOR_NAME, bus, VENDOR_NAME, SMBUS_ADDRESS);
|
||||
// Check for ACX 30 controller at 0x28
|
||||
|
||||
@@ -25,7 +25,7 @@ EVGAGPUv2Controller::~EVGAGPUv2Controller()
|
||||
|
||||
std::string EVGAGPUv2Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
|
||||
@@ -19,7 +19,7 @@ DetectedControllers DetectEVGATuringGPUControllers(i2c_smbus_interface* bus, uin
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
if(bus->port_id == 1)
|
||||
if(bus->info.port_id == 1)
|
||||
{
|
||||
EVGAGPUv2Controller* controller = new EVGAGPUv2Controller(bus, address, name);
|
||||
RGBController_EVGAGPUv2* rgb_controller = new RGBController_EVGAGPUv2(controller);
|
||||
|
||||
@@ -26,7 +26,7 @@ GainwardGPUv1Controller::~GainwardGPUv1Controller()
|
||||
|
||||
std::string GainwardGPUv1Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -23,7 +23,7 @@ GainwardGPUv2Controller::~GainwardGPUv2Controller() = default;
|
||||
|
||||
std::string GainwardGPUv2Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -26,7 +26,7 @@ GalaxGPUv1Controller::~GalaxGPUv1Controller()
|
||||
|
||||
std::string GalaxGPUv1Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -26,7 +26,7 @@ GalaxGPUv2Controller::~GalaxGPUv2Controller()
|
||||
|
||||
std::string GalaxGPUv2Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -30,7 +30,7 @@ RGBFusion2BlackwellGPUController::~RGBFusion2BlackwellGPUController()
|
||||
|
||||
std::string RGBFusion2BlackwellGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
bool TestForGigabyteRGBFusion2BlackwellGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
if(bus->pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
|
||||
if(bus->info.pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ unsigned int RGBFusion2DRAMController::GetLEDCount()
|
||||
|
||||
std::string RGBFusion2DRAMController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -54,7 +54,7 @@ DetectedControllers DetectGigabyteRGBFusion2DRAMControllers(std::vector<i2c_smbu
|
||||
|
||||
for(unsigned int bus = 0; bus < buses.size(); bus++)
|
||||
{
|
||||
IF_DRAM_SMBUS(buses[bus]->pci_vendor, buses[bus]->pci_device)
|
||||
IF_DRAM_SMBUS(buses[bus]->info.pci_vendor, buses[bus]->info.pci_device)
|
||||
{
|
||||
// Check for RGB Fusion 2 DRAM controller at 0x67
|
||||
if(TestForGigabyteRGBFusion2DRAMController(buses[bus], 0x67))
|
||||
|
||||
@@ -28,7 +28,7 @@ RGBFusion2GPUController::~RGBFusion2GPUController()
|
||||
|
||||
std::string RGBFusion2GPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
bool TestForGigabyteRGBFusion2GPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
if(bus->pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
|
||||
if(bus->info.pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ std::string RGBFusion2SMBusController::GetDeviceName()
|
||||
|
||||
std::string RGBFusion2SMBusController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -114,16 +114,16 @@ DetectedControllers DetectGigabyteRGBFusion2SMBusControllers(std::vector<i2c_smb
|
||||
LOG_DEBUG(GIGABYTE_FOUND_MB_MESSAGE_EN, DETECTOR_NAME, dmi.getMainboard().c_str());
|
||||
for(unsigned int bus = 0; bus < buses.size(); bus++)
|
||||
{
|
||||
IF_MOBO_SMBUS(buses[bus]->pci_vendor, buses[bus]->pci_device)
|
||||
IF_MOBO_SMBUS(buses[bus]->info.pci_vendor, buses[bus]->info.pci_device)
|
||||
{
|
||||
if(buses[bus]->pci_subsystem_vendor == GIGABYTE_SUB_VEN)
|
||||
if(buses[bus]->info.pci_subsystem_vendor == GIGABYTE_SUB_VEN)
|
||||
{
|
||||
/*-------------------------------------*\
|
||||
| TODO - Is this necessary? Or an |
|
||||
| artifact of my own system? Skip dmcd |
|
||||
| devices |
|
||||
\*-------------------------------------*/
|
||||
std::string device_name = std::string(buses[bus]->device_name);
|
||||
std::string device_name = std::string(buses[bus]->info.device_name);
|
||||
|
||||
if(device_name.find("dmdc") == std::string::npos)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ std::string RGBFusionController::GetDeviceName()
|
||||
|
||||
std::string RGBFusionController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -49,9 +49,9 @@ DetectedControllers DetectGigabyteRGBFusionControllers(std::vector<i2c_smbus_int
|
||||
|
||||
for(unsigned int bus = 0; bus < buses.size(); bus++)
|
||||
{
|
||||
IF_MOBO_SMBUS(buses[bus]->pci_vendor, buses[bus]->pci_device)
|
||||
IF_MOBO_SMBUS(buses[bus]->info.pci_vendor, buses[bus]->info.pci_device)
|
||||
{
|
||||
if(buses[bus]->pci_subsystem_vendor == GIGABYTE_SUB_VEN)
|
||||
if(buses[bus]->info.pci_subsystem_vendor == GIGABYTE_SUB_VEN)
|
||||
{
|
||||
LOG_DEBUG(SMBUS_CHECK_DEVICE_MESSAGE_EN, DETECTOR_NAME, bus, VENDOR_NAME, SMBUS_ADDRESS);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ RGBFusionGPUController::~RGBFusionGPUController()
|
||||
|
||||
std::string RGBFusionGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -40,7 +40,7 @@ HyperXDRAMController::~HyperXDRAMController()
|
||||
|
||||
std::string HyperXDRAMController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -55,7 +55,7 @@ DetectedControllers DetectHyperXDRAMControllers(i2c_smbus_interface* bus, std::v
|
||||
unsigned char slots_valid = 0x00;
|
||||
|
||||
// Check for HyperX controller at 0x27
|
||||
LOG_DEBUG("[%s] Testing bus %d at address 0x27", HYPERX_CONTROLLER_NAME, bus->port_id);
|
||||
LOG_DEBUG("[%s] Testing bus %d at address 0x27", HYPERX_CONTROLLER_NAME, bus->info.port_id);
|
||||
|
||||
if(TestForHyperXDRAMController(bus, 0x27))
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ KingstonFuryDRAMController::KingstonFuryDRAMController(i2c_smbus_interface* bus,
|
||||
|
||||
std::string KingstonFuryDRAMController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
return_string.append(", addresses [");
|
||||
for(std::size_t idx = 0; idx < slots.size(); idx++)
|
||||
{
|
||||
|
||||
@@ -104,7 +104,7 @@ void LEDStripController::InitializeI2C(char* i2cname)
|
||||
{
|
||||
for(unsigned int i2c_idx = 0; i2c_idx < ResourceManager::get()->GetI2CBuses().size(); i2c_idx++)
|
||||
{
|
||||
if(ResourceManager::get()->GetI2CBuses()[i2c_idx]->device_name == std::string(i2cname))
|
||||
if(ResourceManager::get()->GetI2CBuses()[i2c_idx]->info.device_name == std::string(i2cname))
|
||||
{
|
||||
if(i2c_addr < 128)
|
||||
{
|
||||
@@ -155,7 +155,7 @@ std::string LEDStripController::GetLocation()
|
||||
}
|
||||
else if(i2cport != NULL)
|
||||
{
|
||||
return("I2C: " + std::string(i2cport->device_name) + ", Address " + std::to_string(i2c_addr));
|
||||
return("I2C: " + std::string(i2cport->info.device_name) + ", Address " + std::to_string(i2c_addr));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ MSIGPUController::~MSIGPUController()
|
||||
|
||||
std::string MSIGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -18,7 +18,7 @@ DetectedControllers DetectMSIGPUControllers(i2c_smbus_interface* bus, uint8_t i2
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
if((bus->pci_vendor != NVIDIA_VEN || bus->port_id == 1) && (bus->pci_vendor != AMD_GPU_VEN || is_amd_gpu_i2c_bus(bus)))
|
||||
if((bus->info.pci_vendor != NVIDIA_VEN || bus->info.port_id == 1) && (bus->info.pci_vendor != AMD_GPU_VEN || is_amd_gpu_i2c_bus(bus)))
|
||||
{
|
||||
MSIGPUController* controller = new MSIGPUController(bus, i2c_addr, name);
|
||||
RGBController_MSIGPU* rgb_controller = new RGBController_MSIGPU(controller);
|
||||
|
||||
@@ -29,7 +29,7 @@ MSIGPUv2Controller::~MSIGPUv2Controller()
|
||||
|
||||
std::string MSIGPUv2Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -19,9 +19,9 @@ DetectedControllers DetectMSIGPUv2Controllers(i2c_smbus_interface* bus, uint8_t
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
if(bus->pci_vendor != NVIDIA_VEN || bus->port_id == 1)
|
||||
if(bus->info.pci_vendor != NVIDIA_VEN || bus->info.port_id == 1)
|
||||
{
|
||||
int msi_gpu_id = bus->pci_subsystem_device | bus->pci_device << 16;
|
||||
int msi_gpu_id = bus->info.pci_subsystem_device | bus->info.pci_device << 16;
|
||||
MSIGPUv2Controller* controller = new MSIGPUv2Controller(bus, i2c_addr, name);
|
||||
RGBController_MSIGPUv2* rgb_controller = new RGBController_MSIGPUv2(controller, msi_gpu_id);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ ManliGPUController::~ManliGPUController()
|
||||
|
||||
std::string ManliGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -27,7 +27,7 @@ PNYARGBEpicXGPUController::~PNYARGBEpicXGPUController()
|
||||
|
||||
std::string PNYARGBEpicXGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", i2c_addr);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -21,7 +21,7 @@ DetectedControllers DetectPNYARGBEpicXGPUSmallControllers(i2c_smbus_interface* b
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
if(bus->port_id == 1)
|
||||
if(bus->info.port_id == 1)
|
||||
{
|
||||
PNYARGBEpicXGPUController* controller = new PNYARGBEpicXGPUController(bus, i2c_addr, name, false);
|
||||
RGBController_PNYARGBEpicXGPU* rgb_controller = new RGBController_PNYARGBEpicXGPU(controller);
|
||||
@@ -36,7 +36,7 @@ DetectedControllers DetectPNYARGBEpicXGPULargeControllers(i2c_smbus_interface* b
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
if(bus->port_id == 1)
|
||||
if(bus->info.port_id == 1)
|
||||
{
|
||||
PNYARGBEpicXGPUController* controller = new PNYARGBEpicXGPUController(bus, i2c_addr, name, true);
|
||||
RGBController_PNYARGBEpicXGPU* rgb_controller = new RGBController_PNYARGBEpicXGPU(controller);
|
||||
|
||||
@@ -30,7 +30,7 @@ std::string PNYGPUController::GetDeviceName()
|
||||
|
||||
std::string PNYGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -19,7 +19,7 @@ DetectedControllers DetectPNYGPUControllers(i2c_smbus_interface* bus, uint8_t i2
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
if(bus->port_id == 1)
|
||||
if(bus->info.port_id == 1)
|
||||
{
|
||||
PNYGPUController* controller = new PNYGPUController(bus, i2c_addr, name);
|
||||
RGBController_PNYGPU* rgb_controller = new RGBController_PNYGPU(controller);
|
||||
|
||||
@@ -25,7 +25,7 @@ PNYLovelaceGPUController::~PNYLovelaceGPUController()
|
||||
|
||||
std::string PNYLovelaceGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -19,7 +19,7 @@ DetectedControllers DetectPNYLovelaceGPUControllers(i2c_smbus_interface* bus, ui
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
if(bus->port_id == 1)
|
||||
if(bus->info.port_id == 1)
|
||||
{
|
||||
PNYLovelaceGPUController* controller = new PNYLovelaceGPUController(bus, i2c_addr, name);
|
||||
RGBController_PNYLovelaceGPU* rgb_controller = new RGBController_PNYLovelaceGPU(controller);
|
||||
|
||||
@@ -25,7 +25,7 @@ PalitGPUController::~PalitGPUController()
|
||||
|
||||
std::string PalitGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -21,7 +21,7 @@ DetectedControllers DetectPalitGPUControllers(i2c_smbus_interface* bus, uint8_t
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
if(bus->port_id == 1)
|
||||
if(bus->info.port_id == 1)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Check for PALIT string |
|
||||
|
||||
@@ -46,7 +46,7 @@ std::string PatriotViperController::GetDeviceName()
|
||||
|
||||
std::string PatriotViperController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -45,7 +45,7 @@ DetectedControllers DetectPatriotViperControllers(i2c_smbus_interface* bus, std:
|
||||
/*-----------------------------------------------------*\
|
||||
| Check for Patriot Viper controller at 0x77 |
|
||||
\*-----------------------------------------------------*/
|
||||
LOG_DEBUG("[%s] Testing bus %d at address 0x77", PATRIOT_CONTROLLER_NAME, bus->port_id);
|
||||
LOG_DEBUG("[%s] Testing bus %d at address 0x77", PATRIOT_CONTROLLER_NAME, bus->info.port_id);
|
||||
|
||||
if(TestForPatriotViperController(bus, 0x77))
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ std::string PatriotViperSteelController::GetDeviceName()
|
||||
|
||||
std::string PatriotViperSteelController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -43,7 +43,7 @@ DetectedControllers DetectPatriotViperSteelControllers(i2c_smbus_interface* bus,
|
||||
/*-----------------------------------------------------*\
|
||||
| Check for Patriot Viper controller at 0x77 |
|
||||
\*-----------------------------------------------------*/
|
||||
LOG_DEBUG("[%s] Testing bus %d at address 0x77", PATRIOT_CONTROLLER_NAME, bus->port_id);
|
||||
LOG_DEBUG("[%s] Testing bus %d at address 0x77", PATRIOT_CONTROLLER_NAME, bus->info.port_id);
|
||||
|
||||
if(TestForPatriotViperSteelController(bus, 0x77))
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ PowerColorRedDevilV1Controller::PowerColorRedDevilV1Controller(i2c_smbus_interfa
|
||||
this->dev = dev;
|
||||
this->name = dev_name;
|
||||
|
||||
if(bus->pci_device > AMD_NAVI10_DEV) // Only Navi 2 cards have this mode
|
||||
if(bus->info.pci_device > AMD_NAVI10_DEV) // Only Navi 2 cards have this mode
|
||||
{
|
||||
this->has_sync_mode = true;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ PowerColorRedDevilV1Controller::~PowerColorRedDevilV1Controller()
|
||||
|
||||
std::string PowerColorRedDevilV1Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -27,7 +27,7 @@ PowerColorRedDevilV2Controller::~PowerColorRedDevilV2Controller()
|
||||
|
||||
std::string PowerColorRedDevilV2Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
@@ -164,4 +164,4 @@ int PowerColorRedDevilV2Controller::RegisterWrite(unsigned char reg, unsigned ch
|
||||
int ret = bus->i2c_smbus_write_i2c_block_data(dev, reg, 3, data);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ enum
|
||||
|
||||
bool TestForSapphireGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
if(bus->pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
|
||||
if(bus->info.pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ SapphireNitroGlowV1Controller::~SapphireNitroGlowV1Controller()
|
||||
|
||||
std::string SapphireNitroGlowV1Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -25,7 +25,7 @@ SapphireNitroGlowV3Controller::~SapphireNitroGlowV3Controller()
|
||||
|
||||
std::string SapphireNitroGlowV3Controller::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -25,7 +25,7 @@ TForceXtreemController::~TForceXtreemController()
|
||||
|
||||
std::string TForceXtreemController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
|
||||
@@ -29,7 +29,7 @@ ZotacBlackwellGPUController::~ZotacBlackwellGPUController()
|
||||
|
||||
std::string ZotacBlackwellGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -24,7 +24,7 @@ ZotacTuringGPUController::~ZotacTuringGPUController()
|
||||
|
||||
std::string ZotacTuringGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -30,7 +30,7 @@ ZotacV2GPUController::~ZotacV2GPUController()
|
||||
|
||||
std::string ZotacV2GPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -370,7 +370,7 @@ void DetectionManager::UnregisterDetectionCallback(DetectionCallback callback, v
|
||||
\*---------------------------------------------------------*/
|
||||
void DetectionManager::RegisterI2CBus(i2c_smbus_interface *bus)
|
||||
{
|
||||
LOG_INFO("[%s] Registering I2C interface: %s Device %04X:%04X Subsystem: %04X:%04X", DETECTIONMANAGER, bus->device_name, bus->pci_vendor, bus->pci_device, bus->pci_subsystem_vendor, bus->pci_subsystem_device);
|
||||
LOG_INFO("[%s] Registering I2C interface: %s Device %04X:%04X Subsystem: %04X:%04X", DETECTIONMANAGER, bus->info.device_name, bus->info.pci_vendor, bus->info.pci_device, bus->info.pci_subsystem_vendor, bus->info.pci_subsystem_device);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the new bus to the list |
|
||||
@@ -914,7 +914,7 @@ void DetectionManager::BackgroundDetectI2CDRAMDevices(json detector_settings)
|
||||
|
||||
for(std::size_t bus = 0; bus < i2c_buses.size() && IsAnyDimmDetectorEnabled(detector_settings); bus++)
|
||||
{
|
||||
IF_DRAM_SMBUS(i2c_buses[bus]->pci_vendor, i2c_buses[bus]->pci_device)
|
||||
IF_DRAM_SMBUS(i2c_buses[bus]->info.pci_vendor, i2c_buses[bus]->info.pci_device)
|
||||
{
|
||||
std::vector<SPDWrapper> slots;
|
||||
SPDMemoryType dram_type = SPD_RESERVED;
|
||||
@@ -1007,10 +1007,10 @@ void DetectionManager::BackgroundDetectI2CPCIDevices(json detector_settings)
|
||||
|
||||
for(std::size_t bus = 0; bus < i2c_buses.size(); bus++)
|
||||
{
|
||||
if(i2c_buses[bus]->pci_vendor == i2c_pci_device_detectors[i2c_detector_idx].ven_id &&
|
||||
i2c_buses[bus]->pci_device == i2c_pci_device_detectors[i2c_detector_idx].dev_id &&
|
||||
i2c_buses[bus]->pci_subsystem_vendor == i2c_pci_device_detectors[i2c_detector_idx].subven_id &&
|
||||
i2c_buses[bus]->pci_subsystem_device == i2c_pci_device_detectors[i2c_detector_idx].subdev_id)
|
||||
if(i2c_buses[bus]->info.pci_vendor == i2c_pci_device_detectors[i2c_detector_idx].ven_id &&
|
||||
i2c_buses[bus]->info.pci_device == i2c_pci_device_detectors[i2c_detector_idx].dev_id &&
|
||||
i2c_buses[bus]->info.pci_subsystem_vendor == i2c_pci_device_detectors[i2c_detector_idx].subven_id &&
|
||||
i2c_buses[bus]->info.pci_subsystem_device == i2c_pci_device_detectors[i2c_detector_idx].subdev_id)
|
||||
{
|
||||
DetectedControllers detected_controllers = i2c_pci_device_detectors[i2c_detector_idx].function(i2c_buses[bus], i2c_pci_device_detectors[i2c_detector_idx].i2c_addr, i2c_pci_device_detectors[i2c_detector_idx].name);
|
||||
|
||||
|
||||
@@ -334,6 +334,50 @@ void NetworkClient::RegisterNetworkClientCallback(NetworkClientCallback new_call
|
||||
NetworkClientCallbackArgs.push_back(new_callback_arg);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Device Info Functions |
|
||||
\*-----------------------------------------------------*/
|
||||
std::vector<i2c_smbus_info> NetworkClient::GetI2CBusInfo()
|
||||
{
|
||||
std::vector<i2c_smbus_info> bus_info;
|
||||
NetPacketHeader reply_hdr;
|
||||
|
||||
InitNetPacketHeader(&reply_hdr, 0, NET_PACKET_ID_GET_I2C_BUS_INFO, 0);
|
||||
|
||||
send_in_progress.lock();
|
||||
send(client_sock, (char *)&reply_hdr, sizeof(NetPacketHeader), MSG_NOSIGNAL);
|
||||
send_in_progress.unlock();
|
||||
|
||||
std::unique_lock<std::mutex> wait_lock(waiting_on_response_mutex);
|
||||
waiting_on_response_cv.wait(wait_lock);
|
||||
|
||||
if(response_header.pkt_id == NET_PACKET_ID_GET_I2C_BUS_INFO && response_data_ptr != NULL)
|
||||
{
|
||||
unsigned char* data_ptr = (unsigned char*)response_data_ptr;
|
||||
unsigned int bus_count = 0;
|
||||
|
||||
data_ptr += sizeof(unsigned int);
|
||||
|
||||
memcpy(&bus_count, data_ptr, sizeof(bus_count));
|
||||
data_ptr += sizeof(bus_count);
|
||||
|
||||
for(unsigned int bus_idx = 0; bus_idx < bus_count; bus_idx++)
|
||||
{
|
||||
i2c_smbus_info bus;
|
||||
|
||||
memcpy(&bus, data_ptr, sizeof(bus));
|
||||
data_ptr += sizeof(bus);
|
||||
|
||||
bus_info.push_back(bus);
|
||||
}
|
||||
|
||||
delete[] response_data_ptr;
|
||||
response_data_ptr = NULL;
|
||||
}
|
||||
|
||||
return(bus_info);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| DetectionManager functions |
|
||||
\*---------------------------------------------------------*/
|
||||
@@ -1251,6 +1295,7 @@ void NetworkClient::ListenThreadFunction()
|
||||
ProcessRequest_LogManager_LoggedEntry(header.pkt_size, data);
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_GET_I2C_BUS_INFO:
|
||||
case NET_PACKET_ID_LOGMANAGER_GET_LOG_LEVEL:
|
||||
case NET_PACKET_ID_PROFILEMANAGER_DOWNLOAD_PROFILE:
|
||||
case NET_PACKET_ID_PROFILEMANAGER_GET_ACTIVE_PROFILE:
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <condition_variable>
|
||||
#include "i2c_smbus.h"
|
||||
#include "RGBController.h"
|
||||
#include "NetworkProtocol.h"
|
||||
#include "net_port.h"
|
||||
@@ -88,6 +89,11 @@ public:
|
||||
void ClearCallbacks();
|
||||
void RegisterNetworkClientCallback(NetworkClientCallback new_callback, void * new_callback_arg);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Device Info Functions |
|
||||
\*-----------------------------------------------------*/
|
||||
std::vector<i2c_smbus_info> GetI2CBusInfo();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| DetectionManager functions |
|
||||
\*-----------------------------------------------------*/
|
||||
|
||||
@@ -116,6 +116,8 @@ enum
|
||||
NET_PACKET_ID_DETECTION_PROGRESS_CHANGED = 102, /* Indicate to clients that detection progress changed */
|
||||
NET_PACKET_ID_DETECTION_COMPLETE = 103, /* Indicate to clients that detection completed */
|
||||
|
||||
NET_PACKET_ID_GET_I2C_BUS_INFO = 120, /* Request list of I2C bus info */
|
||||
|
||||
NET_PACKET_ID_REQUEST_RESCAN_DEVICES = 140, /* Request rescan of devices */
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------*\
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <queue>
|
||||
#include "i2c_smbus.h"
|
||||
#include "JsonUtils.h"
|
||||
#include "LogManager.h"
|
||||
#include "NetworkServer.h"
|
||||
@@ -1246,6 +1247,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
status = ProcessRequest_RescanDevices();
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_GET_I2C_BUS_INFO:
|
||||
status = ProcessRequest_GetI2CBusInfo(client_info);
|
||||
break;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| LogManager functions |
|
||||
\*-------------------------------------------------*/
|
||||
@@ -1657,6 +1662,48 @@ NetPacketStatus NetworkServer::ProcessRequest_RescanDevices()
|
||||
return(NET_PACKET_STATUS_OK);
|
||||
}
|
||||
|
||||
NetPacketStatus NetworkServer::ProcessRequest_GetI2CBusInfo(NetworkClientInfo* client_info)
|
||||
{
|
||||
if(!client_info->client_is_local_client)
|
||||
{
|
||||
return(NET_PACKET_STATUS_ERROR_NOT_ALLOWED);
|
||||
}
|
||||
|
||||
std::vector<i2c_smbus_info> bus_info = ResourceManager::get()->GetI2CBusInfo();
|
||||
|
||||
unsigned int data_size = 0;
|
||||
unsigned int bus_count = bus_info.size();
|
||||
data_size += sizeof(data_size);
|
||||
data_size += sizeof(bus_count);
|
||||
data_size += bus_count * sizeof(i2c_smbus_info);
|
||||
|
||||
unsigned char* data_buf = new unsigned char[data_size];
|
||||
unsigned char* data_ptr = data_buf;
|
||||
|
||||
memcpy(data_ptr, &data_size, sizeof(data_size));
|
||||
data_ptr += sizeof(data_size);
|
||||
|
||||
memcpy(data_ptr, &bus_count, sizeof(bus_count));
|
||||
data_ptr += sizeof(bus_count);
|
||||
|
||||
for(std::size_t bus_idx = 0; bus_idx < bus_info.size(); bus_idx++)
|
||||
{
|
||||
memcpy(data_ptr, &bus_info[bus_idx], sizeof(bus_info[bus_idx]));
|
||||
data_ptr += sizeof(bus_info[bus_idx]);
|
||||
}
|
||||
|
||||
NetPacketHeader reply_hdr;
|
||||
|
||||
InitNetPacketHeader(&reply_hdr, 0, NET_PACKET_ID_GET_I2C_BUS_INFO, data_size);
|
||||
|
||||
send_in_progress.lock();
|
||||
send(client_info->client_sock, (char *)&reply_hdr, sizeof(NetPacketHeader), MSG_NOSIGNAL);
|
||||
send(client_info->client_sock, (char *)data_buf, reply_hdr.pkt_size, MSG_NOSIGNAL);
|
||||
send_in_progress.unlock();
|
||||
|
||||
return(NET_PACKET_STATUS_OK);
|
||||
}
|
||||
|
||||
NetPacketStatus NetworkServer::ProcessRequest_LogManager_ClearLogBuffer(NetworkClientInfo* client_info)
|
||||
{
|
||||
if(!client_info->client_is_local_client)
|
||||
|
||||
@@ -230,6 +230,8 @@ private:
|
||||
NetPacketStatus ProcessRequest_ClientString(SOCKET client_sock, unsigned int data_size, char * data);
|
||||
NetPacketStatus ProcessRequest_RescanDevices();
|
||||
|
||||
NetPacketStatus ProcessRequest_GetI2CBusInfo(NetworkClientInfo* client_info);
|
||||
|
||||
NetPacketStatus ProcessRequest_LogManager_ClearLogBuffer(NetworkClientInfo* client_info);
|
||||
NetPacketStatus ProcessRequest_LogManager_GetLogBuffer(NetworkClientInfo* client_info);
|
||||
NetPacketStatus ProcessRequest_LogManager_GetLogLevel(NetworkClientInfo* client_info);
|
||||
|
||||
@@ -286,6 +286,26 @@ std::vector<i2c_smbus_interface*> & ResourceManager::GetI2CBuses()
|
||||
return DetectionManager::get()->GetI2CBuses();
|
||||
}
|
||||
|
||||
std::vector<i2c_smbus_info> ResourceManager::GetI2CBusInfo()
|
||||
{
|
||||
if(IsLocalClient())
|
||||
{
|
||||
return(GetLocalClient()->GetI2CBusInfo());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<i2c_smbus_info> bus_info;
|
||||
std::vector<i2c_smbus_interface*> buses = GetI2CBuses();
|
||||
|
||||
for(std::size_t bus_idx = 0; bus_idx < buses.size(); bus_idx++)
|
||||
{
|
||||
bus_info.push_back(buses[bus_idx]->info);
|
||||
}
|
||||
|
||||
return(bus_info);
|
||||
}
|
||||
}
|
||||
|
||||
LogManager* ResourceManager::GetLogManager()
|
||||
{
|
||||
return LogManager::get();
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
unsigned short GetDefaultServerPort();
|
||||
LogManager* GetLogManager();
|
||||
std::vector<i2c_smbus_interface*>& GetI2CBuses();
|
||||
std::vector<i2c_smbus_info> GetI2CBusInfo();
|
||||
PluginManagerInterface* GetPluginManager();
|
||||
ProfileManager* GetProfileManager();
|
||||
std::vector<RGBController*>& GetRGBControllers();
|
||||
|
||||
@@ -25,9 +25,9 @@ EE1004Accessor::~EE1004Accessor()
|
||||
|
||||
bool EE1004Accessor::isAvailable(i2c_smbus_interface *bus, uint8_t spd_addr)
|
||||
{
|
||||
int size = snprintf(nullptr, 0, SPD_EE1004_PATH, bus->bus_id, spd_addr);
|
||||
int size = snprintf(nullptr, 0, SPD_EE1004_PATH, bus->info.bus_id, spd_addr);
|
||||
char *path = new char[size+1];
|
||||
snprintf(path, size+1, SPD_EE1004_PATH, bus->bus_id, spd_addr);
|
||||
snprintf(path, size+1, SPD_EE1004_PATH, bus->info.bus_id, spd_addr);
|
||||
bool result = std::filesystem::exists(path);
|
||||
delete[] path;
|
||||
return result;
|
||||
@@ -58,9 +58,9 @@ uint8_t EE1004Accessor::at(uint16_t addr)
|
||||
|
||||
void EE1004Accessor::readEEPROM()
|
||||
{
|
||||
int size = snprintf(nullptr, 0, SPD_EE1004_PATH, bus->bus_id, address);
|
||||
int size = snprintf(nullptr, 0, SPD_EE1004_PATH, bus->info.bus_id, address);
|
||||
char *filename = new char[size+1];
|
||||
snprintf(filename, size+1, SPD_EE1004_PATH, bus->bus_id, address);
|
||||
snprintf(filename, size+1, SPD_EE1004_PATH, bus->info.bus_id, address);
|
||||
|
||||
std::ifstream eeprom_file(filename, std::ios::in | std::ios::binary);
|
||||
if(eeprom_file)
|
||||
|
||||
@@ -26,9 +26,9 @@ SPD5118Accessor::~SPD5118Accessor()
|
||||
|
||||
bool SPD5118Accessor::isAvailable(i2c_smbus_interface *bus, uint8_t spd_addr)
|
||||
{
|
||||
int size = snprintf(nullptr, 0, SPD_SPD5118_PATH, bus->bus_id, spd_addr);
|
||||
int size = snprintf(nullptr, 0, SPD_SPD5118_PATH, bus->info.bus_id, spd_addr);
|
||||
char *path = new char[size+1];
|
||||
snprintf(path, size+1, SPD_SPD5118_PATH, bus->bus_id, spd_addr);
|
||||
snprintf(path, size+1, SPD_SPD5118_PATH, bus->info.bus_id, spd_addr);
|
||||
bool result = std::filesystem::exists(path);
|
||||
delete[] path;
|
||||
return result;
|
||||
@@ -59,9 +59,9 @@ uint8_t SPD5118Accessor::at(uint16_t addr)
|
||||
|
||||
void SPD5118Accessor::readEEPROM()
|
||||
{
|
||||
int size = snprintf(nullptr, 0, SPD_SPD5118_PATH, bus->bus_id, address);
|
||||
int size = snprintf(nullptr, 0, SPD_SPD5118_PATH, bus->info.bus_id, address);
|
||||
char *filename = new char[size+1];
|
||||
snprintf(filename, size+1, SPD_SPD5118_PATH, bus->bus_id, address);
|
||||
snprintf(filename, size+1, SPD_SPD5118_PATH, bus->info.bus_id, address);
|
||||
|
||||
std::ifstream eeprom_file(filename, std::ios::in | std::ios::binary);
|
||||
if(eeprom_file)
|
||||
|
||||
@@ -44,12 +44,12 @@ void SPDDetector::detect_memory_type()
|
||||
#ifdef __linux__
|
||||
if(EE1004Accessor::isAvailable(bus, address))
|
||||
{
|
||||
LOG_DEBUG("[SPDDetector] Probing DRAM using EE1004 Accessor on bus %d, address 0x%02x", bus->bus_id, address);
|
||||
LOG_DEBUG("[SPDDetector] Probing DRAM using EE1004 Accessor on bus %d, address 0x%02x", bus->info.bus_id, address);
|
||||
accessor = new EE1004Accessor(bus, address);
|
||||
}
|
||||
else if(SPD5118Accessor::isAvailable(bus, address))
|
||||
{
|
||||
LOG_DEBUG("[SPDDetector] Probing DRAM using SPD5118 Accessor on bus %d, address 0x%02x", bus->bus_id, address);
|
||||
LOG_DEBUG("[SPDDetector] Probing DRAM using SPD5118 Accessor on bus %d, address 0x%02x", bus->info.bus_id, address);
|
||||
accessor = new SPD5118Accessor(bus, address);
|
||||
}
|
||||
else
|
||||
@@ -65,7 +65,7 @@ void SPDDetector::detect_memory_type()
|
||||
|| mem_type == SPD_LPDDR4X_SDRAM)
|
||||
&& DDR4DirectAccessor::isAvailable(bus, address))
|
||||
{
|
||||
LOG_DEBUG("[SPDDetector] Probing DRAM using DDR4 Direct Accessor on bus %d, address 0x%02x", bus->bus_id, address);
|
||||
LOG_DEBUG("[SPDDetector] Probing DRAM using DDR4 Direct Accessor on bus %d, address 0x%02x", bus->info.bus_id, address);
|
||||
accessor = new DDR4DirectAccessor(bus, address);
|
||||
}
|
||||
else if((mem_type == SPD_RESERVED
|
||||
@@ -73,7 +73,7 @@ void SPDDetector::detect_memory_type()
|
||||
|| mem_type == SPD_LPDDR5_SDRAM)
|
||||
&& DDR5DirectAccessor::isAvailable(bus, address))
|
||||
{
|
||||
LOG_DEBUG("[SPDDetector] Probing DRAM using DDR5 Direct Accessor on bus %d, address 0x%02x", bus->bus_id, address);
|
||||
LOG_DEBUG("[SPDDetector] Probing DRAM using DDR5 Direct Accessor on bus %d, address 0x%02x", bus->info.bus_id, address);
|
||||
accessor = new DDR5DirectAccessor(bus, address);
|
||||
}
|
||||
/*---------------------------------------------------------*\
|
||||
@@ -82,7 +82,7 @@ void SPDDetector::detect_memory_type()
|
||||
\*---------------------------------------------------------*/
|
||||
else if(mem_type == SPD_RESERVED)
|
||||
{
|
||||
LOG_DEBUG("[SPDDetector] Probing DRAM older than DDR4 on bus %d, address 0x%02x", bus->bus_id, address);
|
||||
LOG_DEBUG("[SPDDetector] Probing DRAM older than DDR4 on bus %d, address 0x%02x", bus->info.bus_id, address);
|
||||
|
||||
int value = bus->i2c_smbus_read_byte_data(address, 0x02);
|
||||
|
||||
@@ -112,7 +112,7 @@ void SPDDetector::detect_memory_type()
|
||||
\*---------------------------------------------------------*/
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("[SPDDetector] Memory type could not be determined for bus %d, address 0x%02x", bus->bus_id, address);
|
||||
LOG_DEBUG("[SPDDetector] Memory type could not be determined for bus %d, address 0x%02x", bus->info.bus_id, address);
|
||||
valid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -258,14 +258,14 @@ bool i2c_smbus_linux_detect()
|
||||
}
|
||||
|
||||
bus = new i2c_smbus_linux();
|
||||
snprintf(bus->device_name, sizeof(bus->device_name), "%s (%s)", device_string, device_path);
|
||||
bus->handle = test_fd;
|
||||
bus->pci_device = pci_device;
|
||||
bus->pci_vendor = pci_vendor;
|
||||
bus->pci_subsystem_device = pci_subsystem_device;
|
||||
bus->pci_subsystem_vendor = pci_subsystem_vendor;
|
||||
bus->port_id = port_id;
|
||||
bus->bus_id = bus_id;
|
||||
snprintf(bus->info.device_name, sizeof(bus->info.device_name), "%s (%s)", device_string, device_path);
|
||||
bus->handle = test_fd;
|
||||
bus->info.pci_device = pci_device;
|
||||
bus->info.pci_vendor = pci_vendor;
|
||||
bus->info.pci_subsystem_device = pci_subsystem_device;
|
||||
bus->info.pci_subsystem_vendor = pci_subsystem_vendor;
|
||||
bus->info.port_id = port_id;
|
||||
bus->info.bus_id = bus_id;
|
||||
DetectionManager::get()->RegisterI2CBus(bus);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -520,19 +520,19 @@ bool i2c_smbus_i801_detect()
|
||||
}
|
||||
|
||||
i2c_smbus_interface * bus;
|
||||
bus = new i2c_smbus_i801();
|
||||
bus = new i2c_smbus_i801();
|
||||
// addresses are referenced from: https://opensource.apple.com/source/IOPCIFamily/IOPCIFamily-146/IOKit/pci/IOPCIDevice.h.auto.html
|
||||
bus->pci_vendor = ReadConfigPortWord(0x00);
|
||||
bus->pci_device = ReadConfigPortWord(0x02);
|
||||
bus->pci_subsystem_vendor = ReadConfigPortWord(0x2c);
|
||||
bus->pci_subsystem_device = ReadConfigPortWord(0x2e);
|
||||
bus->info.pci_vendor = ReadConfigPortWord(0x00);
|
||||
bus->info.pci_device = ReadConfigPortWord(0x02);
|
||||
bus->info.pci_subsystem_vendor = ReadConfigPortWord(0x2c);
|
||||
bus->info.pci_subsystem_device = ReadConfigPortWord(0x2e);
|
||||
|
||||
if(!bus->pci_vendor || !bus->pci_device || !bus->pci_subsystem_vendor || !bus->pci_subsystem_device)
|
||||
if(!bus->info.pci_vendor || !bus->info.pci_device || !bus->info.pci_subsystem_vendor || !bus->info.pci_subsystem_device)
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
|
||||
snprintf(bus->device_name, 512, "Intel(R) SMBus - %X", bus->pci_device);
|
||||
snprintf(bus->info.device_name, 512, "Intel(R) SMBus - %X", bus->info.pci_device);
|
||||
((i2c_smbus_i801 *)bus)->i801_smba = ReadConfigPortWord(0x20) & 0xFFFE;
|
||||
DetectionManager::get()->RegisterI2CBus(bus);
|
||||
|
||||
|
||||
@@ -233,11 +233,11 @@ bool i2c_smbus_nct6775_detect()
|
||||
case SIO_NCT6796_ID:
|
||||
case SIO_NCT6798_ID:
|
||||
// Create new nct6775 bus and invalidate the PCI ID information
|
||||
bus = new i2c_smbus_nct6775();
|
||||
bus->pci_vendor = 0xFFFF;
|
||||
bus->pci_device = 0xFFFF;
|
||||
bus->pci_subsystem_vendor = 0xFFFF;
|
||||
bus->pci_subsystem_device = 0xFFFF;
|
||||
bus = new i2c_smbus_nct6775();
|
||||
bus->info.pci_vendor = 0xFFFF;
|
||||
bus->info.pci_device = 0xFFFF;
|
||||
bus->info.pci_subsystem_vendor = 0xFFFF;
|
||||
bus->info.pci_subsystem_device = 0xFFFF;
|
||||
|
||||
// Set logical device register to get SMBus base address
|
||||
superio_outb(sioaddr, SIO_REG_LOGDEV, SIO_LOGDEV_SMBUS);
|
||||
@@ -250,19 +250,19 @@ bool i2c_smbus_nct6775_detect()
|
||||
switch (val & SIO_ID_MASK)
|
||||
{
|
||||
case SIO_NCT5577_ID:
|
||||
snprintf(bus->device_name, 512, "Nuvoton NCT5577D SMBus at %X", smba);
|
||||
snprintf(bus->info.device_name, 512, "Nuvoton NCT5577D SMBus at %X", smba);
|
||||
break;
|
||||
case SIO_NCT6102_ID:
|
||||
snprintf(bus->device_name, 512, "Nuvoton NCT6102D/NCT6106D SMBus at %X", smba);
|
||||
snprintf(bus->info.device_name, 512, "Nuvoton NCT6102D/NCT6106D SMBus at %X", smba);
|
||||
break;
|
||||
case SIO_NCT6793_ID:
|
||||
snprintf(bus->device_name, 512, "Nuvoton NCT6793D SMBus at %X", smba);
|
||||
snprintf(bus->info.device_name, 512, "Nuvoton NCT6793D SMBus at %X", smba);
|
||||
break;
|
||||
case SIO_NCT6796_ID:
|
||||
snprintf(bus->device_name, 512, "Nuvoton NCT6796D SMBus at %X", smba);
|
||||
snprintf(bus->info.device_name, 512, "Nuvoton NCT6796D SMBus at %X", smba);
|
||||
break;
|
||||
case SIO_NCT6798_ID:
|
||||
snprintf(bus->device_name, 512, "Nuvoton NCT6798D SMBus at %X", smba);
|
||||
snprintf(bus->info.device_name, 512, "Nuvoton NCT6798D SMBus at %X", smba);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -264,22 +264,22 @@ bool i2c_smbus_piix4_detect()
|
||||
|
||||
i2c_smbus_interface * bus;
|
||||
|
||||
bus = new i2c_smbus_piix4();
|
||||
bus->pci_vendor = vendor_id;
|
||||
bus->pci_device = device_id;
|
||||
bus->pci_subsystem_vendor = subsystem_vendor_id;
|
||||
bus->pci_subsystem_device = subsystem_device_id;
|
||||
strcpy(bus->device_name, "Advanced Micro Devices, Inc PIIX4 SMBus at 0x0B00");
|
||||
bus = new i2c_smbus_piix4();
|
||||
bus->info.pci_vendor = vendor_id;
|
||||
bus->info.pci_device = device_id;
|
||||
bus->info.pci_subsystem_vendor = subsystem_vendor_id;
|
||||
bus->info.pci_subsystem_device = subsystem_device_id;
|
||||
strcpy(bus->info.device_name, "Advanced Micro Devices, Inc PIIX4 SMBus at 0x0B00");
|
||||
((i2c_smbus_piix4 *)bus)->piix4_smba = 0x0B00;
|
||||
DetectionManager::get()->RegisterI2CBus(bus);
|
||||
|
||||
bus = new i2c_smbus_piix4();
|
||||
bus->pci_vendor = vendor_id;
|
||||
bus->pci_device = device_id;
|
||||
bus->pci_subsystem_vendor = subsystem_vendor_id;
|
||||
bus->pci_subsystem_device = subsystem_device_id;
|
||||
bus = new i2c_smbus_piix4();
|
||||
bus->info.pci_vendor = vendor_id;
|
||||
bus->info.pci_device = device_id;
|
||||
bus->info.pci_subsystem_vendor = subsystem_vendor_id;
|
||||
bus->info.pci_subsystem_device = subsystem_device_id;
|
||||
((i2c_smbus_piix4 *)bus)->piix4_smba = 0x0B20;
|
||||
strcpy(bus->device_name, "Advanced Micro Devices, Inc PIIX4 SMBus at 0x0B20");
|
||||
strcpy(bus->info.device_name, "Advanced Micro Devices, Inc PIIX4 SMBus at 0x0B20");
|
||||
DetectionManager::get()->RegisterI2CBus(bus);
|
||||
|
||||
return(true);
|
||||
|
||||
@@ -124,12 +124,12 @@ i2c_smbus_amdadl::i2c_smbus_amdadl(ADL_CONTEXT_HANDLE context, int adapter_index
|
||||
int sbv_id = (int)std::stoul(sbv_str, nullptr, 16);
|
||||
int sbd_id = (int)std::stoul(sbd_str, nullptr, 16);
|
||||
|
||||
this->pci_vendor = ven_id;
|
||||
this->pci_device = dev_id;
|
||||
this->pci_subsystem_vendor = sbv_id;
|
||||
this->pci_subsystem_device = sbd_id;
|
||||
this->port_id = 1;
|
||||
strcpy(this->device_name, "AMD ADL");
|
||||
this->info.pci_vendor = ven_id;
|
||||
this->info.pci_device = dev_id;
|
||||
this->info.pci_subsystem_vendor = sbv_id;
|
||||
this->info.pci_subsystem_device = sbd_id;
|
||||
this->info.port_id = 1;
|
||||
strcpy(this->info.device_name, "AMD ADL");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -290,13 +290,13 @@ bool i2c_smbus_amdadl_detect()
|
||||
last_bus_number = current.iBusNumber;
|
||||
i2c_smbus_amdadl * adl_bus = new i2c_smbus_amdadl(context, current.iAdapterIndex);
|
||||
|
||||
if(adl_bus->pci_vendor != AMD_GPU_VEN)
|
||||
if(adl_bus->info.pci_vendor != AMD_GPU_VEN)
|
||||
{
|
||||
delete adl_bus;
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG_INFO("ADL GPU Device %04X:%04X Subsystem: %04X:%04X", adl_bus->pci_vendor, adl_bus->pci_device,adl_bus->pci_subsystem_vendor,adl_bus->pci_subsystem_device);
|
||||
LOG_INFO("ADL GPU Device %04X:%04X Subsystem: %04X:%04X", adl_bus->info.pci_vendor, adl_bus->info.pci_device, adl_bus->info.pci_subsystem_vendor, adl_bus->info.pci_subsystem_device);
|
||||
DetectionManager::get()->RegisterI2CBus(adl_bus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,17 +182,17 @@ bool i2c_smbus_nvapi_detect()
|
||||
{
|
||||
i2c_smbus_nvapi * nvapi_bus = new i2c_smbus_nvapi(gpu_handles[gpu_idx]);
|
||||
|
||||
snprintf(nvapi_bus->device_name, 512, "Nvidia NvAPI I2C on GPU %d", gpu_idx);
|
||||
snprintf(nvapi_bus->info.device_name, 512, "Nvidia NvAPI I2C on GPU %d", gpu_idx);
|
||||
|
||||
res = NvAPI_GPU_GetPCIIdentifiers(gpu_handles[gpu_idx], &device_id, &sub_system_id, &revision_id, &ext_device_id);
|
||||
|
||||
if (res == 0)
|
||||
{
|
||||
nvapi_bus->pci_device = device_id >> 16;
|
||||
nvapi_bus->pci_vendor = device_id & 0xffff;
|
||||
nvapi_bus->pci_subsystem_device = sub_system_id >> 16;
|
||||
nvapi_bus->pci_subsystem_vendor = sub_system_id & 0xffff;
|
||||
nvapi_bus->port_id = 1;
|
||||
nvapi_bus->info.pci_device = device_id >> 16;
|
||||
nvapi_bus->info.pci_vendor = device_id & 0xffff;
|
||||
nvapi_bus->info.pci_subsystem_device = sub_system_id >> 16;
|
||||
nvapi_bus->info.pci_subsystem_vendor = sub_system_id & 0xffff;
|
||||
nvapi_bus->info.port_id = 1;
|
||||
}
|
||||
|
||||
DetectionManager::get()->RegisterI2CBus(nvapi_bus);
|
||||
|
||||
@@ -71,9 +71,9 @@ i2c_smbus_pawnio::i2c_smbus_pawnio(HANDLE handle, std::string name)
|
||||
/*-----------------------------------------------------*\
|
||||
| Get bus information |
|
||||
\*-----------------------------------------------------*/
|
||||
const SIZE_T in_size = 1;
|
||||
ULONG64 in[in_size] = {0};
|
||||
const SIZE_T out_size = 3;
|
||||
const SIZE_T in_size = 1;
|
||||
ULONG64 in[in_size] = {0};
|
||||
const SIZE_T out_size = 3;
|
||||
ULONG64 out[out_size];
|
||||
SIZE_T return_size;
|
||||
HRESULT status;
|
||||
@@ -82,10 +82,10 @@ i2c_smbus_pawnio::i2c_smbus_pawnio(HANDLE handle, std::string name)
|
||||
|
||||
if(!status)
|
||||
{
|
||||
this->pci_vendor = (int)(out[2] & 0x000000000000FFFF);
|
||||
this->pci_device = (int)((out[2] & 0x00000000FFFF0000) >> 16);
|
||||
this->pci_subsystem_vendor = (int)((out[2] & 0x0000FFFF0000FFFF) >> 32);
|
||||
this->pci_subsystem_device = (int)((out[2] & 0xFFFF000000000000) >> 48);
|
||||
this->info.pci_vendor = (int)(out[2] & 0x000000000000FFFF);
|
||||
this->info.pci_device = (int)((out[2] & 0x00000000FFFF0000) >> 16);
|
||||
this->info.pci_subsystem_vendor = (int)((out[2] & 0x0000FFFF0000FFFF) >> 32);
|
||||
this->info.pci_subsystem_device = (int)((out[2] & 0xFFFF000000000000) >> 48);
|
||||
|
||||
char name_str[9];
|
||||
name_str[0] = (char)(out[0] & 0x00000000000000FF);
|
||||
@@ -98,7 +98,7 @@ i2c_smbus_pawnio::i2c_smbus_pawnio(HANDLE handle, std::string name)
|
||||
name_str[7] = (char)((out[0] & 0xFF00000000000000) >> 56);
|
||||
name_str[8] = 0;
|
||||
|
||||
strncpy(this->device_name, name_str, 512 );
|
||||
strncpy(this->info.device_name, name_str, 512 );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
|
||||
@@ -30,8 +30,8 @@ inline bool is_amd_gpu_i2c_bus(const i2c_smbus_interface *bus)
|
||||
size_t idx = 0;
|
||||
while((name = RECOGNIZED_I2C_BUS_NAMES[idx++]) != nullptr)
|
||||
{
|
||||
const char *pos = std::strstr(bus->device_name, name);
|
||||
if(pos == bus->device_name)
|
||||
const char *pos = std::strstr(bus->info.device_name, name);
|
||||
if(pos == bus->info.device_name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
|
||||
i2c_smbus_interface::i2c_smbus_interface()
|
||||
{
|
||||
this->port_id = -1;
|
||||
this->pci_device = -1;
|
||||
this->pci_vendor = -1;
|
||||
this->pci_subsystem_device = -1;
|
||||
this->pci_subsystem_vendor = -1;
|
||||
this->bus_id = -1;
|
||||
info.port_id = -1;
|
||||
info.pci_device = -1;
|
||||
info.pci_vendor = -1;
|
||||
info.pci_subsystem_device = -1;
|
||||
info.pci_subsystem_vendor = -1;
|
||||
info.bus_id = -1;
|
||||
}
|
||||
|
||||
i2c_smbus_interface::~i2c_smbus_interface()
|
||||
|
||||
@@ -72,10 +72,8 @@ union i2c_smbus_data
|
||||
#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
|
||||
#define I2C_SMBUS_I2C_BLOCK_DATA 8
|
||||
|
||||
|
||||
class i2c_smbus_interface
|
||||
typedef struct
|
||||
{
|
||||
public:
|
||||
char device_name[512];
|
||||
|
||||
int port_id;
|
||||
@@ -85,6 +83,12 @@ public:
|
||||
int pci_subsystem_vendor;
|
||||
|
||||
int bus_id;
|
||||
} i2c_smbus_info;
|
||||
|
||||
class i2c_smbus_interface
|
||||
{
|
||||
public:
|
||||
i2c_smbus_info info;
|
||||
|
||||
i2c_smbus_interface();
|
||||
virtual ~i2c_smbus_interface();
|
||||
|
||||
@@ -34,36 +34,36 @@ OpenRGBHardwareIDsDialog::~OpenRGBHardwareIDsDialog()
|
||||
|
||||
int OpenRGBHardwareIDsDialog::show()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Add i2c buses infos |
|
||||
\*---------------------------------------------------------*/
|
||||
std::vector<i2c_smbus_interface*> i2c_buses = ResourceManager::get()->GetI2CBuses();
|
||||
/*-----------------------------------------------------*\
|
||||
| Add I2C Buses |
|
||||
\*-----------------------------------------------------*/
|
||||
std::vector<i2c_smbus_info> i2c_bus_info = ResourceManager::get()->GetI2CBusInfo();
|
||||
QTreeWidgetItem* i2c_top = new QTreeWidgetItem(ui->HardwareIdsList, {"I2C Buses"});
|
||||
|
||||
// The widget takes control over items after creation
|
||||
QTreeWidgetItem* i2c_top = new QTreeWidgetItem(ui->HardwareIdsList, {"i2c buses"});
|
||||
strings.push_back("[ i2c buses ]");
|
||||
strings.push_back("[ I2C Buses ]");
|
||||
|
||||
for(i2c_smbus_interface* bus : i2c_buses)
|
||||
for(i2c_smbus_info bus_info : i2c_bus_info)
|
||||
{
|
||||
char line[550];
|
||||
snprintf(line, 550, "%04X:%04X %04X:%04X", bus->pci_vendor, bus->pci_device, bus->pci_subsystem_vendor, bus->pci_subsystem_device);
|
||||
new QTreeWidgetItem(i2c_top, {line, bus->device_name});
|
||||
snprintf(line, 550, "%04X:%04X %04X:%04X", bus_info.pci_vendor, bus_info.pci_device, bus_info.pci_subsystem_vendor, bus_info.pci_subsystem_device);
|
||||
new QTreeWidgetItem(i2c_top, {line, bus_info.device_name});
|
||||
|
||||
snprintf(line, 550, "%04X:%04X %04X:%04X - %s", bus->pci_vendor, bus->pci_device, bus->pci_subsystem_vendor, bus->pci_subsystem_device, bus->device_name);
|
||||
snprintf(line, 550, "%04X:%04X %04X:%04X - %s", bus_info.pci_vendor, bus_info.pci_device, bus_info.pci_subsystem_vendor, bus_info.pci_subsystem_device, bus_info.device_name);
|
||||
strings.push_back(line);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Add HID devices infos |
|
||||
\*---------------------------------------------------------*/
|
||||
hid_device_info* hid_devices = NULL;
|
||||
hid_devices = hid_enumerate(0,0);
|
||||
/*-----------------------------------------------------*\
|
||||
| Add HID Devices |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_device_info* hid_devices = NULL;
|
||||
hid_devices = hid_enumerate(0,0);
|
||||
|
||||
hid_device_info* current_hid_device;
|
||||
current_hid_device = hid_devices;
|
||||
hid_device_info* current_hid_device;
|
||||
current_hid_device = hid_devices;
|
||||
|
||||
QTreeWidgetItem* hid_top = new QTreeWidgetItem(ui->HardwareIdsList, {"HID devices"});
|
||||
strings.push_back("\n[ HID devices ]");
|
||||
QTreeWidgetItem* hid_top = new QTreeWidgetItem(ui->HardwareIdsList, {"HID Devices"});
|
||||
|
||||
strings.push_back("\n[ HID Devices ]");
|
||||
|
||||
while(current_hid_device)
|
||||
{
|
||||
@@ -81,13 +81,13 @@ int OpenRGBHardwareIDsDialog::show()
|
||||
current_hid_device = current_hid_device->next;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Add LibUSB devices infos |
|
||||
\*---------------------------------------------------------*/
|
||||
libusb_device** devices = nullptr;
|
||||
/*-----------------------------------------------------*\
|
||||
| Add USB Devices |
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_device** devices = nullptr;
|
||||
QTreeWidgetItem* libusb_top = new QTreeWidgetItem(ui->HardwareIdsList, {"USB devices"});
|
||||
|
||||
QTreeWidgetItem* libusb_top = new QTreeWidgetItem(ui->HardwareIdsList, {"LibUSB devices"});
|
||||
strings.push_back("\n[ LibUSB devices ]");
|
||||
strings.push_back("\n[ USB devices ]");
|
||||
|
||||
int ret;
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ void OpenRGBSystemInfoPage::UpdateBusList()
|
||||
|
||||
for (std::size_t i = 0; i < buses.size(); i++)
|
||||
{
|
||||
ui->SMBusAdaptersBox->addItem(buses[i]->device_name);
|
||||
ui->SMBusAdaptersBox->addItem(buses[i]->info.device_name);
|
||||
}
|
||||
|
||||
ui->SMBusAdaptersBox->setCurrentIndex(0);
|
||||
|
||||
Reference in New Issue
Block a user