Skip to content
This repository was archived by the owner on Dec 3, 2024. It is now read-only.

Commit fa2828e

Browse files
committed
Fix HID
1 parent 8350f90 commit fa2828e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

XOutput/Devices/Input/DirectInput/DirectDevice.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System;
44
using System.Collections.Generic;
55
using System.Linq;
6+
using System.Text.RegularExpressions;
67
using System.Threading;
78
using System.Windows;
89
using System.Windows.Interop;
@@ -20,6 +21,8 @@ public sealed class DirectDevice : IInputDevice
2021
/// The delay in milliseconds to sleep between input reads.
2122
/// </summary>
2223
public const int ReadDelayMs = 1;
24+
25+
private static readonly Regex hidRegex = new Regex("(hid)#([^#]+)#([^#]+)");
2326
#endregion
2427

2528
#region Events
@@ -92,6 +95,11 @@ public string HardwareID
9295
if (deviceInstance.IsHumanInterfaceDevice)
9396
{
9497
string path = joystick.Properties.InterfacePath;
98+
var match = hidRegex.Match(path);
99+
if (match.Success)
100+
{
101+
return string.Join("\\", new string[] { match.Groups[1].Value, match.Groups[2].Value, match.Groups[3].Value }).ToUpper();
102+
}
95103
if (path.Contains("hid#"))
96104
{
97105
path = path.Substring(path.IndexOf("hid#"));

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ version: 3.26-{branch}-{build}
77
branches:
88
only:
99
- master
10+
- 3.x
1011

1112
skip_tags: true
1213

0 commit comments

Comments
 (0)