Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Software/LogicAnalyzer/SharedDriver/DeviceDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ namespace SharedDriver
public static class DeviceDetector
{
/*

VID/PID: 1902/3020
Windows: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbser\Enum
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_1209&PID_3020&MI_00

Linux: /sys/bus/usb/devices/x-y
idProduct
idVendor

/sys/bus/usb/devices/x-y:1-0/tty

*/

const string vid = "1209";
const string pid = "3020";

public static DetectedDevice[] Detect()
{
{
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return DetectWindows();
Expand All @@ -52,11 +52,11 @@ private static string[] DetectMac()
private static DetectedDevice[] DetectLinux()
{
if(!Directory.Exists("/sys/bus/usb/devices"))
return new DetectedDevice[0];
return [];

List<DetectedDevice> devices = new List<DetectedDevice>();
List<DetectedDevice> devices = [];

var regDev = new Regex(@"^[0-9]+-[0-9]+$");
var regDev = new Regex(@"^[0-9]+-[0-9]+(\.[0-9]+)*$");

foreach (var dir in Directory.GetDirectories("/sys/bus/usb/devices"))
{
Expand Down