Friendly reminder
WSL (Windows Subsystem for Linux) is recommended for development — it is lighter and starts faster than a virtual machine.
Operation Steps
Search for PowerShell in the Windows Start menu, right-click it and choose Run as administrator, then run the command below to install the Linux subsystem (it downloads from the internet, so be patient):
wsl --installRestart your computer as prompted (save your work first). The first time you open WSL after rebooting, component initialization finishes automatically.
After WSL is ready, install the Ubuntu distribution and finish the basic setup — see Ubuntu installation tutorial — WSL section
Windows 11 WSL2 does not support automatic serial port mapping, so serial devices must be mapped into WSL2 manually. First download and install USBIPD-WIN: download usbipd-win_5.2.0_x64.msi. Double-click the installer, follow the prompts, then restart your computer.
Open PowerShell as administrator and run the command below to list all USB devices attached to Windows; select and copy the bus ID of the device you want to attach to WSL (e.g., 4-4):
Keep a WSL command line open before attaching a device so the WSL2 lightweight VM does not go to sleep.
usbipd listRun usbipd bind to share the device so it can be attached to WSL (requires administrator rights). Replace 4-4 with the bus ID you copied, then run usbipd list again to confirm the device is shared:
usbipd bind --busid 4-4Run the command below to attach the device to WSL:
- While attached, Windows cannot use the device — this is expected
- Once attached, every distribution in WSL2 can access the device
usbipd attach --wsl --busid <busid>Open Ubuntu (or your preferred WSL command line) and list the serial devices — seeing the attached device means the mapping worked:
ls /dev/ttyACM*After using the device in WSL, you can unplug it physically, or detach it from PowerShell with the command below (replace <busid> with the actual bus ID):
usbipd detach --busid <busid>FAQ
usbipd is not recognized as a command
USBIPD-WIN was not installed successfully, or the computer was not restarted after installation; reinstall, restart, and open PowerShell as administrator again.
usbipd attach says the device is not shared
Share the device first with usbipd bind --busid <busid> and confirm it shows as shared in usbipd list, then attach.
ls /dev/ttyACM* shows nothing
Make sure a WSL command line is kept open. Serial devices are usually /dev/ttyACM0 or /dev/ttyUSB0; you can also run lsusb to check whether the USB device is attached.
Have questions?
For any other questions, visit the unified Q&A and discussion board: Ai-Thinker Discussions

