In my Running Windows 10 on Linux using KVM with VGA Passthrough VFIO tutorial I introduced different options for using the keyboard and mouse with the Linux host and the Windows VM. Running a virtualized Windows VM means running two separate systems – the Linux host and the Windows VM – both of which require input and output devices.
Separate Hardware for each System
The easiest solution is to use separate hardware for each system:
For many of us this solution is not practical. I don’t have the desktop real estate needed to place two screens, two keyboards and two mice. I also don’t have a need to watch two screens at the same time.
If your screen has multiple inputs and a selector switch, you can do with one screen. That leaves us with 2 keyboards and 2 mice. If you can live with that, fine. But you can also use two simple USB extension cables, a USB hub to connect your keyboard and mouse, and plug that hub into the host or VM, depending on which system you want to work on. I used this method for about a year, after my KVM switch broke (see below).
KVM (Keyboard, Video, Mouse) Switch
This KVM has nothing to do with the kvm hypervisor we use to run our virtual machine. A KVM switch is a hardware device that connects one screen (video), one keyboard, and one mouse to two or more computers and allows the user to switch between the computers at a press of a button (usually a button on the KVM switch). KVM switches are popular accessories with computer and network professionals.
For our purpose, a 2-port KVM switch is all that is needed to control the host and one VM. A simple, low-cost switch may feature a VGA port combined with one or 2 USB-2 ports and costs as little as $15-$20. Do yourself a favor and don’t buy the cheap junk (see my user review below)!
Unless you actually use VGA, there are KVM switches that offer DVI, HDMI, or Display Port, or even a combination of them. These KVM switches are significantly more expensive, starting at around $50 for a simple DVI ports version and going all the way up to $700. Expect to pay at least $70-$120 for a decent KVM switch. The bonus is that these switches also switch between the two graphics card outputs to the screen, so you need only one connector on your screen.
If you use HDMI or Display Port, and your screen has earphone/mic or line out connectors, you should be able to use the audio on your graphics card.
If, like me, you only need a simple USB switch without video ports, Marcus recommended the IOGEAR GUS402 2 Computer 4-Port USB 2.0 Peripheral Sharing Switch. I don’t have any experience with this model, but the reviews are encouraging.
Edimax EK-2U2C 2-Port USB KVM Switch – Review
6 years ago I bought an Edimax model EK-2U2C 2-port VGA and USB KVM switch, the cheapest I could find. While it seemed a convenient solution, this switch was not very reliable. Switching between host and VM often didn’t work and I had to physically disconnect the KVM switch from the computer to “reset” it. Over time it became worse, having me disconnect the device almost every time I used it. Eventually I got rid of it and switched the cables manually as described above.
Verdict for Edimax 2 Ports USB KVM Switch with Cables EK-2U2C: I wouldn’t buy it again!
Wireless Multi-Device Keyboard & Mouse
In the end I settled for a wireless multi-device Bluetooth keyboard and mouse. These wireless devices can be paired with multiple bluetooth-enabled devices. They also have a USB dongle/receiver, which usually serves multiple wireless devices. I have written a user review about this solution here.
Several vendors offer these multi-device wireless keyboards and mice, for example Dell and Logitech. Be aware that some products received quite unsatisfactory user reviews. One of the issues that comes up again and again is that once the keyboard enters sleep mode, it won’t type the first letter entered. Though this problem has been reported with my keyboard too, I have not yet noticed it except when I switch between devices (e.g. from my host to my guest).
The only thing that sometimes annoys me is the non-standard keyboard layout for special keys like the Print Screen key. Else I’m happy so far.