Files
reims-vgpu/scripts
Anees Iqbal fe6f1f7d0f 🆕 Pass the host's USB devices through to x86-64 VMs
reims-ctl had no way to give a guest a USB device of the host's: a user wrote
usb-host into extra_args by hand. Now `reims-ctl usb NAME --add DEVICE` and
the interface's USB devices view (p on a VM: a checkbox per device, Space to
give or take back) choose them, as virt-manager, VirtualBox, GNOME Boxes and
UTM offer: a flat list of the devices plugged in, not a tree of hubs.

- A device is kept in vm.toml as a [[usb]] table by its vendor and product
  IDs, which follow it to any port; one chosen beside a device with the same
  IDs is kept by its port too, which tells the two apart. QEMU's usb-host
  matches the same way, on the VM's xHCI controller.
- A device not plugged in when the VM starts joins the guest when it is, and
  one unplugged comes back when plugged in again: QEMU looks for each
  usb-host device's match every 2 s. The view and `start` say so.
- While the VM runs, a change attaches or detaches the device at once, with
  QMP's device_add and device_del, and is kept for the next start.
- A VM takes four at most, what the controller's seven ports leave room for.
- QEMU opens the device's file in /dev/bus/usb, which only root may write by
  default: install-ctl.sh now asks to add a udev rule giving USB devices
  other than hubs to the kvm group and to the user at the screen (uaccess).
  reims-ctl says what lets it open a device it can't, and doctor checks it.
- macOS hosts get none, and the interface says why: macOS gives a USB device
  one of its drivers holds only to a process running as root or holding an
  entitlement Apple grants VM apps, which QEMU here can't hold.

The docs are usb --help and the interface's help.
2026-11-07 04:59:54 -08:00
..