Use USB-Serial adapters via Windows Subsystem for Linux

Windows 10 Build 16176 (April 2017) brought support for

Using a USB-serial device from WSL requires that the device is recognized in Windows first. If Windows doesn't recognize the device, perhaps try the device on a native Linux PC.

Configuration

Configure USB-serial adapters in WSL by:

  1. Plug USB-serial adapter into the PC

  2. Look in Windows Device Manager under Ports to see the COM port number. See troubleshooting notes below if it doesn't show there. Assume it's COM 5 for this example. If the device doesn't show under USB Devices → Ports in Windows Device Manager, the following steps will not work!

  3. in WSL terminal, (assuming device is on COM5 for this example), type

    chmod 666 /dev/ttyS5
    

Usage

The serial device baud rate must be consistent between device and PC. If the baud rate is incorrect, either no text or garbled text will be seen. For example using 115200 baud:

stty -F /dev/ttyS5 115200

Connect to serial devices using PuTTY with WSL via X11 on WSL or using command line like

screen /dev/ttyS5 115200

Notes

  • COM port number can change upon plugging in the same device, especially if replugging into a different physical USB port on the PC.
  • If plugging in a different unit of the same type of device, it may likely also get a new COM port number (e.g. two Red Pitayas, even if sequentially plugged into the same USB port, may well get different COM port numbers).

Troubleshooting

If the device doesn't show up in Device Manager → Ports, see if it was mistakenly enabled as a Mouse or Human Interface Device. If so, unplug and replug your device.

If it still fails to show up as a Port, instead showing up as mouse or HID, try right-clicking and Disabling the device and unplug/plug it once more.

If it still fails, maybe the Windows device driver is missing. Try the device in a native Linux PC and see if the device works there.