I am trying to run lsusb commands on wsl2 with Ubuntu 20.04, no output is showing
While
lsusb -Vcommand gives output-lsusb (usbutils) 012lsusb -tcommand gives output-/sys/bus/usb/devices: No such file or directory
I am trying to run lsusb commands on wsl2 with Ubuntu 20.04, no output is showing
While
lsusb -V command gives output- lsusb (usbutils) 012lsusb -t command gives output- /sys/bus/usb/devices: No such file or directoryYou can now use usbipd to gain access to the usb device from within WSL, see the official documentation.
I'm still having issues, but is going in the right direction.
WSL2 is basically a fancy "stripped down" Ubuntu Hyper-V VM, so no no support possible for low-level actions like that
Currently it is not supported though the issue is being tracked on the WSL GitHub repository.
@estani provided an updated answer today which is correct, but the "complete" (I hope) answer is a combination of all three answers, plus some additional information. Even then, we don't yet have a complete solution for all use-cases.
At the moment, WSL2 still does not have any direct support for USB hardware connected to the host computer. It also does not provide any virtualized "pass-through" support like you will find in many other virtualization products.
As @estani pointed out, there is a bit of a workaround now that Microsoft has added USB/IP support to the WSL2 kernel. In reality, it was possible prior to that, but it required that you build your own kernel with that feature.
Once you have upgraded to a WSL2 kernel with USB/IP support, you also need to install usbipd-win on the Windows host itself. This is a third-party open-source project. It is not provided by Microsoft, but they clearly endorse it by including it as a recommendation in the official Microsoft docs.
usbipd-win provides tight integration with WSL, so that issuing one single command on the Windows host (in an Admin account) will bind a USB on both the Windows and WSL end. However, it's also possible to use it in a traditional client/server two-phased approach.
The one huge caveat is that the WSL2 kernel might still not have support for the actual device you are connecting. For instance, USB cameras would require additional drivers (typically the USB Video Class, or UVC). Even then, as @estani mentioned, there are unsolved issues. Refer to the following questions:
Most of my research into this is at the first question Stack Overflow, but if we get it solved once, it will hopefully fix the issues with OpenCV, Cheese, ffmpeg, etc.
When I try to run lsusb -t and lsusb -v in WSL2 on an Ubuntu 20.04 LTS instance, I am getting output:
user@PC:~$ lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=vhci_hcd/8p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=vhci_hcd/8p, 480M
|__ Port 1: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 1: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
user@PC:~$ lsusb -v
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.00
bDeviceClass 9 Hub
bDeviceSubClass 0
bDeviceProtocol 3
bMaxPacketSize0 9
idVendor 0x1d6b Linux Foundation
idProduct 0x0003 3.0 root hub
bcdDevice 5.15
iManufacturer 3
iProduct 2
iSerial 1
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
< output trimmed >
I am using a custom Linux Kernel that I built using the install.sh script at https://github.com/randomwons/WSL2-USB-Camera.git. It's a custom 5.15.167.4-microsoft-standard-WSL2 kernel.