From 1faa2b1d3119b5db36bb688d3078778d280840d0 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Sun, 10 May 2026 03:22:37 -0500 Subject: [PATCH] Implement network request to get list of I2C buses so that the Get Hardware IDs dialog works in local client mode --- .../ASRockASRRGBSMBusController.cpp | 2 +- .../ASRockPolychromeV1SMBusController.cpp | 2 +- .../ASRockPolychromeV2SMBusController.cpp | 2 +- .../ASRockSMBusControllerDetect.cpp | 4 +- .../AsusAuraGPUController.cpp | 4 +- .../AsusAuraGPUControllerDetect.cpp | 2 +- .../ColorfulGPUController.cpp | 4 +- .../ColorfulTuringGPUController.cpp | 2 +- .../ColorfulTuringGPUControllerDetect.cpp | 2 +- .../CorsairDRAMController.cpp | 2 +- .../CorsairDRAMControllerDetect.cpp | 2 +- .../CorsairVengeanceController.cpp | 2 +- .../CrucialController/CrucialController.cpp | 2 +- .../CrucialControllerDetect.cpp | 4 +- .../ENESMBusControllerDetect.cpp | 6 +-- .../ENESMBusInterface_i2c_smbus.cpp | 2 +- .../EVGAAmpereGPUControllerDetect.cpp | 2 +- .../EVGAGPUv3Controller.cpp | 2 +- .../EVGAGP102Controller.cpp | 2 +- .../EVGAGP102GPUControllerDetect.cpp | 2 +- .../EVGAGPUv1Controller.cpp | 2 +- .../EVGAPascalGPUControllerDetect.cpp | 2 +- .../EVGAACX30SMBusController.cpp | 2 +- .../EVGASMBusControllerDetect.cpp | 4 +- .../EVGAGPUv2Controller.cpp | 2 +- .../EVGATuringGPUControllerDetect.cpp | 2 +- .../GainwardGPUv1Controller.cpp | 2 +- .../GainwardGPUv2Controller.cpp | 2 +- .../GalaxGPUv1Controller.cpp | 2 +- .../GalaxGPUv2Controller.cpp | 2 +- ...gabyteRGBFusion2BlackwellGPUController.cpp | 2 +- ...RGBFusion2BlackwellGPUControllerDetect.cpp | 2 +- .../GigabyteRGBFusion2DRAMController.cpp | 2 +- ...GigabyteRGBFusion2DRAMControllerDetect.cpp | 2 +- .../GigabyteRGBFusion2GPUController.cpp | 2 +- .../GigabyteRGBFusion2GPUControllerDetect.cpp | 2 +- .../GigabyteRGBFusion2SMBusController.cpp | 2 +- ...igabyteRGBFusion2SMBusControllerDetect.cpp | 6 +-- .../GigabyteRGBFusionController.cpp | 2 +- .../GigabyteRGBFusionControllerDetect.cpp | 4 +- .../GigabyteRGBFusionGPUController.cpp | 2 +- .../HyperXDRAMController.cpp | 2 +- .../HyperXDRAMControllerDetect.cpp | 2 +- .../KingstonFuryDRAMController.cpp | 2 +- .../LEDStripController/LEDStripController.cpp | 4 +- .../MSIGPUController/MSIGPUController.cpp | 2 +- .../MSIGPUControllerDetect.cpp | 2 +- .../MSIGPUv2Controller/MSIGPUv2Controller.cpp | 2 +- .../MSIGPUv2ControllerDetect.cpp | 4 +- .../ManliGPUController/ManliGPUController.cpp | 2 +- .../PNYARGBEpicXGPUController.cpp | 2 +- .../PNYARGBEpicXGPUControllerDetect.cpp | 4 +- .../PNYGPUController/PNYGPUController.cpp | 2 +- .../PNYGPUControllerDetect.cpp | 2 +- .../PNYLovelaceGPUController.cpp | 2 +- .../PNYLovelaceGPUControllerDetect.cpp | 2 +- .../PalitGPUController/PalitGPUController.cpp | 2 +- .../PalitGPUControllerDetect.cpp | 2 +- .../PatriotViperController.cpp | 2 +- .../PatriotViperControllerDetect.cpp | 2 +- .../PatriotViperSteelController.cpp | 2 +- .../PatriotViperSteelControllerDetect.cpp | 2 +- .../PowerColorRedDevilV1Controller.cpp | 4 +- .../PowerColorRedDevilV2Controller.cpp | 4 +- .../SapphireGPUControllerDetect.cpp | 2 +- .../SapphireNitroGlowV1Controller.cpp | 2 +- .../SapphireNitroGlowV3Controller.cpp | 2 +- .../TForceXtreemController.cpp | 2 +- .../ZotacBlackwellGPUController.cpp | 2 +- .../ZotacTuringGPUController.cpp | 2 +- .../ZotacV2GPUController.cpp | 2 +- DetectionManager.cpp | 12 ++--- NetworkClient.cpp | 45 ++++++++++++++++ NetworkClient.h | 6 +++ NetworkProtocol.h | 2 + NetworkServer.cpp | 47 +++++++++++++++++ NetworkServer.h | 2 + ResourceManager.cpp | 20 +++++++ ResourceManager.h | 1 + SPDAccessor/EE1004Accessor_Linux.cpp | 8 +-- SPDAccessor/SPD5118Accessor_Linux.cpp | 8 +-- SPDAccessor/SPDDetector.cpp | 12 ++--- i2c_smbus/Linux/i2c_smbus_linux.cpp | 16 +++--- i2c_smbus/MacOS/i2c_smbus_i801.cpp | 14 ++--- i2c_smbus/MacOS/i2c_smbus_nct6775.cpp | 20 +++---- i2c_smbus/MacOS/i2c_smbus_piix4.cpp | 24 ++++----- i2c_smbus/Windows/i2c_smbus_amdadl.cpp | 16 +++--- i2c_smbus/Windows/i2c_smbus_nvapi.cpp | 12 ++--- i2c_smbus/Windows/i2c_smbus_pawnio.cpp | 16 +++--- i2c_smbus/i2c_amd_gpu.h | 4 +- i2c_smbus/i2c_smbus.cpp | 12 ++--- i2c_smbus/i2c_smbus.h | 10 ++-- .../OpenRGBHardwareIDsDialog.cpp | 52 +++++++++---------- .../OpenRGBSystemInfoPage.cpp | 2 +- 94 files changed, 330 insertions(+), 203 deletions(-) diff --git a/Controllers/ASRockSMBusController/ASRockASRRGBSMBusController/ASRockASRRGBSMBusController.cpp b/Controllers/ASRockSMBusController/ASRockASRRGBSMBusController/ASRockASRRGBSMBusController.cpp index 1584f4860..00567d70d 100644 --- a/Controllers/ASRockSMBusController/ASRockASRRGBSMBusController/ASRockASRRGBSMBusController.cpp +++ b/Controllers/ASRockSMBusController/ASRockASRRGBSMBusController/ASRockASRRGBSMBusController.cpp @@ -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 "); diff --git a/Controllers/ASRockSMBusController/ASRockPolychromeV1SMBusController/ASRockPolychromeV1SMBusController.cpp b/Controllers/ASRockSMBusController/ASRockPolychromeV1SMBusController/ASRockPolychromeV1SMBusController.cpp index d3770a4dc..507973013 100644 --- a/Controllers/ASRockSMBusController/ASRockPolychromeV1SMBusController/ASRockPolychromeV1SMBusController.cpp +++ b/Controllers/ASRockSMBusController/ASRockPolychromeV1SMBusController/ASRockPolychromeV1SMBusController.cpp @@ -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 "); diff --git a/Controllers/ASRockSMBusController/ASRockPolychromeV2SMBusController/ASRockPolychromeV2SMBusController.cpp b/Controllers/ASRockSMBusController/ASRockPolychromeV2SMBusController/ASRockPolychromeV2SMBusController.cpp index 94351ce64..f83c3d816 100644 --- a/Controllers/ASRockSMBusController/ASRockPolychromeV2SMBusController/ASRockPolychromeV2SMBusController.cpp +++ b/Controllers/ASRockSMBusController/ASRockPolychromeV2SMBusController/ASRockPolychromeV2SMBusController.cpp @@ -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 "); diff --git a/Controllers/ASRockSMBusController/ASRockSMBusControllerDetect.cpp b/Controllers/ASRockSMBusController/ASRockSMBusControllerDetect.cpp index 1b2d94428..9a8a2125f 100644 --- a/Controllers/ASRockSMBusController/ASRockSMBusControllerDetect.cpp +++ b/Controllers/ASRockSMBusController/ASRockSMBusControllerDetect.cpp @@ -91,9 +91,9 @@ DetectedControllers DetectASRockSMBusControllers(std::vectorpci_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 diff --git a/Controllers/AsusAuraGPUController/AsusAuraGPUController.cpp b/Controllers/AsusAuraGPUController/AsusAuraGPUController.cpp index 150f50c1c..2353ca104 100644 --- a/Controllers/AsusAuraGPUController/AsusAuraGPUController.cpp +++ b/Controllers/AsusAuraGPUController/AsusAuraGPUController.cpp @@ -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; diff --git a/Controllers/AsusAuraGPUController/AsusAuraGPUControllerDetect.cpp b/Controllers/AsusAuraGPUController/AsusAuraGPUControllerDetect.cpp index 8c5c91a69..ae11061bc 100644 --- a/Controllers/AsusAuraGPUController/AsusAuraGPUControllerDetect.cpp +++ b/Controllers/AsusAuraGPUController/AsusAuraGPUControllerDetect.cpp @@ -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; } diff --git a/Controllers/ColorfulGPUController/ColorfulGPUController.cpp b/Controllers/ColorfulGPUController/ColorfulGPUController.cpp index dcc785e5f..b92765a33 100644 --- a/Controllers/ColorfulGPUController/ColorfulGPUController.cpp +++ b/Controllers/ColorfulGPUController/ColorfulGPUController.cpp @@ -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) diff --git a/Controllers/ColorfulTuringGPUController/ColorfulTuringGPUController.cpp b/Controllers/ColorfulTuringGPUController/ColorfulTuringGPUController.cpp index 7420b7684..ab3c87ca1 100644 --- a/Controllers/ColorfulTuringGPUController/ColorfulTuringGPUController.cpp +++ b/Controllers/ColorfulTuringGPUController/ColorfulTuringGPUController.cpp @@ -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 "); diff --git a/Controllers/ColorfulTuringGPUController/ColorfulTuringGPUControllerDetect.cpp b/Controllers/ColorfulTuringGPUController/ColorfulTuringGPUControllerDetect.cpp index 5c757ba65..ea9a4aa0c 100644 --- a/Controllers/ColorfulTuringGPUController/ColorfulTuringGPUControllerDetect.cpp +++ b/Controllers/ColorfulTuringGPUController/ColorfulTuringGPUControllerDetect.cpp @@ -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); diff --git a/Controllers/CorsairDRAMController/CorsairDRAMController.cpp b/Controllers/CorsairDRAMController/CorsairDRAMController.cpp index 834191ac9..64facf586 100644 --- a/Controllers/CorsairDRAMController/CorsairDRAMController.cpp +++ b/Controllers/CorsairDRAMController/CorsairDRAMController.cpp @@ -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 "); diff --git a/Controllers/CorsairDRAMController/CorsairDRAMControllerDetect.cpp b/Controllers/CorsairDRAMController/CorsairDRAMControllerDetect.cpp index fa531552d..71f196183 100644 --- a/Controllers/CorsairDRAMController/CorsairDRAMControllerDetect.cpp +++ b/Controllers/CorsairDRAMController/CorsairDRAMControllerDetect.cpp @@ -59,7 +59,7 @@ DetectedControllers DetectCorsairDRAMControllers(std::vectorpci_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); diff --git a/Controllers/CorsairVengeanceController/CorsairVengeanceController.cpp b/Controllers/CorsairVengeanceController/CorsairVengeanceController.cpp index ad7682333..7b2f394e2 100644 --- a/Controllers/CorsairVengeanceController/CorsairVengeanceController.cpp +++ b/Controllers/CorsairVengeanceController/CorsairVengeanceController.cpp @@ -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 "); diff --git a/Controllers/CrucialController/CrucialController.cpp b/Controllers/CrucialController/CrucialController.cpp index adbe14b2e..2b9e19c4a 100644 --- a/Controllers/CrucialController/CrucialController.cpp +++ b/Controllers/CrucialController/CrucialController.cpp @@ -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 "); diff --git a/Controllers/CrucialController/CrucialControllerDetect.cpp b/Controllers/CrucialController/CrucialControllerDetect.cpp index d9904f7ed..374d089b7 100644 --- a/Controllers/CrucialController/CrucialControllerDetect.cpp +++ b/Controllers/CrucialController/CrucialControllerDetect.cpp @@ -145,7 +145,7 @@ DetectedControllers DetectCrucialControllers(std::vector & { 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 & 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++) diff --git a/Controllers/ENESMBusController/ENESMBusControllerDetect.cpp b/Controllers/ENESMBusController/ENESMBusControllerDetect.cpp index 9aeb73071..9c9169780 100644 --- a/Controllers/ENESMBusController/ENESMBusControllerDetect.cpp +++ b/Controllers/ENESMBusController/ENESMBusControllerDetect.cpp @@ -154,7 +154,7 @@ DetectedControllers DetectENESMBusDRAMControllers(std::vectorpci_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::vectorpci_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++) { diff --git a/Controllers/ENESMBusController/ENESMBusInterface/ENESMBusInterface_i2c_smbus.cpp b/Controllers/ENESMBusController/ENESMBusInterface/ENESMBusInterface_i2c_smbus.cpp index fb30101c8..26193ea1b 100644 --- a/Controllers/ENESMBusController/ENESMBusInterface/ENESMBusInterface_i2c_smbus.cpp +++ b/Controllers/ENESMBusController/ENESMBusInterface/ENESMBusInterface_i2c_smbus.cpp @@ -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); } diff --git a/Controllers/EVGAAmpereGPUController/EVGAAmpereGPUControllerDetect.cpp b/Controllers/EVGAAmpereGPUController/EVGAAmpereGPUControllerDetect.cpp index e65aca570..b28887793 100644 --- a/Controllers/EVGAAmpereGPUController/EVGAAmpereGPUControllerDetect.cpp +++ b/Controllers/EVGAAmpereGPUController/EVGAAmpereGPUControllerDetect.cpp @@ -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; diff --git a/Controllers/EVGAAmpereGPUController/EVGAGPUv3Controller.cpp b/Controllers/EVGAAmpereGPUController/EVGAGPUv3Controller.cpp index 4501608b8..59d91cb2a 100644 --- a/Controllers/EVGAAmpereGPUController/EVGAGPUv3Controller.cpp +++ b/Controllers/EVGAAmpereGPUController/EVGAGPUv3Controller.cpp @@ -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); diff --git a/Controllers/EVGAGP102GPUController/EVGAGP102Controller.cpp b/Controllers/EVGAGP102GPUController/EVGAGP102Controller.cpp index 8b729b9d7..8a0a96e58 100644 --- a/Controllers/EVGAGP102GPUController/EVGAGP102Controller.cpp +++ b/Controllers/EVGAGP102GPUController/EVGAGP102Controller.cpp @@ -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 "); diff --git a/Controllers/EVGAGP102GPUController/EVGAGP102GPUControllerDetect.cpp b/Controllers/EVGAGP102GPUController/EVGAGP102GPUControllerDetect.cpp index 043f97341..8d413e0d8 100644 --- a/Controllers/EVGAGP102GPUController/EVGAGP102GPUControllerDetect.cpp +++ b/Controllers/EVGAGP102GPUController/EVGAGP102GPUControllerDetect.cpp @@ -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 controllers; diff --git a/Controllers/EVGAPascalGPUController/EVGAGPUv1Controller.cpp b/Controllers/EVGAPascalGPUController/EVGAGPUv1Controller.cpp index 5aa46275a..b6b620572 100644 --- a/Controllers/EVGAPascalGPUController/EVGAGPUv1Controller.cpp +++ b/Controllers/EVGAPascalGPUController/EVGAGPUv1Controller.cpp @@ -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 "); diff --git a/Controllers/EVGAPascalGPUController/EVGAPascalGPUControllerDetect.cpp b/Controllers/EVGAPascalGPUController/EVGAPascalGPUControllerDetect.cpp index a720cb37f..fda93f575 100644 --- a/Controllers/EVGAPascalGPUController/EVGAPascalGPUControllerDetect.cpp +++ b/Controllers/EVGAPascalGPUController/EVGAPascalGPUControllerDetect.cpp @@ -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); diff --git a/Controllers/EVGASMBusController/EVGAACX30SMBusController.cpp b/Controllers/EVGASMBusController/EVGAACX30SMBusController.cpp index bd017761f..9a93c4f69 100644 --- a/Controllers/EVGASMBusController/EVGAACX30SMBusController.cpp +++ b/Controllers/EVGASMBusController/EVGAACX30SMBusController.cpp @@ -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 "); diff --git a/Controllers/EVGASMBusController/EVGASMBusControllerDetect.cpp b/Controllers/EVGASMBusController/EVGASMBusControllerDetect.cpp index a5ec08a1b..22866f1fc 100644 --- a/Controllers/EVGASMBusController/EVGASMBusControllerDetect.cpp +++ b/Controllers/EVGASMBusController/EVGASMBusControllerDetect.cpp @@ -46,9 +46,9 @@ DetectedControllers DetectAcx30SMBusControllers(std::vectorpci_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 diff --git a/Controllers/EVGATuringGPUController/EVGAGPUv2Controller.cpp b/Controllers/EVGATuringGPUController/EVGAGPUv2Controller.cpp index 8eccf3324..691725d23 100644 --- a/Controllers/EVGATuringGPUController/EVGAGPUv2Controller.cpp +++ b/Controllers/EVGATuringGPUController/EVGAGPUv2Controller.cpp @@ -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); diff --git a/Controllers/EVGATuringGPUController/EVGATuringGPUControllerDetect.cpp b/Controllers/EVGATuringGPUController/EVGATuringGPUControllerDetect.cpp index 9c9fc5d9c..75b5478aa 100644 --- a/Controllers/EVGATuringGPUController/EVGATuringGPUControllerDetect.cpp +++ b/Controllers/EVGATuringGPUController/EVGATuringGPUControllerDetect.cpp @@ -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); diff --git a/Controllers/GainwardGPUController/GainwardGPUv1Controller/GainwardGPUv1Controller.cpp b/Controllers/GainwardGPUController/GainwardGPUv1Controller/GainwardGPUv1Controller.cpp index b52a4f9fa..e45fa1ef5 100644 --- a/Controllers/GainwardGPUController/GainwardGPUv1Controller/GainwardGPUv1Controller.cpp +++ b/Controllers/GainwardGPUController/GainwardGPUv1Controller/GainwardGPUv1Controller.cpp @@ -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 "); diff --git a/Controllers/GainwardGPUController/GainwardGPUv2Controller/GainwardGPUv2Controller.cpp b/Controllers/GainwardGPUController/GainwardGPUv2Controller/GainwardGPUv2Controller.cpp index be81cc6f3..77ca713e1 100644 --- a/Controllers/GainwardGPUController/GainwardGPUv2Controller/GainwardGPUv2Controller.cpp +++ b/Controllers/GainwardGPUController/GainwardGPUv2Controller/GainwardGPUv2Controller.cpp @@ -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 "); diff --git a/Controllers/GalaxGPUController/GalaxGPUv1Controller/GalaxGPUv1Controller.cpp b/Controllers/GalaxGPUController/GalaxGPUv1Controller/GalaxGPUv1Controller.cpp index 607644bd2..810924b28 100644 --- a/Controllers/GalaxGPUController/GalaxGPUv1Controller/GalaxGPUv1Controller.cpp +++ b/Controllers/GalaxGPUController/GalaxGPUv1Controller/GalaxGPUv1Controller.cpp @@ -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 "); diff --git a/Controllers/GalaxGPUController/GalaxGPUv2Controller/GalaxGPUv2Controller.cpp b/Controllers/GalaxGPUController/GalaxGPUv2Controller/GalaxGPUv2Controller.cpp index 86cfd7759..76267aa9b 100644 --- a/Controllers/GalaxGPUController/GalaxGPUv2Controller/GalaxGPUv2Controller.cpp +++ b/Controllers/GalaxGPUController/GalaxGPUv2Controller/GalaxGPUv2Controller.cpp @@ -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 "); diff --git a/Controllers/GigabyteRGBFusion2BlackwellGPUController/GigabyteRGBFusion2BlackwellGPUController.cpp b/Controllers/GigabyteRGBFusion2BlackwellGPUController/GigabyteRGBFusion2BlackwellGPUController.cpp index 9310936bd..cdef9ee85 100644 --- a/Controllers/GigabyteRGBFusion2BlackwellGPUController/GigabyteRGBFusion2BlackwellGPUController.cpp +++ b/Controllers/GigabyteRGBFusion2BlackwellGPUController/GigabyteRGBFusion2BlackwellGPUController.cpp @@ -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 "); diff --git a/Controllers/GigabyteRGBFusion2BlackwellGPUController/GigabyteRGBFusion2BlackwellGPUControllerDetect.cpp b/Controllers/GigabyteRGBFusion2BlackwellGPUController/GigabyteRGBFusion2BlackwellGPUControllerDetect.cpp index 8f5962b39..a0dfc8396 100644 --- a/Controllers/GigabyteRGBFusion2BlackwellGPUController/GigabyteRGBFusion2BlackwellGPUControllerDetect.cpp +++ b/Controllers/GigabyteRGBFusion2BlackwellGPUController/GigabyteRGBFusion2BlackwellGPUControllerDetect.cpp @@ -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; } diff --git a/Controllers/GigabyteRGBFusion2DRAMController/GigabyteRGBFusion2DRAMController.cpp b/Controllers/GigabyteRGBFusion2DRAMController/GigabyteRGBFusion2DRAMController.cpp index 399b48d83..b78e8ed42 100644 --- a/Controllers/GigabyteRGBFusion2DRAMController/GigabyteRGBFusion2DRAMController.cpp +++ b/Controllers/GigabyteRGBFusion2DRAMController/GigabyteRGBFusion2DRAMController.cpp @@ -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 "); diff --git a/Controllers/GigabyteRGBFusion2DRAMController/GigabyteRGBFusion2DRAMControllerDetect.cpp b/Controllers/GigabyteRGBFusion2DRAMController/GigabyteRGBFusion2DRAMControllerDetect.cpp index 3ed6bb0f6..9760ba1d3 100644 --- a/Controllers/GigabyteRGBFusion2DRAMController/GigabyteRGBFusion2DRAMControllerDetect.cpp +++ b/Controllers/GigabyteRGBFusion2DRAMController/GigabyteRGBFusion2DRAMControllerDetect.cpp @@ -54,7 +54,7 @@ DetectedControllers DetectGigabyteRGBFusion2DRAMControllers(std::vectorpci_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)) diff --git a/Controllers/GigabyteRGBFusion2GPUController/GigabyteRGBFusion2GPUController.cpp b/Controllers/GigabyteRGBFusion2GPUController/GigabyteRGBFusion2GPUController.cpp index fb874bc6d..043484f8e 100644 --- a/Controllers/GigabyteRGBFusion2GPUController/GigabyteRGBFusion2GPUController.cpp +++ b/Controllers/GigabyteRGBFusion2GPUController/GigabyteRGBFusion2GPUController.cpp @@ -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 "); diff --git a/Controllers/GigabyteRGBFusion2GPUController/GigabyteRGBFusion2GPUControllerDetect.cpp b/Controllers/GigabyteRGBFusion2GPUController/GigabyteRGBFusion2GPUControllerDetect.cpp index 8cdcd22c6..6a052314c 100644 --- a/Controllers/GigabyteRGBFusion2GPUController/GigabyteRGBFusion2GPUControllerDetect.cpp +++ b/Controllers/GigabyteRGBFusion2GPUController/GigabyteRGBFusion2GPUControllerDetect.cpp @@ -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; } diff --git a/Controllers/GigabyteRGBFusion2SMBusController/GigabyteRGBFusion2SMBusController.cpp b/Controllers/GigabyteRGBFusion2SMBusController/GigabyteRGBFusion2SMBusController.cpp index 7fbbf5654..c2bfdb593 100644 --- a/Controllers/GigabyteRGBFusion2SMBusController/GigabyteRGBFusion2SMBusController.cpp +++ b/Controllers/GigabyteRGBFusion2SMBusController/GigabyteRGBFusion2SMBusController.cpp @@ -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 "); diff --git a/Controllers/GigabyteRGBFusion2SMBusController/GigabyteRGBFusion2SMBusControllerDetect.cpp b/Controllers/GigabyteRGBFusion2SMBusController/GigabyteRGBFusion2SMBusControllerDetect.cpp index deaabffce..71cd449fb 100644 --- a/Controllers/GigabyteRGBFusion2SMBusController/GigabyteRGBFusion2SMBusControllerDetect.cpp +++ b/Controllers/GigabyteRGBFusion2SMBusController/GigabyteRGBFusion2SMBusControllerDetect.cpp @@ -114,16 +114,16 @@ DetectedControllers DetectGigabyteRGBFusion2SMBusControllers(std::vectorpci_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) { diff --git a/Controllers/GigabyteRGBFusionController/GigabyteRGBFusionController.cpp b/Controllers/GigabyteRGBFusionController/GigabyteRGBFusionController.cpp index c1661e6fe..84082db3f 100644 --- a/Controllers/GigabyteRGBFusionController/GigabyteRGBFusionController.cpp +++ b/Controllers/GigabyteRGBFusionController/GigabyteRGBFusionController.cpp @@ -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 "); diff --git a/Controllers/GigabyteRGBFusionController/GigabyteRGBFusionControllerDetect.cpp b/Controllers/GigabyteRGBFusionController/GigabyteRGBFusionControllerDetect.cpp index e689f9f61..2e1e589d4 100644 --- a/Controllers/GigabyteRGBFusionController/GigabyteRGBFusionControllerDetect.cpp +++ b/Controllers/GigabyteRGBFusionController/GigabyteRGBFusionControllerDetect.cpp @@ -49,9 +49,9 @@ DetectedControllers DetectGigabyteRGBFusionControllers(std::vectorpci_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); diff --git a/Controllers/GigabyteRGBFusionGPUController/GigabyteRGBFusionGPUController.cpp b/Controllers/GigabyteRGBFusionGPUController/GigabyteRGBFusionGPUController.cpp index e81136098..a41eae8ce 100644 --- a/Controllers/GigabyteRGBFusionGPUController/GigabyteRGBFusionGPUController.cpp +++ b/Controllers/GigabyteRGBFusionGPUController/GigabyteRGBFusionGPUController.cpp @@ -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 "); diff --git a/Controllers/HyperXDRAMController/HyperXDRAMController.cpp b/Controllers/HyperXDRAMController/HyperXDRAMController.cpp index 66df31cfd..dca621720 100644 --- a/Controllers/HyperXDRAMController/HyperXDRAMController.cpp +++ b/Controllers/HyperXDRAMController/HyperXDRAMController.cpp @@ -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 "); diff --git a/Controllers/HyperXDRAMController/HyperXDRAMControllerDetect.cpp b/Controllers/HyperXDRAMController/HyperXDRAMControllerDetect.cpp index b385a26da..2bade08d2 100644 --- a/Controllers/HyperXDRAMController/HyperXDRAMControllerDetect.cpp +++ b/Controllers/HyperXDRAMController/HyperXDRAMControllerDetect.cpp @@ -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)) { diff --git a/Controllers/KingstonFuryDRAMController/KingstonFuryDRAMController.cpp b/Controllers/KingstonFuryDRAMController/KingstonFuryDRAMController.cpp index f94f1bccc..74a9ee29b 100644 --- a/Controllers/KingstonFuryDRAMController/KingstonFuryDRAMController.cpp +++ b/Controllers/KingstonFuryDRAMController/KingstonFuryDRAMController.cpp @@ -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++) { diff --git a/Controllers/LEDStripController/LEDStripController.cpp b/Controllers/LEDStripController/LEDStripController.cpp index 81d4e62cd..0007191d7 100644 --- a/Controllers/LEDStripController/LEDStripController.cpp +++ b/Controllers/LEDStripController/LEDStripController.cpp @@ -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 { diff --git a/Controllers/MSIGPUController/MSIGPUController/MSIGPUController.cpp b/Controllers/MSIGPUController/MSIGPUController/MSIGPUController.cpp index 83243747b..6230ae741 100644 --- a/Controllers/MSIGPUController/MSIGPUController/MSIGPUController.cpp +++ b/Controllers/MSIGPUController/MSIGPUController/MSIGPUController.cpp @@ -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 "); diff --git a/Controllers/MSIGPUController/MSIGPUController/MSIGPUControllerDetect.cpp b/Controllers/MSIGPUController/MSIGPUController/MSIGPUControllerDetect.cpp index 6b7a31836..3b3f04475 100644 --- a/Controllers/MSIGPUController/MSIGPUController/MSIGPUControllerDetect.cpp +++ b/Controllers/MSIGPUController/MSIGPUController/MSIGPUControllerDetect.cpp @@ -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); diff --git a/Controllers/MSIGPUController/MSIGPUv2Controller/MSIGPUv2Controller.cpp b/Controllers/MSIGPUController/MSIGPUv2Controller/MSIGPUv2Controller.cpp index f66195045..1589726c7 100644 --- a/Controllers/MSIGPUController/MSIGPUv2Controller/MSIGPUv2Controller.cpp +++ b/Controllers/MSIGPUController/MSIGPUv2Controller/MSIGPUv2Controller.cpp @@ -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 "); diff --git a/Controllers/MSIGPUController/MSIGPUv2Controller/MSIGPUv2ControllerDetect.cpp b/Controllers/MSIGPUController/MSIGPUv2Controller/MSIGPUv2ControllerDetect.cpp index 9b3c86cd0..d615600ac 100644 --- a/Controllers/MSIGPUController/MSIGPUv2Controller/MSIGPUv2ControllerDetect.cpp +++ b/Controllers/MSIGPUController/MSIGPUv2Controller/MSIGPUv2ControllerDetect.cpp @@ -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); diff --git a/Controllers/ManliGPUController/ManliGPUController.cpp b/Controllers/ManliGPUController/ManliGPUController.cpp index 8f04aeb43..c1820128f 100644 --- a/Controllers/ManliGPUController/ManliGPUController.cpp +++ b/Controllers/ManliGPUController/ManliGPUController.cpp @@ -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 "); diff --git a/Controllers/PNYARGBEpicXGPUController/PNYARGBEpicXGPUController.cpp b/Controllers/PNYARGBEpicXGPUController/PNYARGBEpicXGPUController.cpp index 2fa69d855..87b7aa391 100644 --- a/Controllers/PNYARGBEpicXGPUController/PNYARGBEpicXGPUController.cpp +++ b/Controllers/PNYARGBEpicXGPUController/PNYARGBEpicXGPUController.cpp @@ -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 "); diff --git a/Controllers/PNYARGBEpicXGPUController/PNYARGBEpicXGPUControllerDetect.cpp b/Controllers/PNYARGBEpicXGPUController/PNYARGBEpicXGPUControllerDetect.cpp index cb71a2a56..62a18b2ac 100644 --- a/Controllers/PNYARGBEpicXGPUController/PNYARGBEpicXGPUControllerDetect.cpp +++ b/Controllers/PNYARGBEpicXGPUController/PNYARGBEpicXGPUControllerDetect.cpp @@ -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); diff --git a/Controllers/PNYGPUController/PNYGPUController.cpp b/Controllers/PNYGPUController/PNYGPUController.cpp index 54d28e6c1..2be5132cf 100644 --- a/Controllers/PNYGPUController/PNYGPUController.cpp +++ b/Controllers/PNYGPUController/PNYGPUController.cpp @@ -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 "); diff --git a/Controllers/PNYGPUController/PNYGPUControllerDetect.cpp b/Controllers/PNYGPUController/PNYGPUControllerDetect.cpp index f66baa828..2b5162ea2 100644 --- a/Controllers/PNYGPUController/PNYGPUControllerDetect.cpp +++ b/Controllers/PNYGPUController/PNYGPUControllerDetect.cpp @@ -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); diff --git a/Controllers/PNYLovelaceGPUController/PNYLovelaceGPUController.cpp b/Controllers/PNYLovelaceGPUController/PNYLovelaceGPUController.cpp index d0432024f..016359d56 100644 --- a/Controllers/PNYLovelaceGPUController/PNYLovelaceGPUController.cpp +++ b/Controllers/PNYLovelaceGPUController/PNYLovelaceGPUController.cpp @@ -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 "); diff --git a/Controllers/PNYLovelaceGPUController/PNYLovelaceGPUControllerDetect.cpp b/Controllers/PNYLovelaceGPUController/PNYLovelaceGPUControllerDetect.cpp index caf640161..f99c87c4e 100644 --- a/Controllers/PNYLovelaceGPUController/PNYLovelaceGPUControllerDetect.cpp +++ b/Controllers/PNYLovelaceGPUController/PNYLovelaceGPUControllerDetect.cpp @@ -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); diff --git a/Controllers/PalitGPUController/PalitGPUController.cpp b/Controllers/PalitGPUController/PalitGPUController.cpp index c790afe31..e79049cc7 100644 --- a/Controllers/PalitGPUController/PalitGPUController.cpp +++ b/Controllers/PalitGPUController/PalitGPUController.cpp @@ -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 "); diff --git a/Controllers/PalitGPUController/PalitGPUControllerDetect.cpp b/Controllers/PalitGPUController/PalitGPUControllerDetect.cpp index 943d3b76d..9fd02436c 100644 --- a/Controllers/PalitGPUController/PalitGPUControllerDetect.cpp +++ b/Controllers/PalitGPUController/PalitGPUControllerDetect.cpp @@ -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 | diff --git a/Controllers/PatriotViperController/PatriotViperController.cpp b/Controllers/PatriotViperController/PatriotViperController.cpp index 2e5042035..978afadfe 100644 --- a/Controllers/PatriotViperController/PatriotViperController.cpp +++ b/Controllers/PatriotViperController/PatriotViperController.cpp @@ -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 "); diff --git a/Controllers/PatriotViperController/PatriotViperControllerDetect.cpp b/Controllers/PatriotViperController/PatriotViperControllerDetect.cpp index c7df26d47..04a576c9c 100644 --- a/Controllers/PatriotViperController/PatriotViperControllerDetect.cpp +++ b/Controllers/PatriotViperController/PatriotViperControllerDetect.cpp @@ -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)) { diff --git a/Controllers/PatriotViperSteelController/PatriotViperSteelController.cpp b/Controllers/PatriotViperSteelController/PatriotViperSteelController.cpp index 3d38884cc..e128297b7 100644 --- a/Controllers/PatriotViperSteelController/PatriotViperSteelController.cpp +++ b/Controllers/PatriotViperSteelController/PatriotViperSteelController.cpp @@ -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 "); diff --git a/Controllers/PatriotViperSteelController/PatriotViperSteelControllerDetect.cpp b/Controllers/PatriotViperSteelController/PatriotViperSteelControllerDetect.cpp index 714280818..a880722df 100644 --- a/Controllers/PatriotViperSteelController/PatriotViperSteelControllerDetect.cpp +++ b/Controllers/PatriotViperSteelController/PatriotViperSteelControllerDetect.cpp @@ -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)) { diff --git a/Controllers/PowerColorGPUController/PowerColorRedDevilV1Controller/PowerColorRedDevilV1Controller.cpp b/Controllers/PowerColorGPUController/PowerColorRedDevilV1Controller/PowerColorRedDevilV1Controller.cpp index 4ced96274..d2d109ce9 100644 --- a/Controllers/PowerColorGPUController/PowerColorRedDevilV1Controller/PowerColorRedDevilV1Controller.cpp +++ b/Controllers/PowerColorGPUController/PowerColorRedDevilV1Controller/PowerColorRedDevilV1Controller.cpp @@ -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 "); diff --git a/Controllers/PowerColorGPUController/PowerColorRedDevilV2Controller/PowerColorRedDevilV2Controller.cpp b/Controllers/PowerColorGPUController/PowerColorRedDevilV2Controller/PowerColorRedDevilV2Controller.cpp index 598538ca8..d8cf803c9 100644 --- a/Controllers/PowerColorGPUController/PowerColorRedDevilV2Controller/PowerColorRedDevilV2Controller.cpp +++ b/Controllers/PowerColorGPUController/PowerColorRedDevilV2Controller/PowerColorRedDevilV2Controller.cpp @@ -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; -} \ No newline at end of file +} diff --git a/Controllers/SapphireGPUController/SapphireGPUControllerDetect.cpp b/Controllers/SapphireGPUController/SapphireGPUControllerDetect.cpp index 184a18ab4..49b8edbdf 100644 --- a/Controllers/SapphireGPUController/SapphireGPUControllerDetect.cpp +++ b/Controllers/SapphireGPUController/SapphireGPUControllerDetect.cpp @@ -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; } diff --git a/Controllers/SapphireGPUController/SapphireNitroGlowV1Controller/SapphireNitroGlowV1Controller.cpp b/Controllers/SapphireGPUController/SapphireNitroGlowV1Controller/SapphireNitroGlowV1Controller.cpp index 896221fad..947859c2e 100644 --- a/Controllers/SapphireGPUController/SapphireNitroGlowV1Controller/SapphireNitroGlowV1Controller.cpp +++ b/Controllers/SapphireGPUController/SapphireNitroGlowV1Controller/SapphireNitroGlowV1Controller.cpp @@ -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 "); diff --git a/Controllers/SapphireGPUController/SapphireNitroGlowV3Controller/SapphireNitroGlowV3Controller.cpp b/Controllers/SapphireGPUController/SapphireNitroGlowV3Controller/SapphireNitroGlowV3Controller.cpp index 1583431f5..3e5adfa4b 100644 --- a/Controllers/SapphireGPUController/SapphireNitroGlowV3Controller/SapphireNitroGlowV3Controller.cpp +++ b/Controllers/SapphireGPUController/SapphireNitroGlowV3Controller/SapphireNitroGlowV3Controller.cpp @@ -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 "); diff --git a/Controllers/TForceXtreemController/TForceXtreemController.cpp b/Controllers/TForceXtreemController/TForceXtreemController.cpp index 63e3f50d3..00eba75c4 100644 --- a/Controllers/TForceXtreemController/TForceXtreemController.cpp +++ b/Controllers/TForceXtreemController/TForceXtreemController.cpp @@ -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); diff --git a/Controllers/ZotacBlackwellGPUController/ZotacBlackwellGPUController.cpp b/Controllers/ZotacBlackwellGPUController/ZotacBlackwellGPUController.cpp index 361dc00d8..77389319c 100644 --- a/Controllers/ZotacBlackwellGPUController/ZotacBlackwellGPUController.cpp +++ b/Controllers/ZotacBlackwellGPUController/ZotacBlackwellGPUController.cpp @@ -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 "); diff --git a/Controllers/ZotacTuringGPUController/ZotacTuringGPUController.cpp b/Controllers/ZotacTuringGPUController/ZotacTuringGPUController.cpp index 1b8c107e5..410f8a6f4 100644 --- a/Controllers/ZotacTuringGPUController/ZotacTuringGPUController.cpp +++ b/Controllers/ZotacTuringGPUController/ZotacTuringGPUController.cpp @@ -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 "); diff --git a/Controllers/ZotacV2GPUController/ZotacV2GPUController.cpp b/Controllers/ZotacV2GPUController/ZotacV2GPUController.cpp index efa3b1dd6..03289ba45 100644 --- a/Controllers/ZotacV2GPUController/ZotacV2GPUController.cpp +++ b/Controllers/ZotacV2GPUController/ZotacV2GPUController.cpp @@ -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 "); diff --git a/DetectionManager.cpp b/DetectionManager.cpp index 66c6bcad2..703eef278 100644 --- a/DetectionManager.cpp +++ b/DetectionManager.cpp @@ -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 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); diff --git a/NetworkClient.cpp b/NetworkClient.cpp index 59470b527..3b0802645 100644 --- a/NetworkClient.cpp +++ b/NetworkClient.cpp @@ -334,6 +334,50 @@ void NetworkClient::RegisterNetworkClientCallback(NetworkClientCallback new_call NetworkClientCallbackArgs.push_back(new_callback_arg); } +/*-----------------------------------------------------*\ +| Device Info Functions | +\*-----------------------------------------------------*/ +std::vector NetworkClient::GetI2CBusInfo() +{ + std::vector 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 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: diff --git a/NetworkClient.h b/NetworkClient.h index b7829e7b3..d080b3dbb 100644 --- a/NetworkClient.h +++ b/NetworkClient.h @@ -15,6 +15,7 @@ #include #include #include +#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 GetI2CBusInfo(); + /*-----------------------------------------------------*\ | DetectionManager functions | \*-----------------------------------------------------*/ diff --git a/NetworkProtocol.h b/NetworkProtocol.h index 6f65b2227..bf25de3be 100644 --- a/NetworkProtocol.h +++ b/NetworkProtocol.h @@ -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 */ /*----------------------------------------------------------------------------------------------------------*\ diff --git a/NetworkServer.cpp b/NetworkServer.cpp index 747076a1d..13ad7fc18 100644 --- a/NetworkServer.cpp +++ b/NetworkServer.cpp @@ -11,6 +11,7 @@ #include #include +#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 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) diff --git a/NetworkServer.h b/NetworkServer.h index 7a549b8da..7569bd956 100644 --- a/NetworkServer.h +++ b/NetworkServer.h @@ -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); diff --git a/ResourceManager.cpp b/ResourceManager.cpp index 60b95191d..8a62ea53f 100644 --- a/ResourceManager.cpp +++ b/ResourceManager.cpp @@ -286,6 +286,26 @@ std::vector & ResourceManager::GetI2CBuses() return DetectionManager::get()->GetI2CBuses(); } +std::vector ResourceManager::GetI2CBusInfo() +{ + if(IsLocalClient()) + { + return(GetLocalClient()->GetI2CBusInfo()); + } + else + { + std::vector bus_info; + std::vector 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(); diff --git a/ResourceManager.h b/ResourceManager.h index 292c43ef1..bc66dc12d 100644 --- a/ResourceManager.h +++ b/ResourceManager.h @@ -56,6 +56,7 @@ public: unsigned short GetDefaultServerPort(); LogManager* GetLogManager(); std::vector& GetI2CBuses(); + std::vector GetI2CBusInfo(); PluginManagerInterface* GetPluginManager(); ProfileManager* GetProfileManager(); std::vector& GetRGBControllers(); diff --git a/SPDAccessor/EE1004Accessor_Linux.cpp b/SPDAccessor/EE1004Accessor_Linux.cpp index 9b48d36f7..5fc8d1733 100644 --- a/SPDAccessor/EE1004Accessor_Linux.cpp +++ b/SPDAccessor/EE1004Accessor_Linux.cpp @@ -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) diff --git a/SPDAccessor/SPD5118Accessor_Linux.cpp b/SPDAccessor/SPD5118Accessor_Linux.cpp index 4ed392fbe..01db125bc 100644 --- a/SPDAccessor/SPD5118Accessor_Linux.cpp +++ b/SPDAccessor/SPD5118Accessor_Linux.cpp @@ -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) diff --git a/SPDAccessor/SPDDetector.cpp b/SPDAccessor/SPDDetector.cpp index 6a82e40d6..29bb60b71 100644 --- a/SPDAccessor/SPDDetector.cpp +++ b/SPDAccessor/SPDDetector.cpp @@ -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; } diff --git a/i2c_smbus/Linux/i2c_smbus_linux.cpp b/i2c_smbus/Linux/i2c_smbus_linux.cpp index c34d05cf9..00b89d7b4 100644 --- a/i2c_smbus/Linux/i2c_smbus_linux.cpp +++ b/i2c_smbus/Linux/i2c_smbus_linux.cpp @@ -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 diff --git a/i2c_smbus/MacOS/i2c_smbus_i801.cpp b/i2c_smbus/MacOS/i2c_smbus_i801.cpp index 1ea45535a..261c4515e 100644 --- a/i2c_smbus/MacOS/i2c_smbus_i801.cpp +++ b/i2c_smbus/MacOS/i2c_smbus_i801.cpp @@ -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); diff --git a/i2c_smbus/MacOS/i2c_smbus_nct6775.cpp b/i2c_smbus/MacOS/i2c_smbus_nct6775.cpp index a9609b975..a9ece41e3 100644 --- a/i2c_smbus/MacOS/i2c_smbus_nct6775.cpp +++ b/i2c_smbus/MacOS/i2c_smbus_nct6775.cpp @@ -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; } diff --git a/i2c_smbus/MacOS/i2c_smbus_piix4.cpp b/i2c_smbus/MacOS/i2c_smbus_piix4.cpp index 48034e90d..119ee9a55 100644 --- a/i2c_smbus/MacOS/i2c_smbus_piix4.cpp +++ b/i2c_smbus/MacOS/i2c_smbus_piix4.cpp @@ -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); diff --git a/i2c_smbus/Windows/i2c_smbus_amdadl.cpp b/i2c_smbus/Windows/i2c_smbus_amdadl.cpp index 1282149be..1cab43972 100644 --- a/i2c_smbus/Windows/i2c_smbus_amdadl.cpp +++ b/i2c_smbus/Windows/i2c_smbus_amdadl.cpp @@ -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); } } diff --git a/i2c_smbus/Windows/i2c_smbus_nvapi.cpp b/i2c_smbus/Windows/i2c_smbus_nvapi.cpp index 65a0a97e3..eb5f7c0e0 100644 --- a/i2c_smbus/Windows/i2c_smbus_nvapi.cpp +++ b/i2c_smbus/Windows/i2c_smbus_nvapi.cpp @@ -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); diff --git a/i2c_smbus/Windows/i2c_smbus_pawnio.cpp b/i2c_smbus/Windows/i2c_smbus_pawnio.cpp index b3fa10c4e..cc4b3b4a1 100644 --- a/i2c_smbus/Windows/i2c_smbus_pawnio.cpp +++ b/i2c_smbus/Windows/i2c_smbus_pawnio.cpp @@ -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 ); } /*-----------------------------------------------------*\ diff --git a/i2c_smbus/i2c_amd_gpu.h b/i2c_smbus/i2c_amd_gpu.h index b3e35d14f..74511fcdb 100644 --- a/i2c_smbus/i2c_amd_gpu.h +++ b/i2c_smbus/i2c_amd_gpu.h @@ -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; } diff --git a/i2c_smbus/i2c_smbus.cpp b/i2c_smbus/i2c_smbus.cpp index 2d2c986f1..78af7e731 100644 --- a/i2c_smbus/i2c_smbus.cpp +++ b/i2c_smbus/i2c_smbus.cpp @@ -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() diff --git a/i2c_smbus/i2c_smbus.h b/i2c_smbus/i2c_smbus.h index 82d5f4a9f..7cae8db3b 100644 --- a/i2c_smbus/i2c_smbus.h +++ b/i2c_smbus/i2c_smbus.h @@ -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(); diff --git a/qt/OpenRGBHardwareIDsDialog/OpenRGBHardwareIDsDialog.cpp b/qt/OpenRGBHardwareIDsDialog/OpenRGBHardwareIDsDialog.cpp index 30e2cdb72..911a02559 100644 --- a/qt/OpenRGBHardwareIDsDialog/OpenRGBHardwareIDsDialog.cpp +++ b/qt/OpenRGBHardwareIDsDialog/OpenRGBHardwareIDsDialog.cpp @@ -34,36 +34,36 @@ OpenRGBHardwareIDsDialog::~OpenRGBHardwareIDsDialog() int OpenRGBHardwareIDsDialog::show() { - /*---------------------------------------------------------*\ - | Add i2c buses infos | - \*---------------------------------------------------------*/ - std::vector i2c_buses = ResourceManager::get()->GetI2CBuses(); + /*-----------------------------------------------------*\ + | Add I2C Buses | + \*-----------------------------------------------------*/ + std::vector 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; diff --git a/qt/OpenRGBSystemInfoPage/OpenRGBSystemInfoPage.cpp b/qt/OpenRGBSystemInfoPage/OpenRGBSystemInfoPage.cpp index ff6d3df4a..5b3688791 100644 --- a/qt/OpenRGBSystemInfoPage/OpenRGBSystemInfoPage.cpp +++ b/qt/OpenRGBSystemInfoPage/OpenRGBSystemInfoPage.cpp @@ -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);