Re-add delay on device disable

This commit is contained in:
Travis Nickles 2018-03-05 15:53:40 -06:00
parent 8be2f9f271
commit 92c7b50d6d

View File

@ -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; propChangeParams.stateChange = NativeMethods.DICS_ENABLE;
success = NativeMethods.SetupDiSetClassInstallParams(deviceInfoSet, ref deviceInfoData, ref propChangeParams, Marshal.SizeOf(propChangeParams)); success = NativeMethods.SetupDiSetClassInstallParams(deviceInfoSet, ref deviceInfoData, ref propChangeParams, Marshal.SizeOf(propChangeParams));
if (!success) if (!success)