Loupedeck USB 设备“libvirtd”通过 UDEV 规则传递给 Win

Loupedeck USB 设备“libvirtd”通过 UDEV 规则传递给 Win

我有这个控制台我正在尝试将其作为 USB 传递到在 QEMU 上运行的 Win11。它不高兴被“重定向”为 USB 设备,所以我为它编写了一个 UDEV 规则,b/c 没有它,当然我没有权限:

规则:

$udevadm info --attribute-walk --path=$(udevadm info --query=path --name=/dev/ttyACM0)

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:08.1/0000:c3:00.3/usb1/1-1/1-1>
    KERNEL=="ttyACM0"
    SUBSYSTEM=="tty"
    DRIVER==""
    ATTR{power/control}=="auto"
    ATTR{power/runtime_active_time}=="0"
    ATTR{power/runtime_status}=="unsupported"
    ATTR{power/runtime_suspended_time}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:08.1/0000:c3:00.3/usb1/>
    KERNELS=="1-1:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="cdc_acm"
    ATTRS{authorized}=="1"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceClass}=="02"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bInterfaceProtocol}=="00"
    ATTRS{bInterfaceSubClass}=="02"
    ATTRS{bNumEndpoints}=="01"
    ATTRS{bmCapabilities}=="6"
    ATTRS{iad_bFirstInterface}=="00"
    ATTRS{iad_bFunctionClass}=="02"
    ATTRS{iad_bFunctionProtocol}=="01"
    ATTRS{iad_bFunctionSubClass}=="02"
    ATTRS{iad_bInterfaceCount}=="02"
    ATTRS{physical_location/dock}=="no"
    ATTRS{physical_location/horizontal_position}=="left"
    ATTRS{physical_location/lid}=="no"
    ATTRS{physical_location/panel}=="top"
    ATTRS{physical_location/vertical_position}=="upper"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:08.1/0000:c3:00.3/usb1/>
    KERNELS=="1-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{authorized}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceClass}=="ef"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bDeviceSubClass}=="02"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bMaxPower}=="500mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bNumInterfaces}==" 4"
    ATTRS{bcdDevice}=="0100"
    ATTRS{bmAttributes}=="a0"
    ATTRS{busnum}=="1"
    ATTRS{configuration}==""
    ATTRS{devnum}=="7"
    ATTRS{devpath}=="1"
    ATTRS{idProduct}=="0002"
    ATTRS{idVendor}=="2ec2"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="Loupedeck"
    ATTRS{maxchild}=="0"
    ATTRS{physical_location/dock}=="no"
    ATTRS{physical_location/horizontal_position}=="left"
    ATTRS{physical_location/lid}=="no"
    ATTRS{physical_location/panel}=="top"
    ATTRS{physical_location/vertical_position}=="upper"
    ATTRS{power/active_duration}=="460164"
    ATTRS{power/autosuspend}=="2"
    ATTRS{power/autosuspend_delay_ms}=="2000"
    ATTRS{power/connected_duration}=="460164"
    ATTRS{power/control}=="on"
    ATTRS{power/level}=="on"
    ATTRS{power/persist}=="1"
    ATTRS{power/runtime_active_time}=="459880"
    ATTRS{power/runtime_status}=="active"
    ATTRS{power/runtime_suspended_time}=="0"
    ATTRS{power/wakeup}=="disabled"
    ATTRS{power/wakeup_abort_count}==""
    ATTRS{power/wakeup_active}==""
    ATTRS{power/wakeup_active_count}==""
    ATTRS{power/wakeup_count}==""
    ATTRS{power/wakeup_expire_count}==""
    ATTRS{power/wakeup_last_time_ms}==""
    ATTRS{power/wakeup_max_time_ms}==""
    ATTRS{power/wakeup_total_time_ms}==""
    ATTRS{product}=="Loupedeck+"
    ATTRS{quirks}=="0x0"
    ATTRS{removable}=="removable"
    ATTRS{remove}=="(not readable)"
    ATTRS{rx_lanes}=="1"
    ATTRS{speed}=="12"
    ATTRS{tx_lanes}=="1"
    ATTRS{urbnum}=="15"
    ATTRS{version}==" 2.00"

  looking at parent device '/devices/pci0000:00/0000:00:08.1/0000:c3:00.3/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{authorized}=="1"
    ATTRS{authorized_default}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bcdDevice}=="0605"
    ATTRS{bmAttributes}=="e0"
    ATTRS{busnum}=="1"
    ATTRS{configuration}==""
    ATTRS{devnum}=="1"
    ATTRS{devpath}=="0"
    ATTRS{idProduct}=="0002"
    ATTRS{idVendor}=="1d6b"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="Linux 6.5.13-4-MANJARO xhci-hcd"
    ATTRS{maxchild}=="5"
    ATTRS{power/active_duration}=="988097"
    ATTRS{power/autosuspend}=="0"
    ATTRS{power/autosuspend_delay_ms}=="0"
    ATTRS{power/connected_duration}=="4021177"
    ATTRS{power/control}=="auto"
    ATTRS{power/level}=="auto"
    ATTRS{power/runtime_active_time}=="988083"
    ATTRS{power/runtime_status}=="active"
    ATTRS{power/runtime_suspended_time}=="3033090"
    ATTRS{power/wakeup}=="disabled"
    ATTRS{power/wakeup_abort_count}==""
    ATTRS{power/wakeup_active}==""
    ATTRS{power/wakeup_active_count}==""
    ATTRS{power/wakeup_count}==""
    ATTRS{power/wakeup_expire_count}==""
    ATTRS{power/wakeup_last_time_ms}==""
    ATTRS{power/wakeup_max_time_ms}==""
    ATTRS{power/wakeup_total_time_ms}==""
    ATTRS{product}=="xHCI Host Controller"
    ATTRS{quirks}=="0x0"
    ATTRS{removable}=="unknown"
    ATTRS{remove}=="(not readable)"
    ATTRS{rx_lanes}=="1"
    ATTRS{serial}=="0000:c3:00.3"
    ATTRS{speed}=="480"
    ATTRS{tx_lanes}=="1"
    ATTRS{urbnum}=="209"
    ATTRS{version}==" 2.00"

  looking at parent device '/devices/pci0000:00/0000:00:08.1/0000:c3:00.3':
    KERNELS=="0000:c3:00.3"
    SUBSYSTEMS=="pci"
    DRIVERS=="xhci_hcd"
    ATTRS{ari_enabled}=="0"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x0c0330"
    ATTRS{consistent_dma_mask_bits}=="64"
    ATTRS{current_link_speed}=="16.0 GT/s PCIe"
    ATTRS{current_link_width}=="16"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{device}=="0x15b9"
    ATTRS{dma_mask_bits}=="64"
    ATTRS{driver_override}=="(null)"
    ATTRS{enable}=="1"
    ATTRS{irq}=="43"
    ATTRS{local_cpulist}=="0-15"
    ATTRS{local_cpus}=="ffff"
    ATTRS{max_link_speed}=="16.0 GT/s PCIe"
    ATTRS{max_link_width}=="16"
    ATTRS{msi_bus}=="1"
    ATTRS{msi_irqs/43}=="msi"
    ATTRS{numa_node}=="-1"
    ATTRS{power/control}=="on"
    ATTRS{power/runtime_active_time}=="4005320"
    ATTRS{power/runtime_status}=="active"
    ATTRS{power/runtime_suspended_time}=="16486"
    ATTRS{power/wakeup}=="enabled"
    ATTRS{power/wakeup_abort_count}=="0"
    ATTRS{power/wakeup_active}=="0"
    ATTRS{power/wakeup_active_count}=="1"
    ATTRS{power/wakeup_count}=="0"
    ATTRS{power/wakeup_expire_count}=="1"
    ATTRS{power/wakeup_last_time_ms}=="39380"
    ATTRS{power/wakeup_max_time_ms}=="105"
    ATTRS{power/wakeup_total_time_ms}=="105"
    ATTRS{power_state}=="D0"
    ATTRS{remove}=="(not readable)"
    ATTRS{rescan}=="(not readable)"
    ATTRS{reset}=="(not readable)"
    ATTRS{reset_method}=="pm"
    ATTRS{resource0}=="(not readable)"
    ATTRS{revision}=="0x00"
    ATTRS{subsystem_device}=="0x8b75"
    ATTRS{subsystem_vendor}=="0x103c"
    ATTRS{vendor}=="0x1022"

  looking at parent device '/devices/pci0000:00/0000:00:08.1':
    KERNELS=="0000:00:08.1"
    SUBSYSTEMS=="pci"
    DRIVERS=="pcieport"
    ATTRS{ari_enabled}=="0"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x060400"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{current_link_speed}=="16.0 GT/s PCIe"
    ATTRS{current_link_width}=="16"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{device}=="0x14eb"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{driver_override}=="(null)"
    ATTRS{enable}=="2"
    ATTRS{irq}=="36"
    ATTRS{local_cpulist}=="0-15"
    ATTRS{local_cpus}=="ffff"
    ATTRS{max_link_speed}=="16.0 GT/s PCIe"
    ATTRS{max_link_width}=="16"
    ATTRS{msi_bus}=="1"
    ATTRS{msi_irqs/36}=="msi"
    ATTRS{numa_node}=="-1"
    ATTRS{power/autosuspend_delay_ms}=="100"
    ATTRS{power/control}=="on"
    ATTRS{power/runtime_active_time}=="4021811"
    ATTRS{power/runtime_status}=="active"
    ATTRS{power/runtime_suspended_time}=="0"
    ATTRS{power/wakeup}=="disabled"
    ATTRS{power/wakeup_abort_count}==""
    ATTRS{power/wakeup_active}==""
    ATTRS{power/wakeup_active_count}==""
    ATTRS{power/wakeup_count}==""
    ATTRS{power/wakeup_expire_count}==""
    ATTRS{power/wakeup_last_time_ms}==""
    ATTRS{power/wakeup_max_time_ms}==""
    ATTRS{power/wakeup_total_time_ms}==""
    ATTRS{power_state}=="D0"
    ATTRS{remove}=="(not readable)"
    ATTRS{rescan}=="(not readable)"
    ATTRS{reset}=="(not readable)"
    ATTRS{reset_method}=="pm"
    ATTRS{revision}=="0x00"
    ATTRS{secondary_bus_number}=="195"
    ATTRS{subordinate_bus_number}=="195"
    ATTRS{subsystem_device}=="0x14eb"
    ATTRS{subsystem_vendor}=="0x1022"
    ATTRS{vendor}=="0x1022"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
    ATTRS{power/control}=="auto"
    ATTRS{power/runtime_active_time}=="0"
    ATTRS{power/runtime_status}=="unsupported"
    ATTRS{power/runtime_suspended_time}=="0"
    ATTRS{waiting_for_supplier}=="0"

根据上述规则,我可以使用此 USB 添加为主机设备来运行 VM,配置如下:

<hostdev mode="subsystem" type="usb" managed="yes">
  <source>
    <vendor id="0x2ec2"/>
    <product id="0x0002"/>
  </source>
  <address type="usb" bus="0" port="1"/>
</hostdev>

该地址与来自 的地址相符lsblk

ls指向正确的设备并且它具有正确的权限(父设备):

ll /dev/loupeLoupe                                               
0 lrwxrwxrwx 1 root root 15 dec 17 23:40 /dev/loupeLoupe -> bus/usb/001/007

udev 测试说:

DEVPATH=/devices/pci0000:00/0000:00:08.1/0000:c3:00.3/usb1/1-1/1-1:1.0/tty/ttyACM0
DEVNAME=/dev/ttyACM0
MAJOR=166
MINOR=0
ACTION=add
SUBSYSTEM=tty
TAGS=:systemd:
ID_BUS=usb
ID_MODEL=Loupedeck+
ID_MODEL_ENC=Loupedeck+
ID_MODEL_ID=0002
ID_SERIAL=Loupedeck_Loupedeck+
ID_VENDOR=Loupedeck
ID_VENDOR_ENC=Loupedeck
ID_VENDOR_ID=2ec2
ID_REVISION=0100
ID_TYPE=generic
ID_USB_MODEL=Loupedeck+
ID_USB_MODEL_ENC=Loupedeck+
ID_USB_MODEL_ID=0002
ID_USB_SERIAL=Loupedeck_Loupedeck+
ID_USB_VENDOR=Loupedeck
ID_USB_VENDOR_ENC=Loupedeck
ID_USB_VENDOR_ID=2ec2
ID_USB_REVISION=0100
ID_USB_TYPE=generic
ID_USB_INTERFACES=:020200:0a0000:010100:010300:
ID_USB_INTERFACE_NUM=00
ID_USB_DRIVER=cdc_acm
ID_USB_CLASS_FROM_DATABASE=Miscellaneous Device
ID_USB_PROTOCOL_FROM_DATABASE=Interface Association
ID_PATH_WITH_USB_REVISION=pci-0000:c3:00.3-usbv2-0:1:1.0
ID_PATH=pci-0000:c3:00.3-usb-0:1:1.0
ID_PATH_TAG=pci-0000_c3_00_3-usb-0_1_1_0
DEVLINKS=/dev/serial/by-path/pci-0000:c3:00.3-usb-0:1:1.0 /dev/serial/by-path/pci-0000:c3:00.3-usbv2-0:1:1.0 /dev/serial/by-id/usb-Loupedeck_Loupedeck+-if00
ID_MM_CANDIDATE=1
CURRENT_TAGS=:systemd:
USEC_INITIALIZED=3562461516
Unload kernel module index.
Unloaded link configuration context.

虚拟机启动,但系统中没有提及此 Loupedeck 设备。根本找不到。

为了验证我的步骤,我为 USB 笔驱动器创建了一个非常相似的 UDEV 规则,并将其安装为成功的主机设备。

所以我的问题是:为了在 win11 VM 中使用这个设备,我是否遗漏了一些东西?我做错了什么吗?我应该怎么做才能让 windows 看到它?

libvirtd版本:2023-12-17 22:51:19.342+0000:15206:信息:libvirt 版本:9.10.0

os:曼扎罗

谢谢

相关内容