Attempt to reset KB+M controls after unplugging controller

Related to issue #438.
This commit is contained in:
Travis Nickles 2018-10-01 19:18:52 -05:00
parent 3aa558c85f
commit 3bbdbe3a0f

View File

@ -1020,6 +1020,13 @@ namespace DS4Windows
LogDebug("X360 Controller # " + xinputIndex + " unplugged"); LogDebug("X360 Controller # " + xinputIndex + " unplugged");
} }
// Use Task to reset device synth state and commit it
Task.Run(() =>
{
Mapping.deviceState[ind].SavePrevious(true);
Mapping.Commit(ind);
}).Wait();
string removed = Properties.Resources.ControllerWasRemoved.Replace("*Mac address*", (ind + 1).ToString()); string removed = Properties.Resources.ControllerWasRemoved.Replace("*Mac address*", (ind + 1).ToString());
if (device.getBattery() <= 20 && if (device.getBattery() <= 20 &&
device.getConnectionType() == ConnectionType.BT && !device.isCharging()) device.getConnectionType() == ConnectionType.BT && !device.isCharging())
@ -1163,14 +1170,6 @@ namespace DS4Windows
} }
} }
/*if (_udpServer != null)
{
DualShockPadMeta padDetail = new DualShockPadMeta();
GetPadDetailForIdx(ind, ref padDetail);
_udpServer.NewReportIncoming(ref padDetail, CurrentState[ind]);
}
*/
// Output any synthetic events. // Output any synthetic events.
Mapping.Commit(ind); Mapping.Commit(ind);