You are not logged in.
Hello all,
I have two virtual machines, but only one pair of keyboard/mouse. Both of the VMs have set up pci-e passthrough, each with it`s own video card. Currently I am switching the input source of my display to go to each VM. My problem comes when I want to use keyboard/mouse, as they are dedicated to certain VM.
I tryed using Synergy, but I find that it is not always working as it should. Sometimes the mouse hangs on windows VM when I got system message, sometimes I cannot lock the cursor to specific VM...
My idea was to use two USB hubs as sort of KVM switch. Just unplug the keyboard/mouse from one hub, and put it into the other hub. The plus side is that i will have more USBs, a card read and USB sound card... etc. The problem is that it is not working. I used the Port and the Dev to set the hub to the VMs, but on windows I get error 43, device malfunction, and on GNU i don`t see the device at all. When I put an usb device into the hub, I can see the device in device manager, but again it is not working.
My USB controllers are set into two IOMMU groups. What I am thinking of is to pass them as I did with the video cards, but I have only two, and I will not have an USB port on the host machine. This will be my last resort option.
I red a lot of stuff on the net, most people say that what I want to do is not possible. What do you think? Have you done this? Do you need any logs from me? Any thoughts at all? Maybe a script that capture some event, and swap the usb devices between VMS?
Best regards.
P.S:
* Maybe instead of getting the hubs, I should have spent the money to get a keyboard and mouse, but I thought that it will be easy to pass the hubs, and I will have more organised desk :S
* I think I have one final pci port that I can use, to get a third USB controller, so hopefully I will have 3 IOMMU groups of USB devices.
Last edited by Gruntz (2018-04-01 18:18:48)
Offline
How about dynamically assigning/removing the keyboard ('hotplugging') using libvirt?
I personally have a cheap 10 bucks numpad set-up to run a script that attaches/detaches a USB device from a VM.
Basically the script does the following;
Call `virsh attach-device ${VMNAME} ${PATHTOXML}` with the following XML to attach it to a VM.
<hostdev mode='subsystem' type='usb'>
<source>
<vendor id='...'/>
<product id='...'/>
</source>
</hostdev>
Call `virsh detach-device ${VMNAME} ${PATHTOXML}` with the same XML to detach.
Offline
Sounds great, thank you.
Works perfectly.
Best regards.
Offline