Electronic – How to plug an arbitrary USB device into two computers

adapterusb

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.

Best Answer

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.