On Mon, Apr 16, 2018 at 03:52:03PM -0700, Alexander Kappner wrote: > Hi Gerd, > > thanks for reviewing. I'll follow up with a v3 of the patch addressing your > proposed changes. > > >> This allows a QMP client to query which USB devices may be available > >> for redirection. > > > At least libvirt sandboxes qemu, for security reasons, and you wouldn't > > get any useful results because qemu hasn't the permissions needed to > > scan the usb bus. > Then at least this tells you that you can't make anything available via > redirection either, which is also useful information.
Well, you can, but you have to go through libvirt instead. Libvirt will whitelist the usb device you want assign then (and only that one) so qemu can access it. > > I'm wondering what the use case is? > I'm working on a smartphone client that talks to a QEMU instance via > QMP, and that allows the user to switch USB devices between host and > QEMU guest. This removes the need for a separate set of input devices > permanently assigned to the host (since if I pass through a > keyboard/mouse to the VM, I can't use that same keyboard/mouse to run > a command that re-attaches those devices to the host, so I need some > external channel). Basically using the phone as a KVM switch. That wouldn't work for any libvirt-managed guests. Also: Do you know input-linux (see ui/input-linux.c)? That allows switching input devices between host and (one) guest by keyboard hotkey. cheers, Gerd