mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-22 17:29:18 +01:00
Test minor change of usb device removal
This commit is contained in:
parent
d35ba4db98
commit
4ce52da612
@ -221,6 +221,7 @@ namespace DS4Windows
|
||||
DS4LightBar.forcedFlash[i] = 0;
|
||||
DS4LightBar.defaultLight = true;
|
||||
DS4LightBar.updateLightBar(DS4Controllers[i], i, CurrentState[i], ExposedState[i], touchPad[i]);
|
||||
DS4Controllers[i].IsRemoved = true;
|
||||
System.Threading.Thread.Sleep(50);
|
||||
}
|
||||
|
||||
@ -229,6 +230,8 @@ namespace DS4Windows
|
||||
anyUnplugged = true;
|
||||
DS4Controllers[i] = null;
|
||||
touchPad[i] = null;
|
||||
lag[i] = false;
|
||||
inWarnMonitor[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,6 +161,7 @@ namespace DS4Windows
|
||||
}
|
||||
|
||||
private bool exitOutputThread = false;
|
||||
private bool exitInputThread = false;
|
||||
private object exitLocker = new object();
|
||||
public event EventHandler<EventArgs> Report = null;
|
||||
public event EventHandler<EventArgs> Removal = null;
|
||||
@ -421,7 +422,8 @@ namespace DS4Windows
|
||||
{
|
||||
try
|
||||
{
|
||||
ds4Input.Abort();
|
||||
exitInputThread = true;
|
||||
//ds4Input.Abort();
|
||||
ds4Input.Join();
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -540,7 +542,7 @@ namespace DS4Windows
|
||||
long oldtime = 0;
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
while (true)
|
||||
while (!exitInputThread)
|
||||
{
|
||||
string currerror = string.Empty;
|
||||
long curtime = sw.ElapsedMilliseconds;
|
||||
@ -1053,6 +1055,11 @@ namespace DS4Windows
|
||||
return Mac;
|
||||
}
|
||||
|
||||
public void runRemoval()
|
||||
{
|
||||
Removal?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public void removeReportHandlers()
|
||||
{
|
||||
this.Report = null;
|
||||
|
@ -146,6 +146,7 @@ namespace DS4Windows
|
||||
{
|
||||
DS4Device device = devices.ElementAt<DS4Device>(i);
|
||||
device.StopUpdate();
|
||||
//device.runRemoval();
|
||||
device.HidDevice.CloseDevice();
|
||||
}
|
||||
|
||||
@ -216,8 +217,6 @@ namespace DS4Windows
|
||||
throw new Exception("Error enabling device, error code = " + Marshal.GetLastWin32Error());
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(50);
|
||||
|
||||
NativeMethods.SetupDiDestroyDeviceInfoList(deviceInfoSet);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user