Alex Rivera | Logout

Simulating a keyboard's output (making a computer pose as another computer's keyboard)

Asked 2010-09-13T08:05:54.070
30

I want to be able to connect a computer A's USB port to computer B's USB port so as to make computer A act as computer B's keyboard.

Any idea how I would go about doing that?

I'm not looking for a ready-made solution (though if one already exists and is open-sources I would not object), but for a starting point or a good resource.

I imagine I'd need to write a driver that simulates the keyboard's protocol, and I would also need to sort out the entire USB master/slave scenario.

Anyway, any help would be appreciated.

P.S. I want to do it with the mouse as well, but I imagine it will be a very similar process, and I think (but I might be wildly mistaken) that starting with the keyboard will be easier.

Edit
Report

2 Answers

8

Linux has support for USB gadget mode, but I think you need special hardware for that. I.e. the USB port in a normal PC can not do gadget mode.

An alternative is to wire an LPT port to a PS/2 keyboard input, this is technically simpler.

answered 2010-09-13T08:13:18.190
2

If it wasn't for the USB, I'd connect the two via LAN and have a client/server C# program that emulates a keyboard / mouse (e.g. via DirectInput).

For the USB part as far as I can tell you'll need some hardware adapter. If you're into hardware development or at least unafraid of a soldering iron and some µc programming, have a look at http://www.obdev.at/products/vusb/hidkeys.html where a HID stack for a small atmel chip is available for free. For this solution you'd need two atmega chips which communicate via I²C or SPI or such.
I'd recommend electrical separation of the two pcs, too. You never know if they share the same electrical ground or not.

answered 2010-09-13T08:22:06.483

Your Answer