How can I connect serail port in linux by .net core?

melon NG 291 Reputation points
2021-11-03T07:09:35.947+00:00

There are two serial ports in my device, I have to get data from the A port, convert and transfer it to the B port.

I want to develop it by .net core.

In the windows system there is a port name(For example COM1/COM2). I need the port name to connect to the serial port by system.io.port.

However, I don't know how to get the port name in Linux.

How can I get it? Thank you.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,099 questions
.NET Internet of things
.NET Internet of things
.NET: Microsoft Technologies based on the .NET software framework.Internet of things: A concept that aims to extend the benefits of the regular internet, including constant connectivity, remote control ability, and data sharing, to goods in the physical world.
27 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sander van de Velde 27,186 Reputation points MVP
    2021-11-03T09:51:04.76+00:00

    Hello @melon NG ,

    Comports in Linux are typically identified as eg "/dev/ttyS0".

    Perhaps you need to elevate access rights (Use this 777 for testing only) eg.:

    sudo chmod 777 /dev/ttyS0   
    

    Note: These elevated rights then need to survive a reboot. Put them in eg. /etc/rc.local (depending on the Linux flavor you use).


0 additional answers

Sort by: Most helpful