Add host-app skeleton: HID device listing with HidSharp

This commit is contained in:
2026-08-24 21:00:27 +02:00
parent 4220b18da0
commit 3cb45d7809
4 changed files with 97 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/host-app/MacroPad.Host/bin/Debug/net10.0/MacroPad.Host.dll",
"args": [],
"cwd": "${workspaceFolder}/host-app/MacroPad.Host",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
+41
View File
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/host-app/MacroPad.Host/MacroPad.Host.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/host-app/MacroPad.Host/MacroPad.Host.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/host-app/MacroPad.Host/MacroPad.Host.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HidSharp" Version="2.6.4" />
</ItemGroup>
</Project>
+16
View File
@@ -0,0 +1,16 @@
using HidSharp;
var devices = DeviceList.Local.GetHidDevices();
Console.WriteLine("Périphériques HID détectés :\n");
foreach (var device in devices)
{
Console.WriteLine($"{device.GetFriendlyName()}");
Console.WriteLine($" VID: 0x{device.VendorID:X4} PID: 0x{device.ProductID:X4}");
Console.WriteLine($" Path: {device.DevicePath}");
Console.WriteLine();
}
Console.WriteLine("Appuie sur une touche pour quitter...");
Console.ReadKey();