Connect USB device to WSL

I decided to check out ESPHome. This is a very interesting project and I think I will write something about it here in the future too. For now, however, I thought I’d write a first quick post on how to connect a USB device to WSL. In fact, my workstation is a Windows 11 machine and for certain tasks I prefer to use Linux, WSL is perfect for me. However, the connection of USB devices is not automatic and therefore I describe the necessary steps here.

The device I will use as an example in this article is an ESP8266 board.

After connecting the board using a USB cable I find the new device in Device Manager

However, within WLS the device is not present.

To be able to connect the device to WSL it is necessary to follow some steps described in this article and install software. The link to the software to install is always present in this article:

https://learn.microsoft.com/en-us/windows/wsl/connect-usb

Once the software is installed you can use the “usbipd” command to connect the USB device to WSL. The command will need to be used within a PowerShell terminal started as administrator.

First of all, using “usbipd list” we are going to identify the device we want to connect to WSL.

In this case the device is identified by busid 2-4. Using the “usbipd” command with the “bind” option we are going to share the device.

At this point we can connect the device to WSL using the “attach” option.

The device is now connected to WSL đŸ™‚

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.