Fixed crash in logitech device provider, when multiple lightspeed devices with the same usage are connected

This commit is contained in:
DarthAffe committed 2024-10-20 11:06:40 +02:00
1 parent 5c864a03e5
commit f2491038a3
1 file changed
+3 -1
@@ -104,7 +104,9 @@ public sealed class LightspeedHIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefi
Dictionary<byte, HidDevice> deviceUsages = DeviceList.Local Dictionary<byte, HidDevice> deviceUsages = DeviceList.Local
.GetHidDevices(VendorId, pid) .GetHidDevices(VendorId, pid)
.Where(d => d.DevicePath.Contains("mi_02")) .Where(d => d.DevicePath.Contains("mi_02"))
.ToDictionary(x => (byte)x.GetUsage(), x => x); .Select(x => ((byte)x.GetUsage(), x))
.DistinctBy(x => x.Item1)
.ToDictionary(x => x.Item1, x => x.x);
foreach ((int wirelessPid, byte _) in GetWirelessDevices(deviceUsages)) foreach ((int wirelessPid, byte _) in GetWirelessDevices(deviceUsages))
yield return wirelessPid; yield return wirelessPid;