5

Title explains it.

Imagine this example, Host computer connects to a Client computer via male/male usb connection. Client computer acknowledges this connection as a new device, in this case a keyboard. The host computer can now send key events to the client computer and the client computer would process them as a normal keyboard event.

I did a whole lot of searching in the internet and really have drove down many dead ends. Any tips would be appreciated.

Note* this is a physical connection. The client computer should not have to install any software for this to function (The host will completely spoof as a keyboard).

3 Answers 3

4

USB has two modes: Master and slave.

Usually a device only supports a single mode. E.g. a mouse is a slave, a pendrive is a slave, a keyboard is a slave. A computer is usually a master.

Masters and slaves can communicate with each other.
Slave <--> slave and Master <--> Master does not work.

Master and slave use different plugs to prevent people from making the wrong connection.

Picture of a USB master and slave plug

Only changing the connector does not change this.


In order to use the PC as a keyboard it will need to be able to emulate a slave. Some USB chipsets can this. Most can not. Those who can usually are connected via an AB connector.

Master only uses A (left side of above picture), or mini-A,
Slave only uses B (right side of above picture), or mini B. Devices which can do both usually come with an AB connector.

Wikipedia has a nice list of these connectors and interfaces: Notice that some of these support both a and B connections.

enter image description here

Summarising: you will need to have a non standard USB controller/chipset and a special cable. So yes, it can be done. But not by just modifying a cable and running a special program on the computer which needs to emulate the keyboard.

2
  • Thank you for the information, which in retrospect is rather a downer for me. I will try and search for a solution, I am open to buying hardware but it seems that this isn't a popular topic online. I really am curious how manufacturers produce drivers and software for their devices efficiently without easy solutions to test it.
    – Joe C
    Nov 19, 2012 at 23:42
  • You might be able to build something with a microcontroller with at least 2 USB connections. Possible one of them USB to go ( en.wikipedia.org/wiki/USB_On-The-Go ). Or via USB to serial and serial to USB. However the electrical part of that is way over my head.
    – Hennes
    Nov 20, 2012 at 0:10
0

There are USB devise like this can do the job: https://www.amazon.com/gp/product/B019DI3RV8/ref=ask_ql_qh_dp_hza

But it is not a simple male/male wire.

There are also tools: https://mtlynch.io/key-mime-pi/

It needs USB On-The-Go which Raspberry Pi support it. I'm not sure if normal PC support it.

0

While its not particularly easy to emulate a keyboard over the USB port, you might find it far easier to use an Arduino Pro Micro/Leonardo/Some other MCU to inject keystrokes like a keyboard. This is trivially easy if youve got an Arduino IDE and a compatible MCU like a Pro Micro to hand. I suppose you could then issue commands to it via Bluetooth (by use of, say, a HC05) and then it would inject the keys after receiving them. This is way more electronics based than the answer you would like but it's surefire to work - unlike reconfiguring anything on your computer to try and re-jig the USB into a slave device of some sort

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .