安装usb转网络软件usbipd
在powershell执行下面命令安装文章来源地址https://www.toymoban.com/news/detail-848797.html
winget install --interactive --exact dorssel.usbipd-win
共享usb到网络
#查看USB设备
usbipd list
PS C:\Windows\system32> usbipd list
Connected:
BUSID VID:PID DEVICE STATE
1-6 04f3:289b USB 输入设备 Not shared
1-8 5986:2130 Integrated Camera Not shared
1-9 06cb:00bd Synaptics UWP WBDI Not shared
1-10 8087:0aaa 英特尔(R) 无线 Bluetooth(R) Not shared
3-4 0b95:1790 ASIX USB to Gigabit Ethernet Family Adapter Not shared
4-1 1a86:7523 USB-SERIAL CH340 (COM3) Shared
4-3 0403:6015 USB Serial Converter Not shared
Persisted:
GUID DEVICE
#共享usb设备
usbipd bind --busid <busid>
usbipd bind --busid 4-1
wsl2安装usbip
sudo pacman -S linux-tools
sudo pacman -S pciutils usbutils
sudo pacman -S usbip
挂载USB设备
sudo usbip attach -r <windows_ip> -b <busid>
sudo usbip attach -r 172.29.0.1 -b 4-1
#挂载成功
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 1a86:7523 QinHeng Electronics CH340 serial converter
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
ls /dev/ttyUSB*
/dev/ttyUSB0
#使用minicom验证
sudo minicom -D /dev/ttyUSB0 -b 115200 -H -w
卸载USB设备
sudo usbip port
Imported USB devices
====================
Port 00: <Port in Use> at Full Speed(12Mbps)
QinHeng Electronics : CH340 serial converter (1a86:7523)
1-1 -> usbip://172.29.0.1:3240/4-1
-> remote bus/dev 004/001
sudo usbip detach -p <port number>
sudo usbip detach -p 0
usbip: info: Port 0 is now detached!
文章来源:https://www.toymoban.com/news/detail-848797.html
到了这里,关于wsl2 arch linux访问ch340串口和usb设备的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!