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

melon NG 296 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.

Developer technologies | .NET | .NET Internet of things
Developer technologies | C#
0 comments No comments
{count} votes

Accepted answer
  1. Sander van de Velde | MVP 36,766 Reputation points MVP Volunteer Moderator
    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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.