2 Commits
Author SHA1 Message Date
krjan02 ac41113853 Fixed Exception when requesting exit 2025-01-13 22:34:43 +01:00
krjan02 5db254e0f1 Update SoraV2Interface to support wired connection 2025-01-13 22:26:56 +01:00
2 changed files with 21 additions and 8 deletions
+9 -2
View File
@@ -75,13 +75,20 @@ namespace SoraV2Utils_Agent
} }
public void Exit() public void Exit()
{
// Stop the Service
try
{ {
var client = new Client("SoraV2UtilsDeviceData"); var client = new Client("SoraV2UtilsDeviceData");
var service = client.GetServiceProxy<IMouseData>(); var service = client.GetServiceProxy<IMouseData>();
service.Exit(); service.Exit();
}
catch (TimeoutException)
{
}
// Exit the application gracefully // Exit the application
Environment.Exit(0); System.Environment.Exit(1);
} }
} }
} }
+8 -2
View File
@@ -11,11 +11,13 @@ namespace SoraV2Tools
{ {
private const ushort VID = 0x1915; private const ushort VID = 0x1915;
private const ushort PID_WIRELESS = 0xAE1C; private const ushort PID_WIRELESS = 0xAE1C;
private const ushort PID_WIRED = 0xAE11; private const ushort PID_WIRED = 0xAE12;
public static List<HidDevice> GetDevice() 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; return devices;
} }
@@ -72,8 +74,12 @@ namespace SoraV2Tools
byte fullCharge = responseData[11]; byte fullCharge = responseData[11];
byte online = responseData[12]; byte online = responseData[12];
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(battery, charging, fullCharge, online);
} }
}
return new DeviceStatus(); return new DeviceStatus();
} }
catch (Exception ex) catch (Exception ex)