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 5k
bottom part of serial port support on Unix #29033
Merged
Merged
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bea5e41
bottom part of serial port support
cbb5838
small cleanup
03c57c1
Merge branch 'master' of https://github.com/dotnet/corefx into serial2
5ec3a0f
Merge branch 'master' of https://github.com/dotnet/corefx into serial2
04e0b1f
Merge branch 'master' of https://github.com/dotnet/corefx into serial2
8abfee1
feedback from reviews
d8565ec
remove previous changes to System.Native
176d786
feedback from review
f3fa5b9
use consistently int32_t
36b4a41
update names and types based on feedback
c04b26e
feedback from kasper3
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
55 changes: 55 additions & 0 deletions
55
src/Common/src/Interop/Unix/System.Native/Interop.Terminal.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,55 @@ | ||
// 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.IO.Ports; | ||
using System.Runtime.InteropServices; | ||
using Microsoft.Win32.SafeHandles; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class Sys | ||
{ | ||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosReset", SetLastError = true)] | ||
internal static extern int TerminalReset(SafeFileHandle fd, int speed, int data, StopBits stop, Parity parity, Handshake flow); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosGetDcd", SetLastError = true)] | ||
internal static extern int TerminalGetCd(SafeFileHandle fd); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are missing "D" in the function name - the function should end "GetDcd" instead of "GetCd". |
||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosGetCts", SetLastError = true)] | ||
internal static extern int TerminalGetCts(SafeFileHandle fd); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosGetRts", SetLastError = true)] | ||
internal static extern int TerminalGetRts(SafeFileHandle fd); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosGetDsr", SetLastError = true)] | ||
internal static extern int TerminalGetDsr(SafeFileHandle fd); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosGetDtr", SetLastError = true)] | ||
internal static extern int TerminalGetDtr(SafeFileHandle fd); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosSetDtr", SetLastError = true)] | ||
internal static extern int TerminalSetDtr(SafeFileHandle fd, int value); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosSetRts", SetLastError = true)] | ||
internal static extern int TerminalSetRts(SafeFileHandle fd, int value); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosSetSpeed", SetLastError = true)] | ||
internal static extern int TerminalSetSpeed(SafeFileHandle fd, int speed); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosGetSpeed", SetLastError = true)] | ||
internal static extern int TerminalGetSpeed(SafeFileHandle fd); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosAvailableBytes", SetLastError = true)] | ||
internal static extern int TerminalGetAvailableBytes(SafeFileHandle fd, int input); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosDiscard", SetLastError = true)] | ||
internal static extern int TerminalDiscard(SafeFileHandle fd, int input); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosDrain", SetLastError = true)] | ||
internal static extern int TerminalDrain(SafeFileHandle fd); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_TermiosSendBreak", SetLastError = true)] | ||
internal static extern int TerminalSendBreak(SafeFileHandle fd, int duration); | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These methods should have the same name as the native counterpart, minus the "SystemNative_" prefix, so e.g. TermiosReset instead of TerminalReset.