wsl2 arch linux访问ch340串口和usb设备

wsl2 arch linux访问ch340串口和usb设备

安装usb转网络软件usbipd

在powershell执行下面命令安装

bash 复制代码
winget install --interactive --exact dorssel.usbipd-win

共享usb到网络

bash 复制代码
#查看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

bash 复制代码
sudo pacman -S linux-tools
sudo pacman -S pciutils usbutils
sudo pacman -S usbip

挂载USB设备

bash 复制代码
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设备

bash 复制代码
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!
相关推荐
修己xj16 小时前
nslookup 使用指南:两种模式与常用查询技巧
linux
唠玖馆18 小时前
文件系统详解
linux·文件系统·ext2
GeW18 小时前
当Linux内核开始“确定性”,制造高端化才有了底层语法
linux
星恒随风19 小时前
MySQL 从零入门(三):表的约束详解
linux·服务器·数据库·笔记·mysql
Alluxio20 小时前
Alluxio + OCI:为 AI 工作负载实现亚毫秒访问延迟与可扩展吞吐
运维·数据库·人工智能·分布式·缓存·ai·语言模型
StarsGreen21 小时前
libva在intel平台上的前端流程简介
linux
坤坤子吖1 天前
Linux网络编程:自定义应用层协议与 JSON 序列化
linux·服务器·网络·c++·笔记·json
Sayai1 天前
Neo4j 图数据质量检查实战:环路检测、孤立节点与连通分量,两条 Cypher 引出的数据体检清单(含变长路径性能陷阱)
运维·neo4j·图数据库·数据质量·cypher
青瓦梦滋1 天前
Redis主从复制
服务器·数据库·redis·缓存·bootstrap
Elastic 中国社区官方博客1 天前
更少的位数,相同的召回率:DiskBBQ 更保守的自动校准扫描
大数据·运维·开发语言·人工智能·elasticsearch·搜索引擎