Back in the old days, when handing someone a DB serial cable when they asked for a DE serial cable would get you killed, KVM switchers were a thing. These devices were simple boxes with a few VGA ports, a few PS/2 ports, and a button or dial that allowed your input (keyboard and mouse) and output (video) to be used with multiple computers. Early KVMs were really just a big ‘ol rotary switch with far, far too many poles. Do you remember that PS/2 wasn’t able to be hot plugged? The designers of these KVMs never knew that.
Today, KVM switchers are a bit more complicated than a simple rotary switch. We’re not dealing with VGA anymore — we have HDMI muxes. We’re also not dealing with PS/2 anymore, and USB requires a bit of microelectronics to switch from one computer to another. For one of his many Hackaday Prize entries, [KC Lee] is designing a low-cost HDMI switch and USB mux. It works, it’s cheap, and if you need to switch a keyboard, mouse, and monitor between boxes, it’s exactly what you need.
First off, the HDMI switching. Designing a switch for HDMI would usually take some obscure parts, intricate routing, and a lot of prototyping time. [KC] found a way around this: just hack up a $5 HDMI switch. This cheap HDMI switch is as simple as it gets, with an HDMI mux doing the heavy lifting and an 8-pin microcontroller to handle the buttons and a selector LED.
For the USB, there are a few more design choices. For USB 1.x switching, [KC] figures he can get away with a 74HC4052 dual 4:1 analog mux. Yes, he’s doing digital with analog chips, the heathen. There are drawbacks to this: everything could break, and it’s only USB 1.x, anyway. For a USB 2.0 KVM, there are a few more professional options. The OnSemi NCN9252 is a proper USB 2.0 mux, and in the current design.
When it comes to large systems, there are a lot more computers than there are people maintaining them. That’s not a big deal since you can simply use a KVM to connect one Keyboard/Video/Mouse terminal up to all of them, switching between each box simply and seamlessly. The side effect is that now the KVM has just as much access to all of those systems as the human who caresses the keyboard. [Yaniv Balmas] and [Lior Oppenheim] spent some time reverse engineering the firmware for one of these devices and demonstrated how shady firmware can pwn these systems, even when some of the systems themselves are air-gapped from the Internet. This was their first DEF CON talk and they did a great job of explaining what it took to hack these devices.
Continue reading “Hacking a KVM: Teach a Keyboard Switch to Spy”
[pmf], like most of us, I’m sure, spends most of his days on a computer. He also has a smartphone he keeps at his side, but over the years he’s grown accustomed to typing on a real keyboard. He came up with the idea of making a USB switch that would allow his keyboard to control either his computer or his phone, and hit upon a really neat way of doing it. He’s using a BeagleBone Black and a Teensy to switch his keyboard between his computer and his phone with just a press of a button.
This homebrew smart KVM uses a BeagleBone Black for most of the heavy lifting. A keyboard and mouse is connected to the USB host port of the BeagleBone, and the main computer is connected to the device port. The BeagleBone is set up to pass through the USB keyboard and mouse to the computer with the help of what Linux calls a ‘gadget’ driver. This required an update to the Linux 4.0 kernel.
With the BeagleBone capable of being a USB pass through device, the next challenge was sending keypresses to another USB device. For this, a Teensy 2.0 was connected to the UART of the BeagleBone. According to [pmf], this is one of the few examples of the Teensy serving as a composite USB device – sending both keyboard and mouse info.
There are a few neat features for [pmf]’s build: the keyboard and mouse don’t disconnect when switching, and thanks to a slight modification of the USB OTG adapter, this will also charge a phone as well as allow for the use of a keyboard. Because the BeagleBone Black has more than one UART this build can also switch keyboards and mice between more than two computers. For those of us who invest heavily in keyboards, it’s a godsend.
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.
When [beerninja] wanted to swap his USB keyboard from one game console to another without mucking about with wires, he asked the Hack A Day forums for some help. [Meseta] (AKA [UAirLtd]) came to the rescue and built [beerninja] a remote-controlled USB switch.
After opening up a no-name USB switch, [Meseta] discovered that the switching is done with simple relays and switches. A hugely overpowered Forebrain ARM dev board was used to pull each switch low for a few hundred milliseconds to switch the output USB port.
For the infrared remote control, [Meseta] dug into Lady Ada’s IR sensor tutorial and decoded buttons 1 through 4 on a Sky TV remote. Each button from one to four corresponds to the buttons on the USB sharing switch. The ‘0’ button was also decoded as a convenience to put the Forebrain into its reprogramming mode. After drilling a small hole for the IR receiver, the finished project was stuffed back into the original steel enclosure.
Check out the video of the switch in action after the break.
Continue reading “Remote-controlled USB switch”