forked from Equim-chan/HIDInterface
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathProgram.cs
More file actions
34 lines (29 loc) · 945 Bytes
/
Program.cs
File metadata and controls
34 lines (29 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using USBInterface;
namespace TestUSBInterface
{
class Program
{
public static void Handle(object s, ReportEventArgs a)
{
Console.WriteLine(string.Join(", ", a.Data));
}
public static void Enter(object s, DeviceScanner.DeviceArrivedArgs deviceArrivedArgs)
{
Console.WriteLine($"Device arrived - {deviceArrivedArgs.Path}");
}
public static void Exit(object s, DeviceScanner.DeviceRemovedArgs deviceRemovedArgs)
{
Console.WriteLine($"Device removed - {deviceRemovedArgs.Path}");
}
static void Main(string[] args)
{
var scanner = new DeviceScanner(0x20A0, 0x4241);
scanner.DeviceArrived += Enter;
scanner.DeviceRemoved += Exit;
scanner.StartAsyncScan();
Console.WriteLine("Scanning");
Console.ReadKey();
}
}
}