From 3cb45d7809094a5f00c2a5aa893f9db219252dc2 Mon Sep 17 00:00:00 2001 From: ponsy Date: Mon, 24 Aug 2026 21:00:27 +0200 Subject: [PATCH] Add host-app skeleton: HID device listing with HidSharp --- .vscode/launch.json | 26 +++++++++++++ .vscode/tasks.json | 41 +++++++++++++++++++++ host-app/MacroPad.Host/MacroPad.Host.csproj | 14 +++++++ host-app/MacroPad.Host/Program.cs | 16 ++++++++ 4 files changed, 97 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json create mode 100644 host-app/MacroPad.Host/MacroPad.Host.csproj create mode 100644 host-app/MacroPad.Host/Program.cs diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..bec092a --- /dev/null +++ b/.vscode/launch.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..06c40cc --- /dev/null +++ b/.vscode/tasks.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/host-app/MacroPad.Host/MacroPad.Host.csproj b/host-app/MacroPad.Host/MacroPad.Host.csproj new file mode 100644 index 0000000..0993416 --- /dev/null +++ b/host-app/MacroPad.Host/MacroPad.Host.csproj @@ -0,0 +1,14 @@ + + + + Exe + net10.0 + enable + enable + + + + + + + diff --git a/host-app/MacroPad.Host/Program.cs b/host-app/MacroPad.Host/Program.cs new file mode 100644 index 0000000..d325530 --- /dev/null +++ b/host-app/MacroPad.Host/Program.cs @@ -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(); \ No newline at end of file