WSL Using USB Device
WSL Using USB Device
Brief
About how to enable USB device under wsl.
Update WSL
Run Powershell
with administrator privilege, and input the following instructions:
List installed WSL distro:
wsl -l -v
The result may look like:
NAMESTATEVERSION
* Ubuntu-20.04Running2
docker-desktop-dataStopped2
UbuntuStopped2
The asterisk indicates the default WSL distro. If it is
docker-desktop-data
, it may not run, so change it to Ubuntu-20.04
or Ubuntu
:wsl --set-default Ubuntu-20.04
Then shutdown WSL, update WSL and then restart it.
wsl --shutdown
wsl --update
Install Linux-Tools Install linux tools:
sudo apt install linux-tools-5.8.0-63-generic hwdata
Add it to sudoers:
sudo vim /etc/sudoers
Modify the line of Defaults secure_path=... to include linux-tools:
Defaultssecure_path="/usr/lib/linux-tools/5.8.0-63-generic:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
Force to save the
/etc/soduers
file.Install usbipd The usbipd can be download from here.
Now run
Powershell
as administrator.Run the following command to list all USB devices:
usbipd wsl list
The result looks like:
BUSIDDEVICESTATE
1-10H100i v2Not attached
1-13Intel(R) Wireless Bluetooth(R)Not attached
10-2USB Input DeviceNot attached
10-4Logitech USB Input Device, USB Input DeviceNot attached
10-5USB Input DeviceNot attached
16-1USB Mass Storage DeviceNot attached
16-3USB Audio Device, USB Input Device, USB Mass Storage Devi...Not attached
17-3STMicroelectronics STLink Virtual COM Port, STMicroelectr...Not attached
18-1J-Link driverNot attached
18-2J-Link driverNot attached
18-3USB-SERIAL CH340Not attached
19-1Generic Bluetooth RadioNot attached
19-4150Mbps Wireless 802.11bgn Nano USB AdapterNot attached
To attach the second J-Link device to WSL:
usbipd wsl attach -b 18-2
To check if the USB device has been attached to WSL, in WSL, run:
lsusb
The result shows:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 1366:0101 SEGGER J-Link PLUS
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Reference The original reference.
【WSL Using USB Device】Good luck.
推荐阅读
- Android|Android USB通信
- 关于usb流量分析
- 黑苹果升级10.13.4以后,usb3.0不能使用
- USB转串口|USB转四串口芯片CH9344
- Win10|Win10 安装 Docker Desktop ( 基于WSL2,WSL vs Hyper-V)
- Windows|Windows 重装系统,配置 WSL,美化终端,部署 WebDAV 服务器,并备份系统分区
- windows进程共享内存技术
- USB在linux下挂载细谈
- 校门外的树 线段树版
- USB多点触控上报协议详解