mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-23 23:21:49 +01:00
Tweaks to improve hotplug detection
Check status of first output report before adding device to the list
This commit is contained in:
parent
981e7afc22
commit
a1d0836091
@ -235,7 +235,7 @@ namespace DS4Windows
|
||||
public static string appDataPpath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Windows";
|
||||
public static string oldappdatapath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool";
|
||||
public static bool runHotPlug = false;
|
||||
public const int XINPUT_UNPLUG_SETTLE_TIME = 500; // Inhibit races that occur with the asynchronous teardown of ScpVBus -> X360 driver instance.
|
||||
public const int XINPUT_UNPLUG_SETTLE_TIME = 250; // Inhibit races that occur with the asynchronous teardown of ScpVBus -> X360 driver instance.
|
||||
public static string[] tempprofilename = new string[5] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static bool[] tempprofileDistance = new bool[5] { false, false, false, false, false };
|
||||
public static bool[] useDInputOnly = new bool[5] { true, true, true, true, true };
|
||||
|
@ -156,6 +156,7 @@ namespace DS4Windows
|
||||
}
|
||||
|
||||
private bool exitOutputThread = false;
|
||||
public bool ExitOutputThread => exitOutputThread;
|
||||
private bool exitInputThread = false;
|
||||
private object exitLocker = new object();
|
||||
|
||||
@ -449,6 +450,13 @@ namespace DS4Windows
|
||||
sixAxis = new DS4SixAxis();
|
||||
Crc32Algorithm.InitializeTable(DefaultPolynomial);
|
||||
refreshCalibration();
|
||||
|
||||
if (!hDevice.IsFileStreamOpen())
|
||||
{
|
||||
hDevice.OpenFileStream(inputReport.Length);
|
||||
}
|
||||
|
||||
sendOutputReport(true); // initialize the output report
|
||||
}
|
||||
|
||||
private void timeoutTestThread()
|
||||
@ -513,14 +521,6 @@ namespace DS4Windows
|
||||
{
|
||||
if (ds4Input == null)
|
||||
{
|
||||
if (!hDevice.IsFileStreamOpen())
|
||||
{
|
||||
hDevice.OpenFileStream(inputReport.Length);
|
||||
}
|
||||
|
||||
//Console.WriteLine(MacAddress.ToString() + " " + System.DateTime.UtcNow.ToString("o") + "> start");
|
||||
sendOutputReport(true); // initialize the output report
|
||||
|
||||
ds4Output = new Thread(performDs4Output);
|
||||
ds4Output.Priority = ThreadPriority.AboveNormal;
|
||||
ds4Output.Name = "DS4 Output thread: " + Mac;
|
||||
@ -1195,6 +1195,7 @@ namespace DS4Windows
|
||||
if (quitOutputThread)
|
||||
{
|
||||
StopOutputUpdate();
|
||||
exitOutputThread = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,9 +143,12 @@ namespace DS4Windows
|
||||
{
|
||||
DS4Device ds4Device = new DS4Device(hDevice);
|
||||
//ds4Device.Removal += On_Removal;
|
||||
Devices.Add(hDevice.DevicePath, ds4Device);
|
||||
DevicePaths.Add(hDevice.DevicePath);
|
||||
deviceSerials.Add(serial);
|
||||
if (!ds4Device.ExitOutputThread)
|
||||
{
|
||||
Devices.Add(hDevice.DevicePath, ds4Device);
|
||||
DevicePaths.Add(hDevice.DevicePath);
|
||||
deviceSerials.Add(serial);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user