Hackaday Prize Entry: A Better KVM Switch

Now it’s not uncommon to have a desktop and a laptop at a battlestation with tablets waiting in the wings. Add in a few Raspis, consoles, and various cheap computers, and it’s pretty easy to have an enormous number of machines and monitors on a desk. Traditionally, a KVM switch would be the solution to this, sharing a keyboard, mouse, and monitor with many different boxes, but this is an ugly solution. [frankstripod] has a device that fixes that with some interesting software and a few USB hacks.

[frankstripod] is in love with a program called Synergy this program combines the keyboard, mouse, and display of several computers over a network so you’ll only ever have to use one keyboard and mouse; it’s as simple as dragging your mouse from one computer to the other. There are a few limitations, though: keyboards don’t work until the OS has loaded (no BIOS access, then), it doesn’t work if the network is down, and setup can be complicated. This project aims to replace the ‘server’ part of a Synergy setup with a small, networkable KVM.

Right now the plan is to use a small embedded board running Linux to read a USB keyboard and switch the output between several computers. A few scripts detect the mouse moving from one screen to another, and a microcontroller switches USB output between each computer. If it sounds weird, you’re right, but it does work: [frank]’s 2014 Hackaday Prize project was a mouse that worked with two computers at once.

The 2015 Hackaday Prize is sponsored by:

60 thoughts on “Hackaday Prize Entry: A Better KVM Switch

  1. ok while this is not the exact solution i’m personally looking for, this is a great development. KVM switches are still some exotic hardware for in server rooms, mostly only supporting VGA, PS2 and maybe a USB port or two. And then the maximum screen resolution is always limited to something below full HD. There is A LOT of potential for a decent & modern keyboard/mouse/video switch for use in a desktop environment, supporting DVI/HDMI and screen resolutions that are common today. Not to mention that these things are still killer expensive if you want more than 2 machines connected.
    I also don’t like the fact that the computer sees the KVM switch as keyb, mouse and monitor, someone please make one with an analog multiplexer, or even a box full of relays for all i care.

    1. There are cheap HDMI switches from China already, it is a matter of time someone would make one for KVM. I bought a 4 computers from Hong Kong years ago and it was cheap enough.

      The VGA on cheap KVM uses analog muxes. For USB keyboards/mice, you can probably get by with analog muxes designed for USB if you don’t mind the connect/disconnect each time you switch to a different computer. For the old PS/2, you do need to emulate keyboards/mices as the device have internal states which might be different on each machines. Machine A might have caps lock on while machine B might not. Also mouse settings can be different e.g. different DPI, report rates and initialized for different capabilities.

  2. Is the 2015 Hackaday Prize giving up on its “make the world a better place” requirement? Many entries seem to be ‘just gadgets’? Honest curiosity..Not snark.

      1. But surely to qualify for the “best product” it has to fulfill the “make the world a better place” requirement? This is a nice upgrade to a KVM switch, but I don’t see how it fits with the theme of the contest

      2. $50K and six moths? Well then, you’d best keep the moths away from any sources of light and most fabrics, just to be safe. I suppose you could buy a heck of a Moth Cage for $50K though… might be a good investment.

        I’m so very sorry… I couldn’t help myself.

      1. Low cost open MRi fits the theme in my opinion – low cost open source medical devices are certainly an interesting step in what seems like ‘the right direction’.

        This thing,… Not sure about that.. I suppose its cool they are giving away so much fun stuff to the entrants though – i should enter *SOMETHING*.

      2. Medical devices are rarely low cost nor you would find posted open source and as ready to sell products. By the time you make pass the regulations, paper work and trials which takes long time and lots of money. With that much of resource to make a product, you would want to protect it with patents etc. so no open source. So at most it is just research stage material.

        I think the better product side is probably easier. Even if you don’t win a prize, the explosure might be might be good enough. HaD has high page view and just being able to point back to the your project development can help to show that you are trying to make a real product for a kickstarter.

    1. Check out the official rules article 5 to see the judging criteria. Specifically:

      3. Does the entry address a wide-ranging problem?

      You may enter anything you want, and if it’s awesome we may show it off on the blog. But being featured here doesn’t mean the judges will favor this entry over others.

      1. If you don’t meet the requirements you can always lose. I think a lot of people entered stuff they were going to do anyway. Why not? It got publicity and participation for the competition, which is what HaD’s shadowy overlords wanted.

  3. Why add another hardware component when you already have at least two full computers sitting in front of you? The only benefit is to remove the network aspect of the communication. That’s where this comes in: http://www.amazon.com/J5-Create-JUC400-Wormhole-Windows/dp/B007B5Q164/ref=sr_1_1?s=pc&ie=UTF8&qid=1430881413&sr=1-1&keywords=worm+hole Direct hardware connection between computers using USB. I’ve tried it, but there is slight (half second) delay in moving the cursor between screens, which is a deal breaker for me. I assume this open source solution mentioned would have the same sort of delay.

    1. The STM32F405/7 has 2 actually. You only need to use USB Devices to emulate mice/keyboards to the computers.

      There are USB bridges that connect a uC parallel bus (Maxim part uses SPI) and you can wire up multiple chips together if you want. Or you could put them in a FPGA. Or you could use multiple uC with USB as a cheaper SPI-USB device. They are cheaper than other solutions. Copy/paste the same firmware and connect them to a SPI to your uC with OTG.

    1. Well that’s a pretty good example to use, if you’re using synergy the Windows machine would no longer respond, it would be even worse if the Windows machine is the synergy host.

  4. KB Talking pro was a Bluetooth keyboard that could sync and remember 10 devices at once, but has gone out of production. There is still the Majestouch MINILA Air which is supposed to be able to remember 3 devices.

    Overall, I am sad there isn’t more wireless solutions for multisyncing keyboards and mice.

  5. I’m trying to come up with a solution for a single machine that effectively provides a hardware RDP/VNC server to the network. Inspired by Desaster (http://www.rpg.fi/desaster/blog/2013/04/19/vga-framegrabbing-with-tvp7002/), I envision the following:
    Device that connects to the target host via VGA (or DVI/HDMI if preferred, using a suitable interface chip), and USB (HID Keyboard/Mouse, possibly storage for booting from “flash”), and to the network (optionally using POE or external power to catch power up sequences), presenting a VNC or RDP server interface to network clients.
    This could be cascaded from a controller with an embedded (POE) switch to support effectively an unlimited number of client machines, and even simultaneous connections. The controller wouldn’t even need to be particularly intelligent, it could simply use NAT and iptables to perform access control between its upstream interface and the downstream devices.

    What I have found so far that appear to do the majority of what I want is this device (MiniCom KVM Adapter 1SU51079/R):


    HP and other manufacturers also have similar offerings.

    Unfortunately, so far it is not offering up its secrets, having just plugged it in but not cracked it open yet. If anyone else has poked around with these, I’d love to hear from you.

    1. The title for this post is misleading, as it lacks the ‘V’ in KVM… desaster’s solution is on-par with commercial offerings with the exception of encryption (though that’s just a soft/firmware update away). I’ve looked into this before and found desaster’s build, but found the problem to be that not many all-in-one VGA to digital chips exist anymore. I remember not being able to find the TVP7002 a few months ago, but I see it’s in-stock now at mouser. Going the route desaster has blazed for us seems like a much more worthwhile and interesting tool. At least call this post what it is, and that is NOT a KVM.

      1. What?! I’ve been looking for something like the TVP7002 for ages!
        (also, needed to post something here to get updates via email.
        On that note, no one seems to have commented on the benefit of a device like this–as opposed to Synergy, RDP, etc.–regarding its use with systems that *don’t yet* have an OS on them… This works in the BIOS.)

    2. For what it is worth, if anyone wants to try to use the Minicom device, it seems like a waste of time. From the engineers, it is a pure analog device. The 4 pairs are used for R G B, and KM and control on the last pair.

  6. I cannot install synergy on my work computer and was thinking of creating some HW solution. I was looking for a way to duplicate synergy’s functionality of moving from one screen to another with the cursor..but I did not find a solution yet. Any ideas?
    Now that I know USB switches are a thing… it’s a simpler solution.

  7. “Now it’s not uncommon to have a desktop and a laptop at a battlestation with tablets waiting in the wings. Add in a few Raspis, consoles, and various cheap computers, and it’s pretty easy to have an enormous number of machines and monitors on a desk. ”

    Author tries to fit in with the “cool” kids, fails. Too old, let go, it’s over.

  8. Great idea of a sort-of-KVM. Do I understand right that frankstripod’s plan was to evaluate the mouse-position on screen with his piece of hardware but cut it down to a switchable USB hub?

  9. Synergy, eh? How about win2vnc and lin2vnc? You install vnc server on the non-keyboarded computers and win2vnc/lin2vnc sets up a vnc client that is 1 pixel wide on an edge of the screen and does the same thing. And it’s free and open source as well!

  10. Interesting hack but this is not a “better KVM switch” it is a KM switch for multiple monitors, not the same thing at all. I can forgive some inaccuracies in the body copy but could we try to get the headings correct at least?

  11. I was in love with synergy, until it went closed source. Now Im stuck on a old version because I use gentoo on two of my main workstations and now synergy project only releases .deb’s and rpm’s for linux. The real irony, I was one of the volunteer donators to nick boltons funding drive before it went closed, and I just got a email that I have been upgraded to the Pro edition account. So I helped foss, and it repaid me by becoming unusable and non free.

      1. Yes, well I could if it didnt break when I tried because python is currently getting upset about some of the syntax used so I looked at why, as the synergy compiling wiki doesnt even list the version of python or other dependancies required, but its also not going to get intergrated into a ebuild in the gentoo way now.
        Previously I would have looked at why and tried to resolve it and fed that back upstream if I could (its because the build scripts are coded for python2, and break on python3 syntax because print has become a function not a statement, but if you change the hm.sh script to point to the 2.x series python interpreter it almost works, but requires you to specify 1 as the generator in the -g flag ), maybe even look at making a ebuild but now its commercial, Im not inclined. So thats my point.

        1. careful your version isnt too old. the only recently (last year (two?) or so?) fixed the fact that all keystrokes were going over the LAN un-encrypted. yah. not cool.

          personally synergy has too many dependencies that outweigh the benefits to brings.
          ‘real’ KVMs exist to minimize/eliminate the dependencies with hardware. you dont need a server, you dont need a network (or need to worry about what to do when you need to switch networks), you dont need to wait for the OS to boot, you dont need a spare kb and mouse laying around for those times when something just breaks. etc.

          and even with ancient models you only give up the ability to paste from machine to machine, and follow focus to other machines.

          i like the need to switch to which machine i want to control vs some mouse follow action. an errant paste or password entry has bit me too many times on a single machine much less across a few.

          cool idea. not for me.

          1. As above, I have a synergy-pro license. I just spent some time getting it to work in openssl mode because –enable-crypto as a flag to the server/client binaries isnt documented, and the registration process serves a binary linked against a different version of the ssl libraries. Once I had recompiled the plugin and found the flag it works, but I cant help think this is made more awkward because the ssl is a pro feature and its trying to remain somewhat undocumented…

          2. I have to add Ive had a variety of hardware kvms and the desktop models all by and large sucked for stability. Sooner or later they would result in hung boxes requiring reboots to get the km functions back.
            I have a really nice rack kvm made by compaq that is very stable, sadly I cant say the same thing about the kvm extender that brings it into the office, so I tend to run synergy across to the important boxes on it to use when it flakes out and I need a console.
            You can prise my specialtix terminal server out my cold dead hands though…

  12. Hmm I still own two old Opengear KVM IP 1001.. by the time thes were sub 350€ KVM IP with support for serial, usb, multiple users etc.. I just hook it to a regular IP-less KVM, and voila! the thing can control as many hosts as the IP-less KVM can handle..
    Since it was (still is) Open Source, I reall wonder why nobody relooked into it whit todaýs modern hardware!!

  13. A while ago I was looking for a dual head hdmi kvm and found how ridiculously expensive they were so I picked up 2 of these hdmi switches: http://www.amazon.com/Kinivo-501BN-Premium-wireless-adapter/dp/B0049SCB2Y
    one USB switch: http://www.amazon.com/MT-VIKI-Ports-Printer-Switch-MT-1A4B-CF/dp/B00DRG1QHA
    and a powered usb hub. I have done this for a few computer setups and they work very nice at a total cost of about $80. I’ve been wanting to package it in one case rather than having them stacked on top of each other, but for now this works for me.

    1. I realize that my version is store bought and not a hack. As I said, though, I would really like to compile all of the components into one nice neat box like this project has done. Great project

  14. From what I understand, this will only work on systems that don’t apply any sort of acceleration to the mouse pointer, so it can’t be truly “driverless”.

    1. Hm dunno, depends on exactly where this gadget lies on the line between physical mouse to pointer on screen. The acceleration’s all done inside the PC, so he might only need to keep track of it on the USB-plug side.

      Personally I’d have moving from one screen to the next with just the mouse, as an option. I can imagine losing your mouse, or having the screen flick back and forth when you’re fiddling with some control on the edge of the screen, being annoying enough times to curse ever having the idea. I’d still want buttons to control it manually.

      Also a “mouse reset” button that clears the states associated with the mouse, just for in case something complicated and annoying happens. Which isn’t exactly rare. Ugly, yes, but it might be that vs spending 10 years of your life mapping every detail and then having to write a new Windows mouse driver.

      1. I worked for a place that was trying to make exactly this but the target systems were, shall we say, a little long in the tooth. Because the systems it was going to connect to were ‘certified’ we weren’t allowed to run any host software on them, so the same as this ‘driverless’ method.

        The problems are exactly what you describe, due to the host computers acceleration settings you’ll find the mouse suddenly jumps from one screen to the other, depending on how fast you moved it across. The problem was that it was going to be used on safety critical systems so there was no margin for error, so no ‘mouse reset’.

        There would be no way to track the acceleration from the USB side, as the mouse data is mangled by the OS after it gets read, so the only option would be to replicate perfectly the OS’s acceleration algorithm or disable it in the OS entirely.

        1. Oh and the third option is to do video capture and look to see where the mouse pointer is that way, but we were dealing with high resolution analogue signals (2048×2048) so it wasn’t really an option back then.

          1. Actually… you could implement a reasonable mouse acceleration in the KVM itself, and keep track of that. And forbid users from setting any on the machines themselves, keep it at zero. I’d bet 99% of users don’t even know what mouse acceleration is. And if this is a personal project that’s easy to keep control of.

          2. “you could implement a reasonable mouse acceleration in the KVM itself, and keep track of that.”
            Here’s my point, unless you simulate the host OS acceleration exactly you’ll lose sync between where the mouse is on the screen and where your box thinks the mouse is. Then consider that you’ll have to deal with closed source drivers in a lot of cases, so you’ll have to reverse engineer the algorithm used, then factor in the many different mouse drivers from different manufacturers then it becomes a headache.

            This headache will disappear as soon as you turn off acceleration, but it all depends if you are able to do so.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.