Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ultimately, my goal is to have a "keypad" with between 5 and 10 buttons, where pressing one of those buttons effectively presses some key on two computers simultaneously.

In the ideal scenario, the "keypad" would just plug into both computers, sending whatever signal I generated out over 2 USB lines. As far as I can tell, this flat doesn't work (a single USB device cannot connect to two hosts).

I saw online some instructions for connecting a USB keyboard to a hacked-together pair of PS2-USB adapters (connecting the PS2 side, which apparently is happy to have multiple "hosts" with a single device). Even without doing the hacking part, my current keypad won't work when plugged in via keypad->USB to PS2->PS2 to USB->computer. Cutting apart connectors to allow it to be keypad->USB to PS2->2 x PS2 to USB->computer isn't likely to improve that any. I'm not clear if Windows no longer supports PS2 (saw that somewhere online), if the hardware keypad doesn't send the necessary signal to be "converted" to PS2, or what.

Are there any other approaches I'm missing? Any intelligent ways to do it with software (so the keypad plugs into one computer and that computer sends the signal to the other computer)? Immediacy is pretty important, but that route seems to have some legs.

share|improve this question
Could always make it a crafts project: sites.google.com/site/khromtor ... Windows does still support PS2, I'm typing this on a ~10 year old PS2 keyboard on Win7 x64 – Nick T Dec 3 '10 at 5:37
Common USB drivers won't connect to 2 hosts, but perhaps you can rewrite your own? LUFA is open source. – tyblu Dec 3 '10 at 7:22
For Windows to recognise new PS/2 devices you usually have to reboot it with the keyboard plugged in. Either way, I don't see it working: PS/2 has to transmit data to the keyboard as well (to change settings and keyboard LEDs), not just receive it. – Thomas O Dec 3 '10 at 7:52
up vote 13 down vote accepted

You are missing the fact that USB is bidirectional serial protocol, and having two USB hosts talking to a single USB device is not supported neither on physical neither on logical level of the protocol. What you can do is to make each key of the keyboard connected to two MCUs each capable of beeing USB HID, and have their USB cables connected to two PCs. You can use two cheap AVR MCUs for this and use USB HID software implementation, just make two identical HIDkeys and connect each key to both. Btw, read the license carefully.

share|improve this answer
You could use a single MCU so long as it could differentiate between the physical connections. – tyblu Dec 3 '10 at 7:54
what is the issue with the license? – smashtastic Dec 3 '10 at 12:10
Wow. This is the perfect scenario. But it's probably too late for me to build out. Thanks for the input. – ebynum Dec 3 '10 at 14:34
@smashtastic: If I remember well you are allowed to use it for free with non-commercial projects, and to pay fee if you need to use it in commercial projects. – avra Dec 6 '10 at 14:47
License for what? HIDkeys? The USB HID spec? – ebynum Dec 6 '10 at 18:30

You could avoid mucking about with hardware quite easily by relaying key-presses on one Windows computer to another with something like PyKeyLogger and SendKeys

share|improve this answer
So in this scenario, I'd be running PyKeyLogger on the computer with the keypad (to detect the keypresses), adding an app in the middle to receive the keypresses and connect to the remote computer, and an app on the remote computer to receive the signals from the keypad server that uses SendKeys to "press" the keys on the remote computer? – ebynum Dec 3 '10 at 14:32
@ebynum Yes. There might be software that does this already for software multiboxing (see the link in the comment to the question, though that's hardware). Search for "multiboxing software" and see what you get. – Nick T Dec 3 '10 at 15:55
Wow. If only I had heard about this multiboxing earlier. Thanks. Looks like HotkeyNet is going to do exactly what I wanted. – ebynum Dec 3 '10 at 22:03
And, in fact, HotkeyNet did do exactly what I wanted. I would still prefer the hardware solution (not dependent on network latency), but this was a perfect in-between solution. – ebynum Dec 6 '10 at 18:31

This probably won't help you accomplish your overall goal of simultaneous use of a USB peripheral from two computers, but a USB switch can allow non-simultaneous use of a USB peripheral from two or more computers. They seem to work similarly to a KVM switch, and the cheap switches need to be switched manually, but some also support switching via software.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.