Skip to content

Instantly share code, notes, and snippets.

@bblodget
Last active February 16, 2026 13:50
Show Gist options
  • Select an option

  • Save bblodget/d6f13e73cebee1f4bd2e59d979e3375a to your computer and use it in GitHub Desktop.

Select an option

Save bblodget/d6f13e73cebee1f4bd2e59d979e3375a to your computer and use it in GitHub Desktop.
USB Device Access in WSL2 using usbipd-win

USB Device Access in WSL2 using usbipd-win

⚠️ DISCLAIMER

This guide is provided for educational purposes. The author is not responsible for any damage to your system, hardware, or USB devices that may result from following these instructions. USB device forwarding, driver modifications, and running commands as administrator carry inherent risks. Always ensure you understand the commands before executing them, have appropriate backups, and verify device compatibility. Use at your own risk.

Prerequisites

  • Windows 11
  • WSL2 (Ubuntu or other distro)
  • usbipd-win installed on Windows:
    winget install dorssel.usbipd-win

Overview

This guide shows how to connect USB devices such as STM32 boards or TinyFPGA to WSL2 using usbipd-win.

Important: All usbipd commands must be run in PowerShell as Administrator.


Steps to Attach a USB Device

Step 1: Plug in the device and list USB devices

Open PowerShell as Administrator and run:

usbipd list

Look for your target device by BUSID (e.g., 1-3).

Example:

1-3    0483:374b  ST-Link Debug, USB Mass Storage Device, STMicroelectronics  Not shared

Step 2: Bind the device

Still in PowerShell as Administrator:

usbipd bind --busid 1-3

Step 3: Attach the device to WSL

Still in PowerShell as Administrator:

usbipd attach --busid 1-3 --wsl

Verify Device Inside WSL2

Step 4: Check dmesg and find the new serial port

In your WSL2 terminal:

dmesg | grep tty

Example output:

ttyACM0: USB ACM device

Step 5: List the device

ls /dev/ttyACM0

or

ls /dev/ttyUSB0

Example: Connect with minicom

sudo apt install minicom   # if not installed
minicom -D /dev/ttyACM0 -b 115200

Detaching Devices When Done

When you're finished using the USB device, you can detach it from WSL2. In PowerShell as Administrator:

usbipd detach --busid 1-3

This will disconnect the device from WSL2 but keep it bound for future use. To completely unbind the device:

usbipd unbind --busid 1-3

You can also check which devices are currently attached:

usbipd list

Notes

  • This must be done each time the device is replugged or the system is restarted.
  • You can access other USB-based tools (e.g., TinyFPGA) the same way.
  • For FPGA development (e.g., TinyFPGA + icestorm):
    • Bind and attach the device as above
    • Then run: tinyprog --program firmware.bin

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment