Problem: WSL does not see USB serial ports on win10 (CH34x driver)
Solution based on: (https://devblogs.microsoft.com/commandline/connecting-usb-devices-to-wsl/ )
To get started with this functionality, first ensure you’re running Windows 10/11 and have installed all WSL updates. Running uname -a
from within WSL should report a kernel version of 5.10.60.1 or later. You’ll need to be running a WSL 2 distro.
Install the latest release of usbipd-win..
From within WSL, install the user space tools for USB/IP and a database of USB hardware identifiers. On Ubuntu 20.04 LTS, run these commands:
sudo apt install linux-tools-5.4.0-77-generic hwdata
sudo update-alternatives --install /usr/local/bin/usbip usbip /usr/lib/linux-tools/5.4.0-77-generic/usbip 20
Now a service is running on Windows to share USB devices, and the necessary tools are installed in WSL to attach to shared devices.
Attach device from MSDOS prompt with Admin privileges:
BUSID DEVICE STATE
1-7 Intel(R) Wireless Bluetooth(R) Not attached
1-8 Integrated Camera Not attached
1-9 Synaptics WBDI Not attached
1-15 Realtek USB 3.0 Card Reader Not attached
2-2 USB Audio Device, USB Input Device Not attached
2-4 USB-Enhanced-SERIAL-A CH342 (COM4), USB-Enhanced-SERIAL-B... Not attached
C:\Windows\system32>usbipd wsl attach --busid 2-2
[sudo] password for djb:
C:\Windows\system32>usbipd wsl attach --busid 2-4
[sudo] password for djb:
From WSL command prompt check USB devices became visible
djb@DESKTOP-PIBVJ34:/mnt/c/Windows/system32$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 1a86:55d2 QinHeng Electronics USB Dual_Serial
Bus 001 Device 002: ID 0d8c:0012 C-Media Electronics, Inc. USB Audio Device
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
djb@DESKTOP-PIBVJ34:/mnt/c/Windows/system32$
Serial devices are listed under /dev/
djb@DESKTOP-PIBVJ34:/mnt/c/Windows/system32$ ls -l /dev/ttyACM*
crw------- 1 root root 166, 0 Jan 18 13:33 /dev/ttyACM0
crw------- 1 root root 166, 1 Jan 18 13:32 /dev/ttyACM1
djb@DESKTOP-PIBVJ34:/mnt/c/Windows/system32$
Connect to device
sudo picocom --imap lfcrlf --baud 115200 /dev/ttyACM0
picocom --imap lfcrlf --baud 115200 /dev/tty.usbmodem529B0101931
(ctrl-A ctrl-X to disconnect and return to macos command prompt)
in case you dont have picocom it can be installed using brew install picocom