Fixed timeout disconnect

This commit is contained in:
Travis Nickles 2018-05-06 01:59:45 -05:00
parent 3137983b9c
commit 1c1a3f747c

View File

@ -456,7 +456,7 @@ namespace DS4Windows
hDevice.OpenFileStream(inputReport.Length); hDevice.OpenFileStream(inputReport.Length);
} }
sendOutputReport(true); // initialize the output report sendOutputReport(true, true); // initialize the output report
} }
private void timeoutTestThread() private void timeoutTestThread()
@ -466,7 +466,7 @@ namespace DS4Windows
if (timeoutEvent) if (timeoutEvent)
{ {
timeoutExecuted = true; timeoutExecuted = true;
this.sendOutputReport(true); // Kick Windows into noticing the disconnection. this.sendOutputReport(true, true); // Kick Windows into noticing the disconnection.
} }
else else
{ {
@ -791,7 +791,7 @@ namespace DS4Windows
//Log.LogToGui(Mac.ToString() + " disconnected due to read failure: " + winError, true); //Log.LogToGui(Mac.ToString() + " disconnected due to read failure: " + winError, true);
} }
sendOutputReport(true); // Kick Windows into noticing the disconnection. sendOutputReport(true, true); // Kick Windows into noticing the disconnection.
StopOutputUpdate(); StopOutputUpdate();
isDisconnecting = true; isDisconnecting = true;
uiContext.Send(new SendOrPostCallback(delegate (object state4) uiContext.Send(new SendOrPostCallback(delegate (object state4)
@ -994,7 +994,7 @@ namespace DS4Windows
{ {
synced = controllerSynced; synced = controllerSynced;
SyncChange?.Invoke(this, EventArgs.Empty); SyncChange?.Invoke(this, EventArgs.Empty);
sendOutputReport(true); sendOutputReport(true, true);
} }
} }
@ -1101,7 +1101,7 @@ namespace DS4Windows
hDevice.flush_Queue(); hDevice.flush_Queue();
} }
private unsafe void sendOutputReport(bool synchronous) private unsafe void sendOutputReport(bool synchronous, bool force = false)
{ {
setTestRumble(); setTestRumble();
setHapticState(); setHapticState();
@ -1111,7 +1111,7 @@ namespace DS4Windows
lock (outReportBuffer) lock (outReportBuffer)
{ {
bool output = outputPendCount > 0, change = false; bool output = outputPendCount > 0, change = force;
if (usingBT) if (usingBT)
{ {