Introduction

Not so long ago, a new feature was added for USB management: being able to automatically attach devices connected to a given USB port to a given qube.

This is highly specific as you can imagine, it does not filter by device, only by USB port.

This is slightly documented here https://www.qubes-os.org/doc/how-to-use-usb-devices/ but it's very light in my opinion. I may write a PR to update the official doc with the guide if people find it ok.

USB port identification

First, you need to identify the USB port identifier from dom0:

[user@dom0 ~]$ qvm-usb list --all
BACKEND:DEVID        DESCRIPTION                                           USED BY
sys-usb:3-1.3      0bda:8153_Realtek_USB_10_100_1000_LAN_000001
sys-usb:4-10       8087:0026_8087_0026
sys-usb:4-6.2      041d:01e5_025f_HD_Pro_Webcam_C920_6E2F6104
sys-usb:4-6.5      0bda:1100_Realtek_HID_Device
sys-usb:4-7        5986:9102_Sonix_Technology_Co.__Ltd._BisonCam_NB_Pro

Attach

Secondly, you need to tell Qubes OS which qube should receive USB devices connected to a given port.

qvm-usb attach --persistent $MyQube sys-usb:4-6.2

This will always attach the device on port 4-6.2 (a webcam is currently connected to this port) to the qube $MyQube.

Be aware that if you connect anything to that USB port, it will be attached to the qube. It does not filter by device, but by port.