Nacon Revolution Pro support

This commit is contained in:
Yuki-nyan 2017-05-12 00:57:02 +01:00
parent 81b58fd90a
commit e3f1d9dc1d
2 changed files with 12 additions and 3 deletions

View File

@ -32,8 +32,9 @@ namespace DS4Windows
{
lock (Devices)
{
int[] pid = { 0xBA0, 0x5C4, 0x09CC };
IEnumerable<HidDevice> hDevices = HidDevices.Enumerate(0x054C, pid);
int[] vid = { 0x054C, 0x146B };
int[] pid = { 0xBA0, 0x5C4, 0x09CC, 0x0D01 };
IEnumerable<HidDevice> hDevices = HidDevices.Enumerate(vid, pid);
// Sort Bluetooth first in case USB is also connected on the same controller.
hDevices = hDevices.OrderBy<HidDevice, ConnectionType>((HidDevice d) => { return DS4Device.HidConnectionType(d); });
@ -46,7 +47,9 @@ namespace DS4Windows
//foreach (HidDevice hDevice in hDevices)
{
HidDevice hDevice = tempList[i];
if (DevicePaths.Contains(hDevice.DevicePath))
if (hDevice.Description == "HID-compliant vendor-defined device")
continue; // ignore the Nacon Revolution Pro programming interface
else if (DevicePaths.Contains(hDevice.DevicePath))
continue; // BT/USB endpoint already open once
if (!hDevice.IsOpen)

View File

@ -36,6 +36,12 @@ namespace DS4Windows
productIds.Contains(x.Attributes.ProductId));
}
public static IEnumerable<HidDevice> Enumerate(int[] vendorIds, params int[] productIds)
{
return EnumerateDevices().Select(x => new HidDevice(x.Path, x.Description)).Where(x => vendorIds.Contains(x.Attributes.VendorId) &&
productIds.Contains(x.Attributes.ProductId));
}
public static IEnumerable<HidDevice> Enumerate(int vendorId)
{
return EnumerateDevices().Select(x => new HidDevice(x.Path, x.Description)).Where(x => x.Attributes.VendorId == vendorId);