13

Is there a way to use one computer to send keystrokes to another by usb ?

What i'm looking to do is to capture the usb signal used by a keyboard (with USBTrace for example) and use it with PC-1 to send it to PC-2. So that PC-2 reconize it as a regular keyboard input.

Some leads to do this would be very appreciated.

Lucas
  • 131
  • 1
  • 1
  • 3

5 Answers5

11

What you essentially need is a USB port on PC-1 that will act as a USB device for PC-2.

That is not possible for the vast majority of PC systems because USB is an asymmetric bus, with a host/device (or master/slave, if you wish) architecture. USB controllers (and their ports) on most PCs can only work in host mode and cannot simulate a device.

That is the reason that you cannot network computers through USB without a special cable with specialised electronics.

The only exception is if you somehow have a PC that supports the USB On-The-Go standard that allows for a USB port to act in both host and device mode. USB-OTG devices do exist, but they are usually embedded devices (smartphones etc). I don't know if there is a way to add a USB-OTG port to a commodity PC.

EDIT:

If you do not need a keyboard before the OS on PC-2 boots, you might be able to use a pair of USB Bluetooth dongles - one on each PC. You'd have to use specialised software on PC-1, but it is definitely possible - I've already seen a possible implementation on Linux, and I am reasonably certain that there must be one for Windows. You will also need Bluetooth HID drivers on PC-2, if they are not already installed.

On a different note, have you considered a purely software/network solution such as TightVNC?

s3v3n
  • 8,203
  • 5
  • 42
  • 56
thkala
  • 84,049
  • 23
  • 157
  • 201
  • Thank you for your reponse. So i will have to use something similar to this : http://www.usbgear.com/link/index.html. – Lucas Jan 16 '11 at 18:23
  • @Lucas: I don't think that will help. You need to send low-level USB packets, which that device will not be able to pass-through - its electronics are designed for transfering data. BTW, despite whatever is mentioned in its description, it's not really driverless. All it means is that it includes a small flash drive with the drivers and it does not need a separate CD. Windows do not have drivers for such devices. – thkala Jan 16 '11 at 18:35
  • Ok that's what I suspected. Could i use some kind of device between the two PC ? PC-1 would send low-level USB packets to this device which would send it to PC-2. – Lucas Jan 16 '11 at 18:53
  • @Lucas: what exactly are you trying to do? Depending on the available resources (OS etc), you could e.g. use a pair of USB bluetooth dongles provide keyboard input for PC-2. – thkala Jan 16 '11 at 18:57
  • I would like to create a virtual keyboard for tablets but I need to execute some testing before. Both PC run under Windows 7. I'm gonna learn more about those bluetooth dongles, thanks. – Lucas Jan 16 '11 at 19:18
  • Ok I will look for that windows soft. TightVNC wouldn't solve my problem because the idea behind my experimentation is to have a link between two computers in a way that PC-2 would detect PC-1 input as a regular keyboard input. This will allow me to have a virtual keyboard (on pc-1) and run a lot of debugging tests. – Lucas Jan 16 '11 at 20:07
3

There is a solution:

https://github.com/Flowm/etherkey

This uses a network connection from your computer to the raspi which is connected to a teensy (usb developer board) to send the key strokes.

This solution is not an out-of-the-box product. The required skill is similar to programming some other devices like arduino. But it's a complete and working setup.

bebbo
  • 2,830
  • 1
  • 32
  • 37
0

SEARCH THIS PROGRAM:

TWedge: Keyboard Wedge Software (RS232, Serial, TCP, Bluetooth)

then, MAKE YOUR OWN CONNECTION CABLE WITH:

(usb <-> rs232) + (NULL MODEM) + (rs232 <-> usb)

Connect 2 computer, write your own program to send signal to your (usb <-> rs232) unit, then you can control another computer under the help of TWedge.

Andre Silva
  • 4,782
  • 9
  • 52
  • 65
0

The above mentionned https://github.com/Flowm/etherkey is one way. The keyboard is emulated from an rPi, but the principle can be used from PC to PC (or Mac to Whatever). The core answer to your question is to use an OTG-capable chip, and then you control this chip via a USB-serial adapter.

https://euer.krebsco.de/a-software-kvm-switch.html uses a very similar method, using an Arduino instead of the Teensy.

The generic answer is: you need an OTG capable, or slave capable device: Arduino, Teensy, Pi 0 (either from Rapberry or Orange brands, both work; only the ZERO models are OTG capable), or, an rPi-A with heavy customisation (since it does not include USB hub, it can theoretically be converted into a slave; never found any public tutorial to do it), or any smartphone (Samsung, Nokia, HTC, Oukitel ... most smartphones are OTG capable). If you go for a Pi or a phone, then, you want to dig around USB Gadget. Cheaper solutions (Arduino/Teensy) need custom firmware.

0

The cheapest options are commercial microcontrollers (eg arduino platform, pic, etc) or ready built usb keyboard controllers (eg i-pac, arcade controllers,etc)

Yehonatan
  • 1,172
  • 2
  • 11
  • 21