I tried to pass through my pendrive and WiFi USB adapter, but I wasn’t able to.
I found
USB Pass trough
My device (pendrive)is:
lsusb
Bus 004 Device 002: ID 13fe:6300 Kingston Technology Company Inc. SP Mobile C31 (64GB)
With the first wiki suggestion, I wrote something like this:
qemu-system-x86_64 -enable-kvm -cpu host -boot menu=on -drive file=Windows7.img -m 8G -vga virtio -display sdl,gl=on -device qemu-xhci,id=xhci -device usb-host,bus=xhci.0,vendorid=0x13fe,productid=0x6300
I was able to start the VM but the USB device wasn’t there. With -boot menu=on I have boot menu inside VM but there is no entry with USB drive.
I tried with kali.img with installed system. Inside guest there was no USB device to moount.
Then I tried:
qemu-system-x86_64 -enable-kvm -cpu host -boot menu=on -drive file=Windows7.img -m 8G -vga virtio -display sdl,gl=on -device qemu-xhci,id=xhci -device usb-host,hostdevice=/dev/bus/usb/004/002
qemu-system-x86_64: -device usb-host,hostdevice=/dev/bus/usb/004/002: failed to open /dev/bus/usb/004/002: Permission denied
I seem like it could work but I’ve got Permission denied message.
Arch wiki says:
Note: If you encounter permission errors when running QEMU, see udev#About udev rules for information on how to set permissions of the device.
The problem is that I don’t understand udev rules.