A lightweight library for discovering and enumerating connected serial port devices.
Provides API for listing serial devices and retrieving metadata such as product/vendor names, IDs, and port names.
Install via NuGet:
dotnet add package NineDigit.SerialPortOr using the Visual Studio Package Manager Console:
Install-Package NineDigit.SerialPort| Platform | Supported | Notes |
|---|---|---|
| Windows | ✅ | Fully supported. |
| macOS | ✅ | Fully supported. |
| Linux | ❌ | Not yet supported. |
| Android | ❌ | Not yet supported. |
using NineDigit.SerialPort;
ISerialPortDeviceScanner deviceScanner = SerialPortDeviceScanner.Current;
IReadOnlyList<ISerialPortDevice> devices = deviceScanner.GetConnectedSerialPortDevices();
Console.WriteLine($"Detected {devices.Count} serial port device(s).");
for (int i = 0; i < devices.Count; i++)
{
ISerialPortDevice device = devices[i];
Console.WriteLine(
$"{i + 1}. Product: {device.ProductName} (id = {device.ProductId}), " +
$"Vendor: {device.VendorName} (id = {device.VendorId}), " +
$"Port: {device.SerialPortName}");
}Example output:
Detected 2 serial port device(s).
1. Product: CP2102N USB to UART Bridge Controller (id = 60000), Vendor: Silicon Labs (id = 4292), Port: COM4
2. Product: CHDU Lite VCP (id = 22336), Vendor: Microsoft (id = 1155), Port: COM8
This project is licensed under the MIT License.