0
votes

I am using Win10 and Linux Ubuntu on WSL 2.0.

For testing purposes of some programs, I would like to use the serial port of my PC in "loopback" with Linux running through WSL.

Basically I would like a process on Linux/WSL to be able to send/receive data from a Windows process or vice versa, through serial port, but without any hardware hack.

Of course I have already tried to set the Windows process serial as "COM1" (as indicated by the Windows resource manager) and the Linux port on WSL as "/dev/ttyS1", but apparently it doesn't work.

Is there any way to do this?

1
If WSL does have the necessary support, then you would need to use two ports, and not just one in somekind of "loopback". Having two processes reading and writing to a single port does not make much sense, so having two operating systems also own/control a single port is impractical. - sawdust

1 Answers

1
votes

WSL 2.0 does not support serial ports.

Exceptions for using WSL 1 rather than WSL 2


The following options are possible.


Also, if you want to communicate between serial ports even if WSL2 cannot recognize USB serial, this method is also available.
Connecting to serial port (com port) over network

And as you can see from the above explanation, if you want to communicate between the processes of each OS, you can simply use a TCP/IP socket instead of the above mechanism.