From a7acefb2844bc4a74e7d169eb4dd600d21480127 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Thu, 3 Dec 2020 00:10:53 -0600 Subject: [PATCH] Ignore location string when loading profiles for HID devices --- ProfileManager.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/ProfileManager.cpp b/ProfileManager.cpp index 5267f38d..35bf5368 100644 --- a/ProfileManager.cpp +++ b/ProfileManager.cpp @@ -171,16 +171,28 @@ bool ProfileManager::LoadDeviceFromListWithOptions { RGBController *temp_controller = temp_controllers[temp_index]; + /*---------------------------------------------------------*\ + | Do not compare location string for HID devices, as the | + | location string may change between runs as devices are | + | connected and disconnected | + \*---------------------------------------------------------*/ + bool compare_location = true; + + if(load_controller->location.find("HID: ") == 0) + { + compare_location = false; + } + /*---------------------------------------------------------*\ | Test if saved controller data matches this controller | \*---------------------------------------------------------*/ - if((temp_controller_used[temp_index] == false ) - &&(temp_controller->type == load_controller->type ) - &&(temp_controller->name == load_controller->name ) - &&(temp_controller->description == load_controller->description) - &&(temp_controller->version == load_controller->version ) - &&(temp_controller->serial == load_controller->serial ) - &&(temp_controller->location == load_controller->location )) + if((temp_controller_used[temp_index] == false ) + &&(temp_controller->type == load_controller->type ) + &&(temp_controller->name == load_controller->name ) + &&(temp_controller->description == load_controller->description ) + &&(temp_controller->version == load_controller->version ) + &&(temp_controller->serial == load_controller->serial ) + &&((temp_controller->location == load_controller->location ) || (!compare_location))) { /*---------------------------------------------------------*\ | Update zone sizes if requested |