[Spice-devel] 答复: 答复: The second client cannot redirect USB

Victor Toso victortoso at redhat.com
Wed Nov 23 13:57:59 UTC 2022


Hi,

On Wed, Nov 23, 2022 at 01:19:10PM +0000, 韩雪峰 wrote:
> Hi Victor,
>
> Thanks for your solution. I just find 'usbredirtestclient' in
> usbredir project, the client has the feature connect to
> server(QEMU),  and it could connect to server successfully, but
> I cannot find how to redirect usb device from client to VM. It
> seems that I need to write some code to redirect USB with
> usbredir, right ?

usbredirtestclient is a testing client, not what you want.

Try usbredirect binary from usbredir-tools package (Fedora 37):
https://koji.fedoraproject.org/koji/buildinfo?buildID=2088721

Or just compile usbredir project and test it out:

$ git clone https://gitlab.freedesktop.org/spice/usbredir.git
$ cd usbredir
$ meson . build -Dtools=enabled
$ ninja -C build
$ sudo ./build/tools/usbredirect --to localhost:5550 --device 8644:8003

Cheers,
Victor

>
> Thanks and Regards,
> Xuefeng
> 
> 
> -----邮件原件-----
> 发件人: Victor Toso <victortoso at redhat.com> 
> 发送时间: 2022年11月22日 16:45
> 收件人: 韩雪峰 <hanxuefeng at 360.cn>
> 抄送: Frediano Ziglio <freddy77 at gmail.com>; spice-devel at lists.freedesktop.org
> 主题: Re: [Spice-devel] 答复: The second client cannot redirect USB
> 
> Hi,
> 
> On Mon, Nov 21, 2022 at 08:44:49AM +0000, 韩雪峰 wrote:
> > Hi,
> > Thanks for your reply. But If I want to support multiple channels for 
> > USB redirection when multiple clients connect to a same VM,  do you 
> > know which project includes the code about USB
> > channels ?   Spice ? or QEMU?
> 
> As Frediano pointed out, USB redirection with SPICE is bounded to the first connected SPICE client.
> 
> You can reconfigure your VM to have a TCP backend for your USB devices, the libvirt change would look like this:
> 
>     <redirdev bus='usb' type='tcp'>
>         <source mode='bind' host='localhost' service='5550'/>
>         <protocol type='raw'/>
>         <address type='usb' bus='0' port='3'/>
>     </redirdev>
> 
> And then, you can use usbredirect (from usbredir project) to redirect USB devices from multiple clients.
> 
> Note that this is will use plain usbredir protocol over TCP, it isn't secure channel like what SPICE provides.
> 
> Cheers,
> Victor
> 
> > Thanks and Regards,
> > Xuefeng
> >
> > 发件人: Frediano Ziglio <freddy77 at gmail.com>
> > 发送时间: 2022年11月18日 20:52
> > 收件人: 韩雪峰 <hanxuefeng at 360.cn>
> > 抄送: spice-devel at lists.freedesktop.org
> > 主题: Re: [Spice-devel] The second client cannot redirect USB
> >
> > Il giorno ven 18 nov 2022 alle ore 10:21 韩雪峰 <hanxuefeng at 360.cn<mailto:hanxuefeng at 360.cn>> ha scritto:
> > Hello,
> >
> >    When I used two client to connect to a same one VM by spice
> >    with setting “SPICE_DEBUG_ALLOW_MC=1”, the two clients
> >    worked, and the first client could redirect USB. However,
> >    the second client could not redirect USB device, It shows
> >    like the picture: [cid:image001.png at 01D8FDC6.C4D82080]
> > 
> > I’m sure that there’re enough channels for USB redirection.
> > 
> > Is this a problem? Or Is there any way that could resolve the second client’s USB redirection problem?
> > 
> > Thanks and Regards,
> > 
> > Xuefeng
> > 
> > Currently all character device channels (including USB one) do not support multiple channels, so the first client takes them all.
> > 
> > Frediano
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20221123/ac824025/attachment.sig>


More information about the Spice-devel mailing list