USBIPD is part of the USB/IP protocol, which is an open-source project that's part of the Linux kernel
A software utility that helps users configure and make their USB devices accessible and visible to their Linux virtual machines or Windows-Linux cross-platform solutions that are natively installed on Windows OS.
How to install
Download the latest release here
How to Attach a USB device
Before attaching your USB device, ensure that a WSL command line is open. This will keep the WSL 2 lightweight VM active.
List all of the USB devices connected to Windows by opening PowerShell in administrator mode and entering the following command. Once the devices are listed, select and copy the bus ID of the device you’d like to attach to WSL.
usbipd list
Connected:
BUSID VID:PID DEVICE STATE
3-4 413c:2005 USB Input Device Not shared
4-1 1a2c:0042 USB Input Device Not shared
4-2 33fa:0001 BARROT Bluetooth Adapter Not shared
5-1 1a86:55d3 USB Serial Device (COM10) Not shared
Before attaching the USB device, the command usbipd bind
must be used to share the device, allowing it to be attached to WSL. This requires administrator privileges. Select the bus ID of the device you would like to use in WSL and run the following command. After running the command, verify that the device is shared using the command usbipd list
again.
usbipd bind --busid 5-1
Connected:
BUSID VID:PID DEVICE STATE
3-4 413c:2005 USB Input Device Not shared
4-1 1a2c:0042 USB Input Device Not shared
4-2 33fa:0001 BARROT Bluetooth Adapter Not shared
5-1 1a86:55d3 USB Serial Device (COM10) Shared
To unbind
Usage:
usbipd unbind [options]
Options:
-a, --all Stop sharing all devices
-b, --busid <BUSID> Stop sharing device having <BUSID>
-g, --guid <GUID> Stop sharing persisted device having <GUID>
-i, --hardware-id <VID:PID> Stop sharing all devices having <VID>:<PID>
-?, -h, --help Show help and usage information
usbipd unbind --busid 5-1
To attach the USB device, run the following command. (You no longer need to use an elevated administrator prompt.) Ensure that a WSL command prompt is open in order to keep the WSL 2 lightweight VM active. Note that as long as the USB device is attached to WSL, it cannot be used by Windows. Once attached to WSL, the USB device can be used by any distribution running as WSL 2. Verify that the device is attached using usbipd list
. From the WSL prompt, run lsusb
to verify that the USB device is listed and can be interacted with using Linux tools.
usbipd attach --wsl --busid 5-1
If you get the error 'can't open device "/dev/ttyACM0": Permission denied' this can be solved by changing permissions
with sudo chmod 666 /dev/ttyACM0 or adding yourself to the dialout group with sudo usermod -a -G dialout username