From e89c8b6c3a8b210f7fe55642f7ceb99cb47c22fa Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Sat, 7 Sep 2019 08:29:25 -0500 Subject: [PATCH] Added identifier name to meta info Related to issue #816 --- DS4Windows/DS4Control/ControlService.cs | 7 ++++-- DS4Windows/DS4Library/DS4Device.cs | 5 ++++- DS4Windows/DS4Library/DS4Devices.cs | 30 ++++++++++++++----------- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/DS4Windows/DS4Control/ControlService.cs b/DS4Windows/DS4Control/ControlService.cs index 3466ae6..4eba2de 100644 --- a/DS4Windows/DS4Control/ControlService.cs +++ b/DS4Windows/DS4Control/ControlService.cs @@ -403,7 +403,8 @@ namespace DS4Windows DS4Device device = devEnum.Current; //DS4Device device = devices.ElementAt(i); if (showlog) - LogDebug(Properties.Resources.FoundController + device.getMacAddress() + " (" + device.getConnectionType() + ")"); + LogDebug(Properties.Resources.FoundController + " " + device.getMacAddress() + " (" + device.getConnectionType() + ") (" + + device.DisplayName + ")"); Task task = new Task(() => { Thread.Sleep(5); WarnExclusiveModeFailure(device); }); task.Start(); @@ -666,7 +667,9 @@ namespace DS4Windows { if (DS4Controllers[Index] == null) { - LogDebug(Properties.Resources.FoundController + device.getMacAddress() + " (" + device.getConnectionType() + ")"); + //LogDebug(Properties.Resources.FoundController + device.getMacAddress() + " (" + device.getConnectionType() + ")"); + LogDebug(Properties.Resources.FoundController + " " + device.getMacAddress() + " (" + device.getConnectionType() + ") (" + + device.DisplayName + ")"); Task task = new Task(() => { Thread.Sleep(5); WarnExclusiveModeFailure(device); }); task.Start(); DS4Controllers[Index] = device; diff --git a/DS4Windows/DS4Library/DS4Device.cs b/DS4Windows/DS4Library/DS4Device.cs index 24846c7..8c57542 100644 --- a/DS4Windows/DS4Library/DS4Device.cs +++ b/DS4Windows/DS4Library/DS4Device.cs @@ -399,14 +399,17 @@ namespace DS4Windows private bool timeoutEvent = false; private bool runCalib; private bool hasInputEvts = false; + private string displayName; + public string DisplayName => displayName; public bool ShouldRunCalib() { return runCalib; } - public DS4Device(HidDevice hidDevice) + public DS4Device(HidDevice hidDevice, string disName) { hDevice = hidDevice; + displayName = disName; conType = HidConnectionType(hDevice); Mac = hDevice.readSerial(); runCalib = true; diff --git a/DS4Windows/DS4Library/DS4Devices.cs b/DS4Windows/DS4Library/DS4Devices.cs index 90af578..f8c337f 100644 --- a/DS4Windows/DS4Library/DS4Devices.cs +++ b/DS4Windows/DS4Library/DS4Devices.cs @@ -11,10 +11,12 @@ namespace DS4Windows { public readonly int vid; public readonly int pid; - internal VidPidInfo(int vid, int pid) + public readonly string name; + internal VidPidInfo(int vid, int pid, string name = "Generic DS4") { this.vid = vid; this.pid = pid; + this.name = name; } } @@ -35,21 +37,21 @@ namespace DS4Windows private static VidPidInfo[] knownDevices = { - new VidPidInfo(SONY_VID, 0xBA0), - new VidPidInfo(SONY_VID, 0x5C4), - new VidPidInfo(SONY_VID, 0x09CC), + new VidPidInfo(SONY_VID, 0xBA0, "Sony WA"), + new VidPidInfo(SONY_VID, 0x5C4, "DS4 v.1"), + new VidPidInfo(SONY_VID, 0x09CC, "DS4 v.2"), new VidPidInfo(RAZER_VID, 0x1000), new VidPidInfo(NACON_VID, 0x0D01), new VidPidInfo(NACON_VID, 0x0D02), - new VidPidInfo(HORI_VID, 0x00EE), // Hori PS4 Mini Wired Gamepad + new VidPidInfo(HORI_VID, 0x00EE, "Hori PS4 Mini"), // Hori PS4 Mini Wired Gamepad new VidPidInfo(0x7545, 0x0104), - new VidPidInfo(0x2E95, 0x7725), // Scuf Vantage gamepad - new VidPidInfo(0x11C0, 0x4001), // PS4 Fun Controller - new VidPidInfo(RAZER_VID, 0x1007), // Razer Raiju Tournament Edition - new VidPidInfo(RAZER_VID, 0x1004), // Razer Raiju Ultimate Edition (wired) - new VidPidInfo(RAZER_VID, 0x1009), // Razer Raiju Ultimate Edition (BT). Doesn't work yet for some reason even when non-steam Razer driver lists the BT Razer Ultimate with this ID. - new VidPidInfo(SONY_VID, 0x05C5), // CronusMax (PS4 Output Mode) - new VidPidInfo(0x0C12, 0x57AB), // Warrior Joypad JS083 (wired). Custom lightbar color doesn't work, but everything else works OK (except touchpad and gyro because the gamepad doesnt have those). + new VidPidInfo(0x2E95, 0x7725, "Scuf Vantage"), // Scuf Vantage gamepad + new VidPidInfo(0x11C0, 0x4001, "PS4 Fun"), // PS4 Fun Controller + new VidPidInfo(RAZER_VID, 0x1007, "Razer Raiju TE"), // Razer Raiju Tournament Edition + new VidPidInfo(RAZER_VID, 0x1004, "Razer Raiju UE USB"), // Razer Raiju Ultimate Edition (wired) + new VidPidInfo(RAZER_VID, 0x1009, "Razer Raiju UE BT"), // Razer Raiju Ultimate Edition (BT). Doesn't work yet for some reason even when non-steam Razer driver lists the BT Razer Ultimate with this ID. + new VidPidInfo(SONY_VID, 0x05C5, "CronusMax (PS4 Mode)"), // CronusMax (PS4 Output Mode) + new VidPidInfo(0x0C12, 0x57AB, "Warrior Joypad JS083"), // Warrior Joypad JS083 (wired). Custom lightbar color doesn't work, but everything else works OK (except touchpad and gyro because the gamepad doesnt have those). }; private static string devicePathToInstanceId(string devicePath) @@ -101,6 +103,8 @@ namespace DS4Windows else if (DevicePaths.Contains(hDevice.DevicePath)) continue; // BT/USB endpoint already open once + VidPidInfo metainfo = knownDevices.Single(x => x.vid == hDevice.Attributes.VendorId && + x.pid == hDevice.Attributes.ProductId); if (!hDevice.IsOpen) { hDevice.OpenDevice(isExclusiveMode); @@ -164,7 +168,7 @@ namespace DS4Windows } else { - DS4Device ds4Device = new DS4Device(hDevice); + DS4Device ds4Device = new DS4Device(hDevice, metainfo.name); //ds4Device.Removal += On_Removal; if (!ds4Device.ExitOutputThread) {