This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial support for serial port on FreeBSD (#42519)
* initial support for serial port on FreeBSD * adjust port name selection * update packaging * feedback from review * fix PortHelper * update include with AnyOS
- Loading branch information
Showing
7 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/System.IO.Ports/src/System/IO/Ports/SerialPort.FreeBSD.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.ComponentModel; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
|
||
namespace System.IO.Ports | ||
{ | ||
public partial class SerialPort : Component | ||
{ | ||
public static string[] GetPortNames() | ||
{ | ||
List<string> ports = new List<string>(); | ||
|
||
foreach (string name in Directory.GetFiles("/dev", "ttyd*")) | ||
{ | ||
if (!name.EndsWith(".init") && !name.EndsWith(".lock")) | ||
{ | ||
ports.Add(name); | ||
} | ||
} | ||
|
||
foreach (string name in Directory.GetFiles("/dev", "cuau*")) | ||
{ | ||
if (!name.EndsWith(".init") && !name.EndsWith(".lock")) | ||
{ | ||
ports.Add(name); | ||
} | ||
} | ||
|
||
return ports.ToArray(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters