diff --git a/DS4Windows/DS4Control/ControlService.cs b/DS4Windows/DS4Control/ControlService.cs index 93ae0bc..5c95150 100644 --- a/DS4Windows/DS4Control/ControlService.cs +++ b/DS4Windows/DS4Control/ControlService.cs @@ -253,6 +253,7 @@ namespace DS4Windows DS4LightBar.updateLightBar(DS4Controllers[i], i); tempDevice.IsRemoved = true; tempDevice.StopUpdate(); + DS4Devices.RemoveDevice(tempDevice); Thread.Sleep(50); } diff --git a/DS4Windows/DS4Library/DS4Devices.cs b/DS4Windows/DS4Library/DS4Devices.cs index e27c0aa..059d6bc 100644 --- a/DS4Windows/DS4Library/DS4Devices.cs +++ b/DS4Windows/DS4Library/DS4Devices.cs @@ -186,10 +186,15 @@ namespace DS4Windows // Called when devices is diconnected, timed out or has input reading failure public static void On_Removal(object sender, EventArgs e) + { + DS4Device device = (DS4Device)sender; + RemoveDevice(device); + } + + public static void RemoveDevice(DS4Device device) { lock (Devices) { - DS4Device device = (DS4Device)sender; if (device != null) { device.HidDevice.CloseDevice();