r/olkb•
elliottcable

Multi-computer keyboard using QMK?

Has anybody built a keyboard that they can switch between multiple machines using the keyboard itself?

I know this isn't first-class functionality of QMK, but I can only think of a couple ways of doing this:

  1. Bluetooth, multiple pairings, and map a key to a function that calls whatever-firmware-function to switch between paired devices. (Pretty bog-standard, but haven't seen it done in a MK yet - anybody have any experience?) Sounds good, but I actually find Bluetooth pairing/switching pretty laggy and buggy, so this is out.

  2. Multiple wired connections, and a mapping to switch between which wired connection USB HID signals are being sent on. Complex, even just at the electrical level (I guess you'd have to float one of the connections, avoid tying the two machine's USB grounds together? Yikes); not to mention that I don't know of any microcontrollers that explicitly support this ... but by far the most ideal solution, as far as I'm concerned.

  3. Figure out a way to hook up a serial cord to an existing KVM, and add a mapping that sends instructions to swap devices ... thus rebooting the keyboard, of course, lol, so it's kinda a one-way mapping. Not pretty, but the only practical approach I can think of.

Posted Apr 17, 2019, 3:06 PM UTC

1313
dittani•

You could modify the code for i2c split keyboards. One "half" of the keyboard is the MCU connected to the host. The other half is the entire keyboard matrix connected to another MCU.

Matrix MCU scanning the matrix and reporting keypresses over i2c to the host MCU.

You could have multiple host MCUs with different i2c addresses, switch between hosts by changing address.

Each host MCU could have a different keymap.

4
AminesToAnEnd•

I have done this with a KVM switch. I used a windows and mac computer with the same keyboard. I had one key with a macro that hit screen lock twice (which was the command for the kvm switch to change computers) and also change my keymap layer. Worked wonderfully.

4
algernoneFirmware hacker•

I'm not a hardware expert, but what if you had one MCU (without an USB port) as the brains of the keyboard, and two others with USB ports that do nothing else but forward whatever the main one sends them, to the host? Then, on the main MCU, all you'd need to do is figure out which helper to route to. Or you could send to both, and let them figure out which one's active, and the inactive would drop stuff on the floor.

Mind you, this sounds quite complicated to do with QMK's architecture - or at least that's my gut feeling. Thus, your KVM-based idea looks like the most practical, indeed.

2
elliottcableOP•

I love my MX Ergo, and that’s actually what prompted this post!

I also have a KVM — even so spoiled as do have a separate USB-switch with an external remote that I’ve mounted under my desk.

Only remaining wish is to hyper-optimize that behavior into the homerow. Despite all the above, it’s still so jarring when I need to move from the Windows screen to the Mac screen.

(I’m really disappointed that I can’t benefit from the Ergo’s integration with their Bluetooth keyboard — to just move my mouse to another screen, and have the keyboard magically work there … it’s the dream.)

2
yomimashita•

to just move my mouse to another screen, and have the keyboard magically work there

There are software solutions that do just that.

4
DanL4•

If I understand correctly, you have two screens (one for each computer), so kvm isn't for video, only for keyboard and mouse? If so : I used to have RealVNC on both of my computers (one master, one slave), the keyboard and mouse only connect to the master. instead of having a window dedicated for the slave, there was a one-pixel-width "window" on the side of the screen. This way when mouse would move to that pixel it would find itself on the other computer and the keyboard follows (as you are now controlling the remote computer).

It was pretty cool, even copying and pasting text worked between computers! I did it because, as a programmer, I wanted two screens (one for copying text from stackexchange, the other to paste into visual studio or whatever I was using) but my computer wasn't strong enough to run smoothly with two screens (2004ish).

Hope this helps.

1
ethereal_intellect•

Heh, I did the same by using a laptop on my second monitor for web browsing when my last computer was starting to feel slow and lacking in ram for chrome, using synergy :)

2
yomimashita•

Not op, but yeah that's one of the software solutions I was referring to.

1
hailbrenoTealio Planck | Zealio 67g DZ60•

I know it’s not what you’re looking for but I use Synergy for this.

2
StupidHumanSuit•

It's a cool idea, but you're asking for a pretty bloated program. We already have pretty strict flash memory space on non-ARM processors. Not to mention that QMK doesn't even work directly with BT yet.

​

​

Logitech has a fantastic implementation on the MX Ergo trackball. It's Bluetooth enabled but also has a "unifying receiver" for connection to another device. I use it all the time for working between a windows machine and my mac.

​

Synergy already exists. You can get a small KVM for $15. I just think it's a niche that is already handled.

1
squeezeonein•

switch mode supplies cannot be paralleled, so both would need to be electrically isolated. The easiest way to do this is to power the matrix from a separate wallwart. I would use a usb hid controller for each pc and use a a pair of optoisolators on each row pin and each column pin, or if you want to use 3 PCs use 3 optoisolators per pin.

The diodes would need to be sized to handle the increased optoisolator current. Mx switches can handle a fair deal of current.

It would be tricky to avoid the wallwart, maybe you would need a dc/dc converter for galvanic isolation.

you could use a qmk layer on each keyboard to mute the keypresses, or type simultaneously, if you want a keylogging backup.

1
elliottcableOP•

What if I don’t care whether state is retained? My current solution (A USB-only KVM, basically) reboots the keyboard (because it switches the KB’s power-supply) when it switches computers. Perhaps the switching circuit could fully isolate each input, and only draw 5v from the active one? (I’m shitty at EE, not sure if that’s easily implementable.)

1
squeezeonein•

I assumed you wanted to avoid a kvm for some reason, but if what you want to do is hard switch the usb cable i'm sure that's possible, but it might shorten the life of the port or peripherals. I don't think it is possible to isolate each input at usb bus speeds(24mhz)

1
equalunique•

I'm also very interested in this.

Not knowing what I was doing, I created this issue on QMK GitHub, and nobody replied it it at all. :/ https://github.com/qmk/qmk_firmware/issues/5185

KVMs are really annoying. Most KVMs do a hard-disconnect/reconnect the keyboard, mouse, and monitor. This introduces a delay of a couple seconds between computers. Fancy KVMs do an emulation of the connected peripherals so that the switching is a little faster. In ether case, you are still constrained by a single monitor, which prevents any meaningful multitasking. Neither are optimal for a table full of screen-equipped laptops where you would probably want to use your single high-end keyboard with all of them & not worry about the screen.

I eventually found a couple Belkin F1DN108K-3 secure KM switches for 95% off MSRP on eBay (the insane discount shows how little demand there is for solutions to this niche problem). Those devices meet my need for now, but I would still really prefer a way to do this via QMK.

Yes, there are software solutions available, but most corporate environments will never approve something that provides keyboard/mouse control over the network. Especially if it's a 3rd-party open source application like Synergy. Network connectivity isn't even a given anyway if your job is in a secure environment.

I've also asked the question to the Mitosis project, which doesn't use QMK, but might also be viable too: https://github.com/reversebias/mitosis/issues/17

1
elliottcableOP•

FWIW, if you’re flush with cash, there’s the expensive StarTech SV231DPDDUA2 (lol that’s a mouthful.) I use 5K displays, so it’s still “single-monitor” for me, but it’s intended to be used for dual 4K displays.

It’s just as janky as every other KVM I’ve used, though; I can’t really recommend it … so much as grumpily acknowledge that, yes, it technically is an option. lol.

2