Update SoraV2Interface to support wired connection

This commit is contained in:
krjan02 2025-01-13 22:26:56 +01:00
parent 6ccb81b3cf
commit 5db254e0f1

View File

@ -11,11 +11,13 @@ namespace SoraV2Tools
{
private const ushort VID = 0x1915;
private const ushort PID_WIRELESS = 0xAE1C;
private const ushort PID_WIRED = 0xAE11;
private const ushort PID_WIRED = 0xAE12;
public static List<HidDevice> GetDevice()
{
var devices = HidDevices.Enumerate(VID, PID_WIRELESS).ToList();
List<HidDevice> devices = HidDevices.Enumerate(VID, PID_WIRELESS)
.Concat(HidDevices.Enumerate(VID, PID_WIRED))
.ToList();
return devices;
}
@ -72,7 +74,11 @@ namespace SoraV2Tools
byte fullCharge = responseData[11];
byte online = responseData[12];
return new DeviceStatus(battery, charging, fullCharge, online);
if ((device.Attributes.ProductId == PID_WIRELESS && online == 1) ||
(device.Attributes.ProductId == PID_WIRED && charging == 1))
{
return new DeviceStatus(battery, charging, fullCharge, online);
}
}
return new DeviceStatus();
}