Skip to content

Commit c2c8f20

Browse files
committed
enhancement: Added warning to sample app.
* When a controller name contains "XBox", the sample application will issue a warning and not connect it, avoiding confusion. * Updated NuGet pacakges, this is particularly important as [DynamicData](https://github.com/reactivemarbles/DynamicData) has some bug fixes (notably [#383](reactivemarbles/DynamicData#383 (comment))).
1 parent 07ec4b9 commit c2c8f20

File tree

6 files changed

+19
-13
lines changed

6 files changed

+19
-13
lines changed

HIDDevices.Sample/HIDDevices.Sample.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
13-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
12+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
13+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

HIDDevices.Sample/Samples/GameLoopSample.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ protected override void Execute()
4040
return;
4141
}
4242

43+
if (g.Name.ToLowerInvariant().Contains("xbox "))
44+
{
45+
Logger.LogWarning($"{g.Name} found! Unfortunately, it appears XInput-compatible HID device driver only transmits events from the HID device whilst the current process has a focussed window, so console applications/background services cannot detect button presses. Please try a different controller.");
46+
return;
47+
}
48+
4349
// Assign this gamepad and connect to it.
4450
gamepad = g;
4551
g.Connect();

HIDDevices.Test/HIDDevices.Test.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
<IsPackable>false</IsPackable>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
7+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
88
<PackageReference Include="xunit" Version="2.4.1" />
9-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
9+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1010
<PrivateAssets>all</PrivateAssets>
1111
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1212
</PackageReference>
13-
<PackageReference Include="coverlet.collector" Version="3.1.0">
13+
<PackageReference Include="coverlet.collector" Version="3.1.2">
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
</PackageReference>
17-
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.2.0" />
17+
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.3.0" />
1818
</ItemGroup>
1919
<ItemGroup>
2020
<ProjectReference Include="..\HIDDevices\HIDDevices.csproj" />

HIDDevices/HIDDevices.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
<None Remove="Usages\hid-usage-tables\**" />
3636
</ItemGroup>
3737
<ItemGroup>
38-
<PackageReference Include="DynamicData" Version="7.3.1" />
38+
<PackageReference Include="DynamicData" Version="7.8.5" />
3939
<PackageReference Include="HidSharp" Version="2.1.0" />
40-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
41-
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.0.63" />
42-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02" PrivateAssets="All" />
43-
<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.240">
40+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" />
41+
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.2.32" />
42+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
43+
<PackageReference Include="Nerdbank.GitVersioning" Version="3.5.107">
4444
<PrivateAssets>all</PrivateAssets>
4545
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4646
</PackageReference>

HIDDevices/Usages/hid-usage-tables

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ Console.WriteLine($"Usage: {usage.Name}; Page: {usage.Page.Name}");
187187
The following controllers have been tested:
188188
* Saitek X-52 Pro Flight Control System,
189189
* Razer Sabertooth Elite
190-
* Microsoft XBox One for Windows Controller (_**Note** that it appears XInput-compatible HID device driver only transmits events from the HID device whilst the current process has a focussed window, so console applications/background services don't appear to work! This is not a bug in this library._)
190+
* Microsoft XBox One for Windows Controller (_**Note** that it appears XInput-compatible HID device driver only transmits events from the HID device whilst the current process has a focussed window, so console applications/background services don't appear to work! That is not usually an issue for games, which have a focussed window, but does affect the sample application. This is not a bug in this library._)
191191

192192
The following OS's have been tested:
193193
* Windows 10 Pro 2004 (19041.330)

0 commit comments

Comments
 (0)