mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-25 08:01:49 +01:00
Explicitly close HID device when stopping service
Do not wait for runtime to close the HID device
This commit is contained in:
parent
2dd9cb78a1
commit
fece01e9e5
@ -253,6 +253,7 @@ namespace DS4Windows
|
|||||||
DS4LightBar.updateLightBar(DS4Controllers[i], i);
|
DS4LightBar.updateLightBar(DS4Controllers[i], i);
|
||||||
tempDevice.IsRemoved = true;
|
tempDevice.IsRemoved = true;
|
||||||
tempDevice.StopUpdate();
|
tempDevice.StopUpdate();
|
||||||
|
DS4Devices.RemoveDevice(tempDevice);
|
||||||
Thread.Sleep(50);
|
Thread.Sleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,10 +186,15 @@ namespace DS4Windows
|
|||||||
|
|
||||||
// Called when devices is diconnected, timed out or has input reading failure
|
// Called when devices is diconnected, timed out or has input reading failure
|
||||||
public static void On_Removal(object sender, EventArgs e)
|
public static void On_Removal(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DS4Device device = (DS4Device)sender;
|
||||||
|
RemoveDevice(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveDevice(DS4Device device)
|
||||||
{
|
{
|
||||||
lock (Devices)
|
lock (Devices)
|
||||||
{
|
{
|
||||||
DS4Device device = (DS4Device)sender;
|
|
||||||
if (device != null)
|
if (device != null)
|
||||||
{
|
{
|
||||||
device.HidDevice.CloseDevice();
|
device.HidDevice.CloseDevice();
|
||||||
|
Loading…
Reference in New Issue
Block a user