Trouble locating my serial ports using bash on Windows 10 Trouble locating my serial ports using bash on Windows 10 linux linux

Trouble locating my serial ports using bash on Windows 10


Soon, Windows will officially support serial on the Windows Subsystem for Linux (WSL). The COM_n_ ports will be available at /dev/ttyS_n_

Mapping:

COM1 >> /dev/ttyS0COM2 >> /dev/ttyS1...COM192 >> /dev/ttyS191

A good functional description can be found here:

https://blogs.msdn.microsoft.com/wsl/2017/04/14/serial-support-on-the-windows-subsystem-for-linux/

NOTE: At time of writing this feature is only available on the insider builds.


I have the same problem. Apparently you still can`t use serial ports in Bash on Ubuntu on Windows (BoUoW). You can do basic read and write operations using socat. I used Cygwin to create a socat server that sees my serial ports. I had problems with DTR and RTS pins though.

With socat you can create virtual serial ports or forward a serial port over TCP. (And much more.)

In Cygwin serial ports are listed under /dev/ as ttyS*. For example COM3 is /dev/ttyS2 and COM4 is /dev/ttyS3.

Start the server in Cygwin with

socat -d -d -d TCP4-LISTEN:2022,reuseaddr,fork /dev/ttyS3

Start the client on BoUoW with

socat PTY,link=/tmp/vmodem0 TCP:localhost:2022

This will create a virtual serial port in BoUoW at /tmp/vmodem0 that is connected to COM4 on your machine.