How to send keystrokes from one computer to another by USB?
Asked Answered
D

6

14

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.

Daves answered 16/1, 2011 at 17:24 Comment(5)
You need specialized hardware which starts around 30$Reading
@Yehonatan: would you mind supplying a link for an example of such hardware?Hasp
BTW, what OS (if any) is used on each PC. And what exactly are you trying to do?Hasp
related https://mcmap.net/q/830968/-how-to-establish-adb-connection-over-usb-between-two-pcs-closed/1778421Sunstroke
Related on Super User.Nephridium
H
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?

Hasp answered 16/1, 2011 at 17:48 Comment(6)
Thank you for your reponse. So i will have to use something similar to this : usbgear.com/link/index.html.Daves
@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.Hasp
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.Daves
@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.Hasp
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.Daves
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.Daves
G
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.

Gave answered 20/9, 2017 at 18:14 Comment(0)
R
0

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

Reading answered 25/1, 2011 at 5:51 Comment(0)
E
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.

Erinn answered 25/12, 2013 at 17:53 Comment(2)
Not usable if he wants to controle his BIOS.Scever
@Benoit-PierreDEMAINE Why not? The software is on the sending computer, not the receiving computer. The software on the sending computer has software that captures keyboard and/or mouse when it's the active window. The receiving computer just receives plain old HID that is compatible with BIOS and any OS as it's driverless. It just behaves as any other keyboard.Sclerosed
S
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.

Scever answered 27/10, 2017 at 17:16 Comment(0)
K
0

I ended up with a similar problem and I do not have an external usb keyboard and Bluetooth one does not work at startup. I was stuck at tpm promt. I had a Razer Basilisk mouse and it has macro functionality.

I assigned f12 to one of the keys and was able to pass successfully.

Kafir answered 28/12, 2023 at 16:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.