Skip to content

Commit

Permalink
enhancement: Added warning to sample app.
Browse files Browse the repository at this point in the history
* 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))).
  • Loading branch information
thargy committed May 24, 2022
1 parent 07ec4b9 commit c2c8f20
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
4 changes: 2 additions & 2 deletions HIDDevices.Sample/HIDDevices.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions HIDDevices.Sample/Samples/GameLoopSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ protected override void Execute()
return;
}
if (g.Name.ToLowerInvariant().Contains("xbox "))
{
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.");
return;
}
// Assign this gamepad and connect to it.
gamepad = g;
g.Connect();
Expand Down
8 changes: 4 additions & 4 deletions HIDDevices.Test/HIDDevices.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.2.0" />
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HIDDevices\HIDDevices.csproj" />
Expand Down
10 changes: 5 additions & 5 deletions HIDDevices/HIDDevices.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
<None Remove="Usages\hid-usage-tables\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DynamicData" Version="7.3.1" />
<PackageReference Include="DynamicData" Version="7.8.5" />
<PackageReference Include="HidSharp" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.0.63" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.240">
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.2.32" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.5.107">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion HIDDevices/Usages/hid-usage-tables
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Console.WriteLine($"Usage: {usage.Name}; Page: {usage.Page.Name}");
The following controllers have been tested:
* Saitek X-52 Pro Flight Control System,
* Razer Sabertooth Elite
* 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._)
* 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._)

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

0 comments on commit c2c8f20

Please sign in to comment.