Browse Source

Show dialog if any common I2C/SMBus initialization errors occur

merge-requests/838/head
Adam Honse 2 months ago
parent
commit
de4231f3ea
  1. 24
      ResourceManager.cpp
  2. 2
      ResourceManager.h
  3. 5
      i2c_smbus/i2c_smbus_amdadl.cpp
  4. 8
      i2c_smbus/i2c_smbus_i801.cpp
  5. 6
      i2c_smbus/i2c_smbus_linux.cpp
  6. 6
      i2c_smbus/i2c_smbus_nct6775.cpp
  7. 4
      i2c_smbus/i2c_smbus_nvapi.cpp
  8. 8
      i2c_smbus/i2c_smbus_piix4.cpp

24
ResourceManager.cpp

@ -757,9 +757,15 @@ void ResourceManager::DetectDevicesThreadFunction()
LOG_INFO("| Detecting I2C interfaces |");
LOG_INFO("------------------------------------------------------");
bool i2c_interface_fail = false;
for(unsigned int i2c_bus_detector_idx = 0; i2c_bus_detector_idx < i2c_bus_detectors.size() && detection_is_required.load(); i2c_bus_detector_idx++)
{
i2c_bus_detectors[i2c_bus_detector_idx]();
if(i2c_bus_detectors[i2c_bus_detector_idx]() == false)
{
i2c_interface_fail = true;
}
I2CBusListChanged();
}
@ -1097,6 +1103,22 @@ void ResourceManager::DetectDevicesThreadFunction()
LOG_INFO("------------------------------------------------------");
LOG_INFO("| Detection completed |");
LOG_INFO("------------------------------------------------------");
/*-------------------------------------------------*\
| If any i2c interfaces failed to detect due to an |
| error condition, show a dialog |
\*-------------------------------------------------*/
LOG_DIALOG("One or more I2C/SMBus interfaces failed to initialize.\r"
#ifdef _WIN32
"On Windows, this is usually caused by a failure to load the inpout32 driver.\r"
"You must run OpenRGB as administrator at least once to allow inpout32 to set up.\r"
#endif
#ifdef __linux__
"On Linux, this is usually because the i2c-dev module is not loaded.\r"
"You must load the i2c-dev module along with the correct i2c driver for your motherboard.\r"
"This is usually i2c-piix4 for AMD systems and i2c-i801 for Intel systems.\r"
#endif
"See https://help.openrgb.org for additional troubleshooting.");
}
void ResourceManager::StopDeviceDetection()

2
ResourceManager.h

@ -32,7 +32,7 @@
struct hid_device_info;
typedef std::function<void()> I2CBusDetectorFunction;
typedef std::function<bool()> I2CBusDetectorFunction;
typedef std::function<void(std::vector<RGBController*>&)> DeviceDetectorFunction;
typedef std::function<void(std::vector<i2c_smbus_interface*>&)> I2CDeviceDetectorFunction;
typedef std::function<void(hid_device_info*, const std::string&)> HIDDeviceDetectorFunction;

5
i2c_smbus/i2c_smbus_amdadl.cpp

@ -196,7 +196,7 @@ s32 i2c_smbus_amdadl::i2c_smbus_xfer(u8 addr, char read_write, u8 command, int s
#include "Detector.h"
void i2c_smbus_amdadl_detect()
bool i2c_smbus_amdadl_detect()
{
int adl_status;
int gpu_count = 0;
@ -207,6 +207,7 @@ void i2c_smbus_amdadl_detect()
if (ADL_OK != ADL2_Main_Control_Create(::ADL_Main_Memory_Alloc, 1, &context))
{
printf("Cannot get handle!\n");
return(false);
}
else
{
@ -214,6 +215,8 @@ void i2c_smbus_amdadl_detect()
ResourceManager::get()->RegisterI2CBus(adl_bus);
}
}
return(true);
} /* DetectAMDADLI2CBusses() */
REGISTER_I2C_BUS_DETECTOR(i2c_smbus_amdadl_detect);

8
i2c_smbus/i2c_smbus_i801.cpp

@ -487,12 +487,12 @@ s32 i2c_smbus_i801::i2c_smbus_xfer(u8 addr, char read_write, u8 command, int siz
#include "Detector.h"
#include "wmi.h"
void i2c_smbus_i801_detect()
bool i2c_smbus_i801_detect()
{
if(!IsInpOutDriverOpen())
{
LOG_INFO("inpout32 is not loaded, i801 I2C bus detection aborted");
return;
return(false);
}
i2c_smbus_interface * bus;
@ -507,7 +507,7 @@ void i2c_smbus_i801_detect()
if (hres)
{
LOG_INFO("WMI query failed, i801 I2C bus detection aborted");
return;
return(false);
}
// For each detected SMBus adapter, try enumerating it as either AMD or Intel
@ -564,6 +564,8 @@ void i2c_smbus_i801_detect()
}
}
}
return(true);
}
REGISTER_I2C_BUS_DETECTOR(i2c_smbus_i801_detect);

6
i2c_smbus/i2c_smbus_linux.cpp

@ -34,7 +34,7 @@ s32 i2c_smbus_linux::i2c_smbus_xfer(u8 addr, char read_write, u8 command, int si
#include <dirent.h>
#include <string.h>
void i2c_smbus_linux_detect()
bool i2c_smbus_linux_detect()
{
i2c_smbus_linux * bus;
char device_string[1024];
@ -53,7 +53,7 @@ void i2c_smbus_linux_detect()
if(dir == NULL)
{
return;
return(false);
}
// Loop through all entries in i2c-adapter list
@ -160,6 +160,8 @@ void i2c_smbus_linux_detect()
ent = readdir(dir);
}
closedir(dir);
return(true);
}
REGISTER_I2C_BUS_DETECTOR(i2c_smbus_linux_detect);

6
i2c_smbus/i2c_smbus_nct6775.cpp

@ -192,12 +192,12 @@ s32 i2c_smbus_nct6775::i2c_smbus_xfer(u8 addr, char read_write, u8 command, int
#include "Detector.h"
#include "super_io.h"
void i2c_smbus_nct6775_detect()
bool i2c_smbus_nct6775_detect()
{
if(!IsInpOutDriverOpen())
{
LOG_INFO("inpout32 is not loaded, nct6775 I2C bus detection aborted");
return;
return(false);
}
i2c_smbus_interface* bus;
@ -249,6 +249,8 @@ void i2c_smbus_nct6775_detect()
ResourceManager::get()->RegisterI2CBus(bus);
}
return(true);
}
REGISTER_I2C_BUS_DETECTOR(i2c_smbus_nct6775_detect);

4
i2c_smbus/i2c_smbus_nvapi.cpp

@ -114,7 +114,7 @@ s32 i2c_smbus_nvapi::i2c_smbus_xfer(u8 addr, char read_write, u8 command, int mo
#include "Detector.h"
void i2c_smbus_nvapi_detect()
bool i2c_smbus_nvapi_detect()
{
static NV_PHYSICAL_GPU_HANDLE gpu_handles[64];
static NV_S32 gpu_count = 0;
@ -148,6 +148,8 @@ void i2c_smbus_nvapi_detect()
ResourceManager::get()->RegisterI2CBus(nvapi_bus);
}
return(true);
} /* DetectNvAPII2CBusses() */
REGISTER_I2C_BUS_DETECTOR(i2c_smbus_nvapi_detect);

8
i2c_smbus/i2c_smbus_piix4.cpp

@ -181,12 +181,12 @@ s32 i2c_smbus_piix4::i2c_smbus_xfer(u8 addr, char read_write, u8 command, int si
#include "Detector.h"
#include "wmi.h"
void i2c_smbus_piix4_detect()
bool i2c_smbus_piix4_detect()
{
if(!IsInpOutDriverOpen())
{
LOG_INFO("inpout32 is not loaded, piix4 I2C bus detection aborted");
return;
return(false);
}
i2c_smbus_interface * bus;
@ -201,7 +201,7 @@ void i2c_smbus_piix4_detect()
if (hres)
{
LOG_INFO("WMI query failed, piix4 I2C bus detection aborted");
return;
return(false);
}
// For each detected SMBus adapter, try enumerating it as either AMD or Intel
@ -249,6 +249,8 @@ void i2c_smbus_piix4_detect()
ResourceManager::get()->RegisterI2CBus(bus);
}
}
return(true);
}
REGISTER_I2C_BUS_DETECTOR(i2c_smbus_piix4_detect);

Loading…
Cancel
Save