Periphery.Serial
5.0.0
dotnet add package Periphery.Serial --version 5.0.0
NuGet\Install-Package Periphery.Serial -Version 5.0.0
<PackageReference Include="Periphery.Serial" Version="5.0.0" />
<PackageVersion Include="Periphery.Serial" Version="5.0.0" />
<PackageReference Include="Periphery.Serial" />
paket add Periphery.Serial --version 5.0.0
#r "nuget: Periphery.Serial, 5.0.0"
#:package Periphery.Serial@5.0.0
#addin nuget:?package=Periphery.Serial&version=5.0.0
#tool nuget:?package=Periphery.Serial&version=5.0.0
Periphery
A cross-platform .NET library for discovering hardware devices (USB, Bluetooth, network adapters, displays, and more) with a LINQ-friendly API. One API covers Windows, Linux, and macOS.
dotnet add package Periphery --prerelease
Every release so far is a prerelease. Before upgrading, read BREAKING-CHANGES.md.
Quick Look
// All active USB devices
var usb = await Devices.Enumerate()
.OfCategory(DeviceCategory.Usb)
.Active()
.ToListAsync();
// Compose a query with LINQ
var mice = await Devices.Enumerate()
.OfCategory(DeviceCategory.Hid)
.ByManufacturer("Logitech")
.OrderBy(d => d.Name)
.ToListAsync();
// Find one device by USB VID/PID
var board = await Devices.Enumerate()
.WithUsbId("1234", "5678")
.FirstOrDefaultAsync();
Watch for devices arriving and leaving:
await using var watcher = Devices.Watch().OfCategory(DeviceCategory.Usb);
watcher.Appeared += (_, e) => Console.WriteLine($"+ {e.Device.Name}");
watcher.Disappeared += (_, e) => Console.WriteLine($"- {e.Device.Name}");
await watcher.StartAsync();
Track one device by identity:
await using var watcher = Devices.Watch();
var mouse = watcher.AddTracker(
t => t.OfCategory(DeviceCategory.Usb).WithUsbId("046D", "C52B"),
name: "Mouse");
mouse.StateChanged += (_, _) => Console.WriteLine($"Mouse present: {mouse.IsPresent}");
await watcher.StartAsync();
Open a serial device by identity instead of by COM number. The proxy reopens the port when the device comes back, wherever the OS puts it:
var scanner = new DeviceProfile(
f => f.OfCategory(DeviceCategory.Ports)
.WithUsbId("0403", "6001")
.WithSerialNumber("A9012XYZ"),
name: "Scanner");
SerialPort? port = null; // from the System.IO.Ports package
await using var proxy = await DeviceProxy.OpenAsync(
scanner,
onActivated: (info, ct) =>
{
port = new SerialPort(info.PortName.ToString(), 115_200);
port.Open();
return Task.CompletedTask;
},
onDeactivated: _ =>
{
port?.Dispose();
return Task.CompletedTask;
});
More in examples/.
Device categories
USB, Bluetooth, Network, Display, Monitor, HID, Keyboard, Mouse, Audio, Storage, Ports (serial), Battery, and Camera.
Devices also carry capability tags, such as Printer, Sensor, or SmartCard, that cut across categories:
var printers = await Devices.Enumerate().WithTag(DeviceTags.Printer).ToListAsync();
Packages
The core package only discovers devices. Extension packages talk to them.
| Package | What it does |
|---|---|
Periphery |
Enumerate, watch, and track devices |
Periphery.Camera |
Frame capture, with Avalonia and OpenCvSharp integrations |
Periphery.Ble.InTheHand |
GATT access to a Bluetooth LE device, through 32feet (Windows, Linux) |
Periphery.Hid |
HID reports, such as battery levels |
Periphery.Monitor |
Monitor brightness, power, input, resolution, and orientation |
Periphery.Usb |
Raw USB I/O |
Periphery.Treehopper |
Treehopper I/O board SDK |
Periphery.Bootloader.* |
Firmware flashing: a bootloader contract, plus EFM8 and STM32 backend packages |
Periphery.Cli |
The periphery command-line tool |
Periphery.Camera, Periphery.Hid, Periphery.Monitor, and Periphery.Usb support Windows and Linux, not macOS.
Requirements
- .NET 10 or later. A best-effort
net8.0build also ships. - Linux:
libudev.so.1.Periphery.Usbalso needslibusb-1.01.0.23 or newer. - Windows and macOS: no native dependencies. On macOS, Bluetooth bonds are reported only to a process with Bluetooth permission (ADR-0093).
Design principles
- Discovery in the core, I/O in extensions.
- The same API on every platform.
- LINQ-native. Queries compose with
Where,Select,OrderBy, and the rest. - No third-party dependencies in the core or the I/O extensions. Integrations such as Avalonia and OpenCvSharp are separate, opt-in packages.
- Async-first. Every entry point returns
TaskorIAsyncEnumerable.
Contributing
Contributions are welcome. Start with CONTRIBUTING.md and ARCHITECTURE.md. Bugs and ideas go in GitHub issues. Report security issues through SECURITY.md.
License
PolyForm Small Business 1.0.0 - see LICENSE.md.
Source-available, not open source. Every right the licence grants - including making changes and redistributing - is granted only for a permitted purpose, and use for the benefit of a company is a permitted purpose only below the employee-count and revenue thresholds the licence sets.
LICENSE.md is the authoritative statement of the terms. This paragraph points at it and is not a summary of it.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- System.IO.Ports (>= 9.0.0)
-
net8.0
- System.IO.Pipelines (>= 9.0.0)
- System.IO.Ports (>= 9.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Periphery.Serial:
| Package | Downloads |
|---|---|
|
Periphery.Serial.Rjcp
ADR-0062: an IDuplexPipe over an already-open RJCP.IO.Ports.SerialPortStream — the third-party-backed alternative to Periphery.Serial, for the custom-baud-rate and cross-platform cases the BCL's System.IO.Ports cannot cover. RJCP.SerialPortStream is a third-party runtime dependency of this package only; consumers who cannot accept one should depend on Periphery.Serial instead. |
|
|
Periphery.Bootloader.Stm32.Serial
STM32 UART bootloader flasher (ST AN3155): a pure planner, an AN3155 shell over the CallAndResponse Stm32BootloaderClient, and an IFirmwareProgrammer / IBootloaderProvider adapter. Drives the system bootloader over a serial port - sync, extended erase, write, read-back verify, and Go - on a part already in system-bootloader mode. ADR-0061. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.0 | 0 | 10/2/2026 |
| 4.3.0 | 113 | 9/23/2026 |
| 4.2.0 | 124 | 9/16/2026 |
| 4.2.0-alpha.1 | 88 | 9/9/2026 |