- Проброс USB устройств через SPICE
- У вас получилось?
- Всё оказалось просто
- USB redirection using Spice #297
- Comments
- dJani97 commented Aug 15, 2020
- 1) I set up Spice in basic.sh :
- 2) I launch the Spice client
- 3) I try redirecting a USB device
- mrkenhoo commented Aug 16, 2020
- reinismu commented Aug 17, 2020
- dJani97 commented Aug 17, 2020
- reinismu commented Aug 17, 2020
- dJani97 commented Aug 17, 2020 •
- SPICE protocol USB redirection
- Kvm xml configuration
- remote viewer
- Intelligent Recommendation
- USB protocol
- About the android version of the spice protocol tls port link mode bug
- Brief description of remote desktop protocol (VNC/SPICE/RDP)
- USB protocol, deep understanding
- USB protocol architecture analysis
- More Recommendation
- USB PD protocol specification
- USB protocol (2)
- USB protocol (3)
- USB protocol (1)
- Communication protocol USB
- Download
- Client
- GTK+ widget
- Windows installers
- Other clients
- Guest
- Linux sources
- Windows binaries
- Server
- 0.15 — stable release
- 0.14.3 — previous stable series
- Xspice server
- x11spice
- Streaming agent (experimental)
- Older releases
- Nightly Builds
- usbredir
- Host Configuration
- Using virt-manager
- Using libvirt
- Using QEMU
- Client Configuration
- Filter String Format
- Client Filtering
- Host Filtering
- Using QEMU
- Using libvirt
- Download
- sourcecode
Проброс USB устройств через SPICE
Собственно проблема в следующем. Есть виртуальная машина работающая через IOMMU+KVM+QEMU на FX-8350+Sabertooth R2. Хост генту: kernel-3.10-pf. Гость: Windows 7 64bit. Настроил spice для прокидывания устройств ввода, всё норм работает. Теперь захотелось в целях научнопознавательных и иследовательских завести USB Redirection.
Собрал значится всё что относится к QEMU и SPICE с USE=«usbredir». Выполнил настройку согласно этой хаутушке. Выставил права на /dev/bus/usb.
В итоге имеем следующее. В самой вирт. машине контроллеры появились. При коннекте с помощью spicy к вирт.машине можно галочками отметить пробрасываемые устройства. Устройство перестаёт работать на хосте, но в госте оно не появляется. Поэтому вопрос: как победить сию проблему?
QEMU запускается след. образом
Емнип, на живую оно пробросить не может, надо гостя ребутнуть.
Пробовал — не помогало. В инете было читано, что проброс осуществялется так: «If you plug in a device while the vm does not have keyboard focus, it will not get redirected, so you can use usb devices normally as long as you don’t have the vm focussed when you plug them in.»
У вас получилось?
У меня ситуация 1:1 с вашей. Тоже Gentoo, тоже Spice+QEMU. в spicy устройство забирается и комп его больше не видит, но в гостевой машине не появляется.
Скажите, вам удалось решить проблему?
Нет, забросил пока ту виртуалку, не до неё счас. Если где-то наткнётесь наткнётесь на решение, буду признателен, если поделитесь. =)
Всё оказалось просто
Christophe Fergeau 2014-03-10 23:48:21 UTC usb redirection was broken with spice-gtk 0.21
А именно она стабильна сейчас в Gentoo. Обновляемся до 0.25 и вуаля.
Источник
USB redirection using Spice #297
Comments
dJani97 commented Aug 15, 2020
I am trying to pass through an iPhone device to the VM. The steps I have tried:
1) I set up Spice in basic.sh :
2) I launch the Spice client
using the remote-viewer command, and successfully connect to spice://localhost:3001 .
I can see my Mac now using Spice 🙂
3) I try redirecting a USB device
I go to File -> USB device selection, and select a device. But when I’m trying to redirect any actual USB device (let it be my iPhone, or a simple USB mouse or keyboard) I get the following error on the remote-viewer console:
I am not insisting on using Spice, I just want to get my iPhone connected with the VM, and this seemed like a nice way to achieve this.
Can anybody help with this?
The text was updated successfully, but these errors were encountered:
mrkenhoo commented Aug 16, 2020
Is the VM using the USB Controller version 3.0?
reinismu commented Aug 17, 2020
I haven’t seen anyone you have managed to passthrough iPhone without passing whole USB controller. If you manage to achieve it with spice, let us know 🙂
dJani97 commented Aug 17, 2020
I haven’t seen anyone you have managed to passthrough iPhone without passing whole USB controller. If you manage to achieve it with spice, let us know 🙂
Is it possible to pass through my USB controller if I only have a single one? I’m trying to achieve this from a laptop.
It’s not a problem that it won’t be available to the host OS during this time.
reinismu commented Aug 17, 2020
It is possible, but you will lose your keyboard/mouse. You could write script that does it all and you get control of Mac. From Mac ssh into host and have script ready to switch controller back. Tho it would be a pain.
I just realized my work laptop has 2 USB controllers. So happy (razer blade 13)
dJani97 commented Aug 17, 2020 •
It is possible, but you will lose your keyboard/mouse. You could write script that does it all and you get control of Mac. From Mac ssh into host and have script ready to switch controller back. Tho it would be a pain.
I just realized my work laptop has 2 USB controllers. So happy (razer blade 13)
To me, hwinfo —short gives the following:
Does it mean that I also have two controllers? It’s a pretty large machine (Dell Inspiron 7720), I wouldn’t be surprised.
Edit: I also checked the result of lsusb , not sure if it’s relevant:
Источник
SPICE protocol USB redirection
Using the SPICE protocol to introduce USB transparent transmission, on the SPICE official website:Spice official website
Kvm xml configuration
remote viewer
Intelligent Recommendation
USB protocol
Old name New name Latest name Maximum speed 2000.04 USB 2.0 480 Mbps 2008.11 USB 3.0 USB 3.1 Gen1 USB 3.2 Gen1 5 Gbps 2013.12 USB 3.1 USB 3.1 Gen2 USB 3.2 Gen2 10 Gbps 2017.09 USB.
About the android version of the spice protocol tls port link mode bug
Recently engaged in the android version of the spice protocol. After the official github code of andorid-spice is downloaded, the compiler successfully runs smoothly and links to the cloud desktop on .
Brief description of remote desktop protocol (VNC/SPICE/RDP)
Comparison of the three protocols One, VNC Applicable system: windows, linux Network traffic: small, usually around 100k Applicable scenarios: Mainly used for the management of linux servers. Due to n.
USB protocol, deep understanding
Share the artificial intelligence tutorial of my teacher, God! Zero basis, easy to understand!http://blog.csdn.net/jiangjunshow You are also welcome to reprint this article. Sharing knowledge, benefit.
USB protocol architecture analysis
First, some basic concepts of USB Pipe (Pipe) Is a model for data transfer between host and device endpoints. There are two types of pipes: unformatted Stream Pipe and formatted Message Pipe. Any USB .
More Recommendation
USB PD protocol specification
USB PD protocol specification Translator: Li Ximin Chapter 2 Section 1: Introduction to USB PD In the USB PD, a pair of directly connected ports use the CC line in the USB Type-C connector as the comm.
USB protocol (2)
Original content, please do not reprint without my consent. Contact me:[email protected] PIPE The most basic form of usb communication is through the endpoint in the USB device, and the data trans.
USB protocol (3)
Original content, please do not reprint without my consent. Contact me:[email protected] I think through the above «USB protocol (a)», it can be seen that USB is easy to use, but for pro.
USB protocol (1)
Original content, please do not reprint without my consent. Contact me:[email protected] The first time you contact USB, you may be confused by various nouns inside. It doesn’t matter if we come t.
Communication protocol USB
Foreword USB is also a widely used device, this article will focus on its summary introduction, a more detailed understanding can go online to find the «circle take you to learn USB» book, i.
Источник
Download
Client
To connect to a virtual machine using SPICE, you need a client application.
GTK+ widget
spice-gtk is a GTK+3 SPICE widget. It features glib-based objects for SPICE protocol parsing and a gtk widget for embedding the SPICE display into other applications such as virt-manager or Boxes. Python and Vala bindings are available too.
The recommended client application is virt-viewer.
Windows installers
- virt-viewer Windows installer — can be downloaded from virt-manager download page
- UsbDk — A Windows filter driver developed for Spice USB redirection (windows client side) — UsbDk_1.0.22_x64.msi, UsbDk_1.0.22_x86.msi, (source code)
- https://gitlab.freedesktop.org/spice/win32/usbdk
Other clients
- Android client — aSPICE is a secure, SSH capable, open source SPICE protocol client that makes use of the LGPL licensed native libspice library. You can find and install aSPICE from play.google.com.
- Web client — a simple javascript client
- https://gitlab.freedesktop.org/spice/spice-html5
- Experimental OS X client
- launcher-mobile — A GPLv2 licensed cross-platform mobile client for both iOS and Android. Though mainly intended to be used as a client for flexVDI, it can also connect to conventional SPICE sessions.
- It is also avaiable in binary form: flexVDI Client at App Store, flexVDI Client at Play Store
Guest
This section contains various optional drivers and daemons that can be installed on the guest to provide enhanced SPICE integration and performance.
Linux sources
- SPICE vdagent — spice-vdagent-0.21.0.tar.bz2
- https://gitlab.freedesktop.org/spice/linux/vd_agent
- x.org QXL video driver — xf86-video-qxl-0.1.5.tar.bz2; Also contains Xspice
- http://cgit.freedesktop.org/xorg/driver/xf86-video-qxl
Windows binaries
This installer contains some optional drivers and services that can be installed in Windows guest to improve SPICE performance and integration. This includes the qxl video driver and the SPICE guest agent (for copy and paste, automatic resolution switching, . )
Windows QXL driver is not needed if you are using the Windows guest tools installer above.
This is not needed if you are using the Windows guest tools installer above.
To enable the folder sharing in the Windows guest you need:
Server
The SPICE server code is needed when building SPICE support into QEMU. It should be available as a package in your favourite Linux distribution, which is the preferred way of getting it.
0.15 — stable release
0.14.3 — previous stable series
Xspice server
Xspice — an X and Spice server. Requires Xorg. See README.xspice.
- The latest sources are xf86-video-qxl. Xspice is mostly reusing that driver and linking directly with spice-server.
x11spice
- x11spice — A utility to allow a user to share a current running X session via a Spice server.
- https://gitlab.freedesktop.org/spice/x11spice
Streaming agent (experimental)
Guest-side daemon which captures the guest video output, encodes it to a video stream and forwards the resulting stream to the host to be sent through SPICE.
Older releases
Older source releases can be found here. Old versions of spice-gtk can be found here.
Nightly Builds
Nightly builds are generated from upstream git master.
Источник
usbredir
usbredir is the name of a network protocol for sending USB device traffic over a network connection. It is also the name of the software package offering a parsing library, a usbredirhost library and several utilities implementing this protocol.
The protocol is documented here, this document also explains what is meant with a usbhost and a usbguest.
usbredir was created for use with Spice, which is why it is hosted on spice-space.org, but the protocol and the usbredirhost are completely independent of spice, they could for example also be used to create a vnc extension for redirecting USB devices over a vnc connection to a qemu virtual machine.
The usbguest side is currently only implemented for qemu, and shipped as part of qemu (enabling this in qemu requires the libusbredirparser library to be available when building qemu).
usbredir supports USB device filtering configurable by a filter string
Host Configuration
For redirection to work, the virtual machine must have a supported USB controller. Qemu supports both USB2 and USB3, but at the time of writing, USB3 has had less testing. For USB2 support, the guest must have a EHCI controller and companion UHCI controller (companion UHCI is needed in order to support also USB1.x devices). For USB3 support, an XHCI controller is required. It also needs to have Spice channels for USB redirection. The number of such channels determine the number of USB devices that it’s possible to redirect at the same time.
More information about USB controllers in qemu could be found here.
Using virt-manager
Virtual machines created with virt-manager should have a USB controller by default. In the virtual machine details, select «Controller USB» in the left pane. If you only need to support USB2 devices, make sure its model is set to «USB2». For USB 3.0 support, select «USB3» for the model type.
You can then click on «Add Hardware» and add «USB Redirection» items as the number of USB devices you want to be able to redirect simultaneously.
Using libvirt
The following libvirt XML will configure a guest with USB2 support and the ability to redirect 3 devices simultaneously:
For USB3 support, the configuration can be simplified to:
Using QEMU
The following qemu options will configure a guest with USB2 support and the ability to redirect 3 devices simultaneously
For USB3 support, the configuration can be simplified to:
Client Configuration
The client needs to have support for USB redirection. In remote-viewer, you can select which USB devices to redirect under the «File->USB device selection» menu once the Spice connection is established. There are also various command line redirection options which are described below and when running remote-viewer with —help-spice.
To get USB redirection working on Windows clients, you need to install UsbDk
Filter String Format
A filter is used to set blocking or autoconnect rules for USB devices. It consists of one or more rules, where each rule has the form of:
Use -1 for class/vendor/product/version to accept any value.
And the rules themselves are concatenated like this:
rule1|rule2|rule3
A client’s default auto-connect filter string is 0x03,-1,-1,-1,0|-1,-1,-1,-1,1
This filters out HID (class 0x03) USB devices from auto connect and auto connects anything else. Note the explicit allow rule at the end, this is necessary since by default all devices without a matching filter rule will not auto-connect.
Client Filtering
Set a string specifying a filter to determine which USB devices, when plugged in, are allowed/blocked to auto-redirect USB traffic to the guest (client’s window has to be in focus).
Set a string specifying a filter to determine which USB devices, that are already plugged in, to redirect on connect once Spice connection is established.
Host Filtering
Set a string specifying a filter to determine which USB devices are allowed/blocked to redirect USB traffic to the guest.
Using QEMU
Note that in a QEMU command, the filter string should use a ‘:’ character as a separator within the rule.
Using libvirt
Download
- For use with qemu 1.3 and newer: usbredir-0.7.1.tar.bz2
- For use with qemu 1.0 / 1.1 / 1.2 release: usbredir-0.4.4.tar.bz2
sourcecode
You can find the official usbredir git repository here.
Источник