Skip to content

Commit 49fda96

Browse files
Load sizes for HID devices after detection
1 parent a7acefb commit 49fda96

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

ResourceManager.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ std::vector<i2c_smbus_interface*> & ResourceManager::GetI2CBusses()
7878
void ResourceManager::RegisterRGBController(RGBController *rgb_controller)
7979
{
8080
rgb_controllers_hw.push_back(rgb_controller);
81+
8182
DeviceListChanged();
8283
}
8384

@@ -584,6 +585,24 @@ void ResourceManager::DetectDevicesThreadFunction()
584585
DetectionProgressChanged();
585586

586587
hid_device_detectors[hid_detector_idx].function(current_hid_device, hid_device_detectors[hid_detector_idx].name);
588+
589+
/*-------------------------------------------------*\
590+
| If the device list size has changed, call the |
591+
| device list changed callbacks |
592+
\*-------------------------------------------------*/
593+
if(rgb_controllers_hw.size() != prev_count)
594+
{
595+
/*-------------------------------------------------*\
596+
| First, load sizes for the new controllers |
597+
\*-------------------------------------------------*/
598+
for(unsigned int controller_size_idx = prev_count - 1; controller_size_idx < rgb_controllers_hw.size(); controller_size_idx++)
599+
{
600+
profile_manager->LoadDeviceFromListWithOptions(rgb_controllers_sizes, size_used, rgb_controllers_hw[controller_size_idx], true, false);
601+
}
602+
603+
DeviceListChanged();
604+
}
605+
prev_count = rgb_controllers_hw.size();
587606
}
588607
}
589608

0 commit comments

Comments
 (0)