【Hacker News搬运】usbredir:用于通过网络连接发送USB设备流量的协议
-
Title: usbredir: A protocol for sending USB device traffic over a network connection
usbredir:用于通过网络连接发送USB设备流量的协议
Text:
Url: https://www.spice-space.org/usbredir.html
usbredir是一个用于通过网络连接发送USB设备流量的网络协议的名称。它也是一个软件包的名称,提供了解析库、usbredirhost库和实现此协议的几个实用程序。 该协议的文档在这里:[usb-redirection-protocol.txt](https://gitlab.freedesktop.org/spice/usbredir/raw/master/usb-redirection-protocol.txt),该文档还解释了usbhost和usbguest的含义。 usbredir最初是为Spice使用的,这就是为什么它托管在spice-space.org上,但协议和usbredirhost与Spice完全独立,它们也可以用于创建一个vnc扩展,用于通过vnc连接将USB设备重定向到qemu虚拟机。 usbredir支持通过过滤字符串配置的USB设备过滤。 主机配置要求虚拟机必须有一个支持的USB控制器。Qemu支持USB2和USB3,但USB3的测试较少。对于USB2支持,客人必须有一个EHCI控制器和伴侣UHCI控制器(伴侣UHCI是为了支持USB1.x设备而需要的)。对于USB3支持,需要一个XHCI控制器。它还需要有Spice通道用于USB重定向。此类通道的数量决定了可以同时重定向的USB设备数量。 在virt-manager创建的虚拟机应该默认具有USB控制器。在虚拟机详细信息中,在左侧面板中选择"Controller USB"。如果你只需要支持USB2设备,请确保其模型设置为"USB2"。对于USB 3.0支持,请选择"USB3"为模型类型。然后点击"添加硬件",并添加"USB重定向"项目,以同时重定向的USB设备数量。 使用libvirt的以下XML将配置一个具有USB2支持和能够重定向3个设备的客人: ```xml <controller type='usb' index='0' model='ich9-ehci1'/> <controller type='usb' index='0' model='ich9-uhci1'> <master startport='0'/> </controller> <controller type='usb' index='0' model='ich9-uhci2'> <master startport='2'/> </controller> <controller type='usb' index='0' model='ich9-uhci3'> <master startport='4'/> </controller> <redirdev bus='usb' type='spicevmc'/> <redirdev bus='usb' type='spicevmc'/> <redirdev bus='usb' type='spicevmc'/>
对于USB3支持,配置可以简化为:
<controller type='usb' index='0' model='nec-xhci'/> <redirdev bus='usb' type='spicevmc'/> <redirdev bus='usb' type='spicevmc'/> <redirdev bus='usb' type='spicevmc'/>
使用QEMU的以下qemu选项将配置一个具有USB2支持和能够重定向3个设备的客人:
-device ich9-usb-ehci1,id=usb -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,multifunction=on -device ich9-usb-uhci2,masterbus=usb.0,firstport=2 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 -chardev spicevmc,name=usbredir,id=usbredirchardev2 -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2 -chardev spicevmc,name=usbredir,id=usbredirchardev3 -device usb-redir,chardev=usbredirchardev3,id=usbredirdev3
对于USB3支持,配置可以简化为:
-device nec-usb-xhci,id=usb -chardev spicevmc,name=usbredir,
Post by: sipofwater
Comments:
tombert: There was a thing that was around 10 or 11 years ago called "Wireless USB", and it was actually kind of cool. It did exactly what it sounds like, you could plug in two different arbitrary USB devices into hubs or a computer that supported wireless USB, and the computer would just recognize it as a vanilla USB device. I don't actually know why it never caught on, I thought it was neat, and it seemed to work fine. I guess due to the popularity and ubiquity of bluetooth?<p><a href="https://en.wikipedia.org/wiki/Wireless_USB" rel="nofollow">https://en.wikipedia.org/wiki/Wireless_USB</a><p>EDIT: Looks like it was more than 10 years ago, circa 2009 or so. Time has no meaning.
tombert: 大约在10年或11年前,有一种东西被称为“;“无线USB”;,而且它实际上有点酷。它做的正是它听起来的样子,你可以将两个不同的任意USB设备插入集线器或支持无线USB的计算机,计算机就会将其识别为普通USB设备。我不;我真的不知道为什么它从来没有流行起来,我觉得它很整洁,而且看起来很好用。我想是因为蓝牙的普及和普及<p> <a href=“https://;/;en.wikipedia.org/:wiki/,Wireless_USB”rel=“nofollow”>https:///;en.wikipedia.org/;wiki/;Wireless_USB</a><p>EDIT:看起来是10多年前的事了,大约在2009年左右。时间没有意义。
paulkon: I'm running virtualhere on thousands of raspberry pi's sharing various USB devices to cloud machines over vpn. It's been working without issues for years now. Seems to be a solo developer in Australia that's been working on it for a really long time. <a href="https://www.virtualhere.com/" rel="nofollow">https://www.virtualhere.com/</a>
paulkon: I-;m在数千个树莓π上运行virtualhere;s通过vpn将各种USB设备共享到云机器。它;We’多年来一直在顺利工作。似乎是澳大利亚的一家独立开发商;I’我已经做了很长时间了<a href=“https://;www.virtualhere.com/;”rel=“nofollow”>https:///;www.virtualhere.com/</一
WhatIsDukkha: The one hack I keep hoping <someoneelse> will do the actual work for is -<p>redirecting my steamdeck control via usb to my linux gaming rig and expose it as a usb device(s) for steaminput.<p>It seems like a natural and perhaps even "straightforward" hack but I've seen no evidence of one so far, perhaps there is something in usb that limits the ability to proxy it correctly.
WhatIsDukkha: 我一直希望的一个破解<;其他人>;将为is-<p>做实际的工作,通过usb将我的steamdeck控件重定向到我的linux游戏设备,并将其作为用于steaminput的usb设备公开<p> 这似乎是一个自然的,甚至可能是“;直截了当的“;破解但我;到目前为止,我还没有看到任何证据,也许usb中有某种东西限制了正确代理它的能力。
sandreas: Sounds a bit like USB/IP (<a href="https://wiki.archlinux.org/title/USB/IP" rel="nofollow">https://wiki.archlinux.org/title/USB/IP</a>).<p>Is this a new thing?
sandreas: 听起来有点像USB/;IP(<a href=“https://;/;wiki.archlinux.org/,title/!USB/:IP”rel=“nofollow”>https://;#xx2F;wiki.archlinux.org/,titleȏ;USB/;IP</a>)<p> 这是新事物吗?
kimown: <a href="https://www.usb-over-network.com/usb-over-network-download.html" rel="nofollow">https://www.usb-over-network.com/usb-over-network-download.h...</a><p>I have used this software for adb debugging in rdp window10, it's really cool, but it don't meet all cases.
kimown: <a href=“https://;/;www.usb-over-network.com/:usb over network download.html”rel=“nofollow”>https:///;www.usb-over-network.com/;usb over network download.h…</a><p>我在rdp window10中使用了这个软件进行adb调试,它;这真的很酷,但它不太酷;我不能满足所有情况。