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.

share|improve this question
1  
Have you come up with any solution for this? – bchurchill Nov 16 '11 at 7:32

I am really excited to have found something that will do this from Hagstrom Electronics. It take a serial input and sends a USB keyboard output to another PC. If you combine this with a readily available USB to serial adaptor, then you are golden.

http://www.hagstromelectronics.com/products/usbkm232.html

I have been searching for weeks to find this, so I decided to go back to some forums and share the discovery.

share|improve this answer

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.

share|improve this answer
    
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 Sep 13 '10 at 8:36
    
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 Hennings Sep 13 '10 at 10:22
    
To the dear downvoter: What's the -1 for? Please help me improve: What about my answer is wrong or off-topic? – Martin Hennings Jan 15 '13 at 13:28

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.

share|improve this answer

Your Answer

 
discard

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.