diff --git a/DS4Windows/DS4Library/DS4Devices.cs b/DS4Windows/DS4Library/DS4Devices.cs index 06a0b12..cc7b92b 100644 --- a/DS4Windows/DS4Library/DS4Devices.cs +++ b/DS4Windows/DS4Library/DS4Devices.cs @@ -309,6 +309,16 @@ namespace DS4Windows } */ + //System.Threading.Thread.Sleep(50); + sw.Restart(); + while (sw.ElapsedMilliseconds < 50) + { + // Use SpinWait to keep control of current thread. Using Sleep could potentially + // cause other events to get run out of order + System.Threading.Thread.SpinWait(100); + } + sw.Stop(); + propChangeParams.stateChange = NativeMethods.DICS_ENABLE; success = NativeMethods.SetupDiSetClassInstallParams(deviceInfoSet, ref deviceInfoData, ref propChangeParams, Marshal.SizeOf(propChangeParams)); if (!success)