我试图在WSL2 Linux (Ubuntu20.04)中进行嵌入式系统开发,并得到以下错误:
usbipd: warning: USB filter 'USBPcap' is known to be incompatible with this software; 'bind --force' will be required. 在powershell中,当我看到错误“绑定--强制”时,运行usbipd wsl list是必需的(下面是完整的输出)。我不清楚为什么会发生这种情况&这是必需的,没有记录/没有出现在google搜索中的强制行为。示例:
PS C:\Users\Hidden> usbipd wsl list
BUSID DEVICE STATE
1-3 Logitech USB Input Device, USB Input Device Not attached
1-4 Printer XYZ Series, USB Printing Support, USB Mass Stor... Not attached
1-7 USB Input Device Not attached
1-8 USB Input Device Not attached
1-10 Intel(R) Wireless Bluetooth(R) Not attached
1-11 USB 2.0 Webcam Device Not attached
1-12 Realtek USB 2.0 Card Reader Not attached
usbipd: warning: USB filter 'USBPcap' is known to be incompatible with this software; 'bind --force' will be required.我正在使用Windows 11,内部稳定的发布通道,所有的补丁应用。WSL1速度慢,磁盘绑定不同,它没有WSLG (所以我不能运行Linux软件)
WSL2有一个主要的缺点--它目前不支持USB设备,除非您遵循本McMorran高级软件工程师C++ Team @ Microsoft的指示,他写了关于USBIPD的文章,它使用TCP/IP从Windows导出一个USB设备到这里的Linux机器:
https://devblogs.microsoft.com/commandline/connecting-usb-devices-to-wsl/
谷歌搜索几乎没有找到任何有用的提示/其他与武力相关的信息。
我想我应该在这里发布这个问题,开始讨论其他经历同样痛苦和挫折的人--强迫我的USB端口。
发布于 2022-05-21 20:32:39
基于语法的解决方案#1
步骤1.
重新启动所有终端和/或外壳。
步骤2.
usbipd的部队绑定命令如下:
$PS C:\WINDOWS\System32> usbipd bind --busid <the bus id> -f
您可以使用
usbipd devices -l命令获得usb列表。
Usbipd格式必须是1-int。我的具体命令如下:
PS C:\WINDOWS\system32> usbipd bind --busid 1-11 -f我和你有同样的问题。
我个人对wsl感到沮丧..。但是,我执行了上面的命令,它修复了USBCAP强制绑定软件不匹配标志。--busid或-b标志是位置敏感的,它必须在usbipd bind -b或--busid <busid>之后立即出现,然后跟着-f或--force。
版本派生解决方案#2
步骤1.
打开管理PowerShell:
[Windows key] + [x]
然后按[a]键
...Type以下命令:
wsl --set-version Ubuntu 2
[注意:可以使用命令wsl -l找到发行版名称]
如果您正在使用debian,请使用Debian,如果您正在使用社区arch发行版,则使用Arch作为您的发行版。
如果这不起作用,而且您最近安装了Pcap或usbcap,请考虑完全重新启动计算机,以应用管理程序绑定到网络接口所需的隐藏更改。
请欣赏我的Powershell历史
usbipd: warning: USB filter 'USBPcap' is known to be incompatible with this software; 'bind --force' will be required.
PS C:\WINDOWS\system32> usbipd bind --busid 1-11 -f
usbipd: warning: A reboot may be required before the changes take effect.
PS C:\WINDOWS\system32> usbipd bind --busid 1-11 -f
usbipd: info: Device with busid '1-11' was already shared.
PS C:\WINDOWS\system32> history
Id CommandLine
-- -----------
1 winget install --interactive --exact dorssel.usbipd-win
2 usbipd wsl list
3 usbipd wsl attach --busid 1-11
4 usbipd wsl attach --busid 1-11 bind --force
5 usbipd wsl attach --busid 1-11 bind -d Ubuntu
6 usbipd wsl attach --busid 1-11 -d Ubuntu
7 usbipd wsl attach --busid 11 -d Ubuntu
8 usbipd wsl attach --busid 1-11 -d Ubuntu
9 usbipd wsl attach --busid 1-11 -d Ubuntu --force
10 usbipd wsl attach --busid 1-11 -d Ubuntu -a
11 usbipd wsl attach --busid 1-11 -d Ubuntu -a
12 usbipd wsl attach --busid 1-11 -d Ubuntu
13 usbipd wsl list
14 usbipd bind --busid 1-11 -f
15 usbipd bind --busid 1-11 -f
PS C:\WINDOWS\system32>发布于 2022-02-26 03:25:59
不是一个解决方案:‘使用Windows’Arduino,ESP32 xtensa等开发经验在Linux下是无与伦比的,特别是在WSLG中,没有烦人的C:\dir与空格愚蠢,请不要建议我在Windows做我的开发!
不是一个解决方案:不,我不会卸载USBPCap,它是我的USB探针或示波器所必需的(顺便说一句,这需要Windows)
现在,要了解-强制设置的作用,下面是CLI:
PS C:\Users\MyHome> usbipd bind
Option '--busid' is required.
usbipd-win 2.1.0
Description:
Registers a single USB device for sharing, so it can be attached to other machines. Unless the --force option is used, shared devices remain available to the host until they are attached to another machine.
Usage:
usbipd bind [options]
Options:
-b, --busid <BUSID> (REQUIRED) Share device having <BUSID>
-f, --force Force binding; the host cannot use the device
-?, -h, --help Show help and usage information我希望举例说明任何人目前是如何使用usbipd和/或已知的工作来解决这个问题的。很明显--力能完成任务,但当任务需要螺丝时,感觉就像用钉子。
我可以尝试提交一个问题和/或补丁给winpcap/LibUSBpcap,任何告诉我如何在不使用-强制或删除警告的情况下这样做的答案肯定会被标记为已解决。;-)
发布于 2022-03-07 22:43:46
usbipd绑定-f在WSL2中工作得很好。我仍然不得不重新编译内核来构建usb模块,因为它们不包括在Win10中。
另一种选择是安装socat for Windows和WSL2 2/Ubuntu
我使用了Cygwin打包的套接字,它使用unix路径作为Windows串行端口,因此/dev/ttyS3 3对应于COM4。Socat仅作为源代码提供,因此您必须在unix/linux端口中找到windows版本,或者编译自己的。
如果WSL内核缺少模块,Socat不需要额外的驱动程序,而且非常方便。它还让我在一个buggy的Linux USB串行驱动程序上工作。缺点是Linux端无法控制真正的串口波特率或硬件握手。
Windows:
socat TCP-LISTEN:4444,fork /dev/ttyS3,raw Linux/WSL2 2
socat pty,link=/tmp/ttyUSB0,echo=0,raw tcp:172.18.32.1:4444 &https://stackoverflow.com/questions/71273845
复制相似问题