From 32938ec2af0945c0024e2391a200cbe144f7c177 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Sun, 31 May 2020 16:20:35 -0500 Subject: [PATCH] Add sleep to OpenRazer driver to fix hangs updating certain devices --- RGBController/RGBController_OpenRazer.cpp | 9 +++++++++ RGBController/RGBController_OpenRazerWindows.cpp | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/RGBController/RGBController_OpenRazer.cpp b/RGBController/RGBController_OpenRazer.cpp index 74b2baa3..72ea9f12 100644 --- a/RGBController/RGBController_OpenRazer.cpp +++ b/RGBController/RGBController_OpenRazer.cpp @@ -12,6 +12,11 @@ #include #include +static void Sleep(unsigned int milliseconds) +{ + usleep(1000 * milliseconds); +} + void RGBController_OpenRazer::DeviceUpdateLEDs() { switch(matrix_type) @@ -73,6 +78,8 @@ void RGBController_OpenRazer::DeviceUpdateLEDs() } delete[] output_array; + + Sleep(1); } if(matrix_type == RAZER_TYPE_MATRIX_FRAME) @@ -542,6 +549,8 @@ void RGBController_OpenRazer::UpdateMode() matrix_effect_reactive.flush(); break; } + + Sleep(20); } break; diff --git a/RGBController/RGBController_OpenRazerWindows.cpp b/RGBController/RGBController_OpenRazerWindows.cpp index d4b455b1..d9d1a984 100644 --- a/RGBController/RGBController_OpenRazerWindows.cpp +++ b/RGBController/RGBController_OpenRazerWindows.cpp @@ -74,6 +74,8 @@ void RGBController_OpenRazer::DeviceUpdateLEDs() } delete[] output_array; + + Sleep(1); } if(matrix_type == RAZER_TYPE_MATRIX_FRAME) @@ -482,6 +484,8 @@ void RGBController_OpenRazer::UpdateMode() razer_functions->matrix_effect_reactive->store(razer_device, NULL, update_value, 1); break; } + + Sleep(20); } break;