Add additional information to OpenRazer, set SPD to page 1 for proper HyperX detection
This commit is contained in:
parent
1a5b12c7a0
commit
e799574730
2 changed files with 52 additions and 0 deletions
|
|
@ -74,6 +74,10 @@ void DetectHyperXControllers(std::vector<i2c_smbus_interface*> &busses, std::vec
|
|||
// Check for HyperX controller at 0x27
|
||||
if (TestForHyperXController(busses[bus], 0x27))
|
||||
{
|
||||
busses[bus]->i2c_smbus_write_byte_data(0x37, 0x00, 0xFF);
|
||||
|
||||
Sleep(1);
|
||||
|
||||
for(int slot_addr = 0x50; slot_addr <= 0x57; slot_addr++)
|
||||
{
|
||||
// Test for HyperX SPD at slot_addr
|
||||
|
|
|
|||
|
|
@ -231,6 +231,34 @@ static std::string GetDeviceTypeString(std::string dev_path)
|
|||
return(ret_str);
|
||||
}
|
||||
|
||||
static std::string GetFirmwareVersionString(std::string dev_path)
|
||||
{
|
||||
// Read firmware_version for firmware version string
|
||||
std::string firm_ver_path = dev_path + "/firmware_version";
|
||||
std::ifstream firm_ver_file;
|
||||
std::string ret_str;
|
||||
|
||||
firm_ver_file.open(firm_ver_path);
|
||||
std::getline(firm_ver_file, ret_str);
|
||||
firm_ver_file.close();
|
||||
|
||||
return(ret_str);
|
||||
}
|
||||
|
||||
static std::string GetSerialNumberString(std::string dev_path)
|
||||
{
|
||||
// Read device_serial for serial number string
|
||||
std::string ser_num_path = dev_path + "/device_serial";
|
||||
std::ifstream ser_num_file;
|
||||
std::string ret_str;
|
||||
|
||||
ser_num_file.open(ser_num_path);
|
||||
std::getline(ser_num_file, ret_str);
|
||||
ser_num_file.close();
|
||||
|
||||
return(ret_str);
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetupMatrixDevice(std::string dev_path, unsigned int rows, unsigned int cols)
|
||||
{
|
||||
matrix_custom_frame.open(dev_path + "/matrix_custom_frame");
|
||||
|
|
@ -289,6 +317,26 @@ RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
|
|||
\*-----------------------------------------------------------------*/
|
||||
name = GetDeviceTypeString(dev_path);
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Set the description to indicate this is an OpenRazer device |
|
||||
\*-----------------------------------------------------------------*/
|
||||
description = "OpenRazer Device";
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Set the device path as the location |
|
||||
\*-----------------------------------------------------------------*/
|
||||
location = dev_path;
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Get the serial number from the dev path |
|
||||
\*-----------------------------------------------------------------*/
|
||||
serial = GetSerialNumberString(dev_path);
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Get the firmware version from the dev path |
|
||||
\*-----------------------------------------------------------------*/
|
||||
version = GetFirmwareVersionString(dev_path);
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Loop through all known devices to look for a name match |
|
||||
\*-----------------------------------------------------------------*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue