From 7ae8e0deb8d838c2373b45d84a7f43ad5d05166b Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Thu, 6 Apr 2017 20:24:16 -0700 Subject: [PATCH] Allow idle disconnect for sony dongle --- DS4Windows/DS4Library/DS4Device.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/DS4Windows/DS4Library/DS4Device.cs b/DS4Windows/DS4Library/DS4Device.cs index 3d22941..8454086 100644 --- a/DS4Windows/DS4Library/DS4Device.cs +++ b/DS4Windows/DS4Library/DS4Device.cs @@ -608,7 +608,7 @@ namespace DS4Windows } */ bool ds4Idle = cState.FrameCounter == pState.FrameCounter; - if (conType != ConnectionType.BT) + if (conType == ConnectionType.USB) { lastActive = utcNow; } @@ -635,8 +635,19 @@ namespace DS4Windows lastActive = utcNow; } - if (shouldDisconnect && DisconnectBT()) - return; // all done + if (shouldDisconnect) + { + if (conType == ConnectionType.BT) + { + if (DisconnectBT()) + return; // all done + } + else if (conType == ConnectionType.SONYWA) + { + if (DisconnectDongle()) + return; // all done + } + } } // XXX fix initialization ordering so the null checks all go away