zoukankan      html  css  js  c++  java
  • spice remote-viewer 连接会话时自动重定向usb设备(记录)

    方法

    1,直接使用以下命令即可自动重定向usb设备(除HID设备)
    remote-viewer --spice-usbredir-redirect-on-connect="0x03,-1,-1,-1,0|-1,-1,-1,-1,1" console.vv

    2,如果使用以下命令,则仅在插拔usb接口才会重定向usb设备:
    remote-viewer --spice-usbredir-auto-redirect-filter="0x03,-1,-1,-1,0|-1,-1,-1,-1,1"



    解释:

    0x03,-1,-1,-1,0 代表过滤此HID(human interface device)设备,即鼠标、键盘、游戏手柄等。
    -1,-1,-1,-1,1 代表允许所有设备连接。

    | 多个规则组合,排前面的优先匹配规则(个人理解,不知道有没有错)

    规则格式:
    <class>,<vendor>,<product>,<version>,<allow>
    <class>,<vendor>,<product>,<version>使用 -1 代表任何值




    spice usb拓展

    以下内容全部来源于:https://www.spice-space.org/usbredir.html

    Using libvirt

    The following libvirt XML will configure a guest with USB2 support and the ability to redirect 3 devices simultaneously:

    <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'/>
    

    For USB3 support, the configuration can be simplified to:

    <controller type='usb' index='0' model='nec-xhci'/>
    <redirdev bus='usb' type='spicevmc'/>
    <redirdev bus='usb' type='spicevmc'/>
    <redirdev bus='usb' type='spicevmc'/>
    

    Using QEMU

    The following qemu options will configure a guest with USB2 support and the ability to redirect 3 devices simultaneously

    -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
    

    For USB3 support, the configuration can be simplified to:

    -device nec-usb-xhci,id=usb 
    -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

    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

    -device usb-redir,filter='0x03:-1:-1:-1:0|-1:-1:-1:-1:1',chardev=usbredirchardev1,id=usbredirdev1
    

    Note that in a QEMU command, the filter string should use a ':' character as a separator within the rule.

    Using libvirt

    ...
    <devices>
     ...
      <redirfilter>
        <usbdev class='0x08' vendor='0x1234' product='0xbeef' version='2.56' allow='yes'/>
        <usbdev allow='no'/>
      </redirfilter>
    </devices>
    ...
     


  • 相关阅读:
    【实用】网站常用单词的中英文对照表
    [译][转]jQuery 1.4 发布:15个新特性实例精讲
    popupWindow 简单实现
    程序员修炼之道 读书笔记
    Burp Suite详细使用教程Intruder模块详解
    漏洞挖掘练习环境(linux方向)
    linux系统操作常见问题(ubuntu和opensuse)
    驱动的加载顺序
    磁盘驱动相关知识
    VS 驱动工程创建软件(EeasySyS)
  • 原文地址:https://www.cnblogs.com/sealin/p/13477266.html
Copyright © 2011-2022 走看看