views:

29

answers:

2

Hi

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.

+1  A: 

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.

Sjoerd
A: 

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.

Martin
By electrical separation, do you mean that on the "slave's" side I should disconnect the VCC and GND, and opto-couple the D+ and D- lines?
Anonymous Coward
In basic, yes, though: It's actually very difficult to electrically separate a USB connection due to the unpredictable signal directions in the D+ and D- lines. But what's very easy to do is to (e.g. optically) decouple the SPI-or-such connection between the two microcontrollers. Then each µc would be powered separately via its own USB connection.
Martin