mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-01-21 16:00:27 +01:00
Update hidapi.net to properly Dispose() device
This commit is contained in:
parent
d362eb41f5
commit
49f86225cb
Binary file not shown.
|
|
@ -1,18 +1,11 @@
|
|||
using CommonHelpers;
|
||||
using ExternalHelpers;
|
||||
using Microsoft.VisualBasic.Logging;
|
||||
using Microsoft.Win32;
|
||||
using hidapi;
|
||||
using PowerControl.External;
|
||||
using PowerControl.Helpers;
|
||||
using RTSSSharedMemoryNET;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.AxHost;
|
||||
|
||||
namespace PowerControl
|
||||
{
|
||||
|
|
@ -201,7 +194,7 @@ namespace PowerControl
|
|||
updateOSD();
|
||||
}
|
||||
|
||||
private void NeptuneDevice_OnInputReceived(object? sender, hidapi.HidDeviceInputReceivedEventArgs e)
|
||||
private Task NeptuneDevice_OnInputReceived(hidapi.HidDeviceInputReceivedEventArgs e)
|
||||
{
|
||||
var input = SDCInput.FromBuffer(e.Buffer);
|
||||
|
||||
|
|
@ -224,6 +217,8 @@ namespace PowerControl
|
|||
// Consume only some events to avoid under-running SWICD
|
||||
if (!neptuneDeviceState.buttons5.HasFlag(SDCButton5.BTN_QUICK_ACCESS))
|
||||
Thread.Sleep(50);
|
||||
|
||||
return new Task(() => { });
|
||||
}
|
||||
|
||||
private void dismissNeptuneInput()
|
||||
|
|
|
|||
|
|
@ -26,8 +26,15 @@ namespace SteamController.Devices
|
|||
stopwatch.Start();
|
||||
}
|
||||
|
||||
~SteamController()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
using (neptuneDevice) { }
|
||||
}
|
||||
|
||||
public bool Updated { get; private set; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue