Hi, Another approach is via events. <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> ... <qemu:commandline> <qemu:arg value='-object'/> <qemu:arg value='input-linux,id=mouse1,evdev=/dev/input/by-id/usb-Microsoft_Microsoft_5-Button_Mouse_with_IntelliEye_TM_-event-mouse'/> <qemu:arg value='-object'/> <qemu:arg value='input-linux,id=kbd1,evdev=/dev/input/by-id/usb-DELL_DELL_USB_Keyboard-event-kbd,grab_all=on,repeat=on'/> </qemu:commandline> </domain>
You will need to edit the above to match your specific keyboard and mouse. You then press left-CTRL and right-CTRL at the same time to switch mouse/key control between VM and not. On Mon, 10 Jun 2019 at 05:45, Acewind <acew...@gmail.com> wrote: > My Enviroment: > OS: Ubuntu 18.04 > Kernel: 4.15.0-51-generic > SeaBIOS: 1.10.2-1ubuntu1 > > I have successfully run an Win7 libvirt instance on Intel i3-7130U Ubuntu > 18.04 host with IGD card passthrough by VFIO in legacy mode. > > Aslo I need to passthrough the USB mouse and keyboard to the Windows VM. I > tried passthrough only mouse/keyboard device with: > > <hostdev mode='subsystem' type='usb' managed='yes'> > <source> > <vendor id='0x1c4f'/> > <product id='0x0002'/> > <address bus='1' device='3'/> > </source> > <alias name='hostdev5'/> > <address type='usb' bus='0' port='1'/> > </hostdev> > <hostdev mode='subsystem' type='usb' managed='yes'> > <source> > <vendor id='0x093a'/> > <product id='0x2521'/> > <address bus='1' device='2'/> > </source> > <alias name='hostdev6'/> > <address type='usb' bus='0' port='2'/> > </hostdev> > > > And also tried to passthrough whole xhci usb controller to Windows VM with: > > <hostdev mode='subsystem' type='pci' managed='no'> > <driver name='vfio'/> > <source> > <address domain='0x0000' bus='0x00' slot='0x14' function='0x0'/> > </source> > <alias name='hostdev5'/> > <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' > function='0x0'/> > </hostdev> > <hostdev mode='subsystem' type='pci' managed='no'> > <driver name='vfio'/> > <source> > <address domain='0x0000' bus='0x00' slot='0x14' function='0x2'/> > </source> > <alias name='hostdev6'/> > <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' > function='0x0'/> > </hostdev> > > > But there're same problems that after Windows powered on with mouse cursor > displayed on the screen, I need to wait for 5~10 seconds to move the mouse > cursor and use the keyboard shortcut keys. > > It seems that USB mouse/keyboard only can be used after USB mouse/keyboard > drivers are loaded in Windows VM? Or the qemu SeaBIOS does not support USB > mouse/keyboard? > > The qemu commandline part of my libvirt.xml: > > <qemu:commandline> > <qemu:arg value='-set'/> > <qemu:arg value='device.hostdev0.x-igd-opregion=on'/> > <qemu:arg value='-set'/> > <qemu:arg value='device.hostdev0.x-igd-gms=1'/> > <qemu:arg value='-bios'/> > <qemu:arg value='/usr/share/seabios/bios.bin'/> > <qemu:arg value='-chardev'/> > <qemu:arg value='file,id=seabios,path=/tmp/bios.log'/> > <qemu:arg value='-device'/> > <qemu:arg value='isa-debugcon,iobase=0x402,chardev=seabios'/> > </qemu:commandline> > > _______________________________________________ > vfio-users mailing list > vfio-users@redhat.com > https://www.redhat.com/mailman/listinfo/vfio-users >
_______________________________________________ vfio-users mailing list vfio-users@redhat.com https://www.redhat.com/mailman/listinfo/vfio-users