0

I'd like to connect a serial device in WSL.

The device is named Silicon Labs CP210x USB to UART Bridge and connected via COM3 port.

In Windows it is able to access the device through serial monitor, but how can I access it from WSL?

I tried:

$ sudo chmod 666 /dev/ttyS3

$ sudo stty -F /dev/ttyS3 115200
stty: /dev/ttyS3: Input/output error

$ cu -l /dev/ttyS3 -s 115200
Connected.
cu: Got hangup signal

Disconnected.

I'm using WSL2 in Windows build 19028

3

The following is in FAQ for WSL2:

As of right now WSL 2 does not include serial support, or USB device support. We are investigating the best way to add these features.

UPDATE 09.11.2021: There seems to be a workaround which allows you to connect a USB device to WSL 2.

However, you can still use the WSL 1. See on the internet, how you can convert your WSL2 to WSL1. It is pretty simple: just write wsl --set-version YOUR_DISTR 1. For instance, wsl --set-version Ubuntu 1. This command will convert WSL for the Ubuntu distribution to the version 1. The next thing: Windows does not use the physical name of the device (as I understood it). That's why you have to create the physical name for the device in the Windows Register.

  1. Find out what the device's physical name is. In order to do that open Device Manager on Windows, go to Ports (COM & LTP), right mouse button on your CP210x device and left mouse button on Properties.
  2. In this properties, select Details and then Physical Device Object Name for Property. In the value's text box you will see, how your CP210x named. attachment_0
  3. Open Registry Editor, go to Computer\HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM and make a new string value there. The name is the physical device name from step 2. The port is the COM port from step 2. attachment_1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.