26

I want to use one PC as a USB keyboard for another PC. It has to be indistinguishable from actual USB keyboard. How can I achieve this?

A solution that works with any of Ubuntu Linux 14 and above, OS X 10.11 or Windows 10 would be acceptable. Should work with USB 2.0 or 3.0.

EDIT: the machine to receive the input should not require any specific software installed or network access. I need to use a physical USB cable and the destination machine should react as if a physical keyboard is present on that USB port.

7
  • it is about: computer software and i'm not asking about a product / service / learning material recommendation
    – miguelv
    Commented Sep 26, 2016 at 11:10
  • 1
    I have reworded your question so that it doesn't sound like software recommendation question.
    – gronostaj
    Commented Sep 26, 2016 at 11:11
  • 2
    I acknowledge the low quality and have made the edits, but those are not the points you raised in the first place. And frankly I'm a bit disappointed at the community since I've had to jump from Stack Exchange community to community and always getting dismissed as off-topic or as too generic of a problem and very little constructive effort from anyone except @gronostaj being put in to help me solve a genuine problem that should have a well known solution IMO.
    – miguelv
    Commented Sep 26, 2016 at 11:23
  • 5
    The question is very clear to me, and I agree it should have better answers. Imagine you have a machine you can't change the software on, but it does have a USB keyboard. You want to automate some typing by using another computer to simulate a USB keyboard device. Surely there are existing devices for this. Commented Mar 19, 2019 at 1:09
  • 2
    @GregChabala I think good example of such machine you can't change the software on, but it does have a USB keyboard is "6dot Braille Label Maker". To print labels on it you need to use keyboard (USB or built-in one).
    – Karol Zlot
    Commented Jun 17, 2023 at 14:04

9 Answers 9

14

You could use a Raspberry Pi Zero in USB gadget mode. In this mode, the Raspberry Pi can behave as many standard USB devices (keyboard, mouse, mass storage, etc.) and you will then be able to e.g. "inject" keystrokes from a program running on the Pi (and you can then control this program remotely as you see fit).

The Raspberry Pi Zero is not the only device allowing this; but it's cheap, it's easy to get one, and there are many documentations out there explaining how to do this, so it's (IMHO) a pretty good starting point for a project like this!

1
  • OP didn't tell us WHY he needs the solution, that would help. IMMA Guess if what he wants is remote control of that computer, TInyPilot off the shelf $300 in 2024 and PiKVM Hat + a PI and some work for less than $200.
    – FastAl
    Commented Mar 15 at 15:38
5

I have had success with etherkey, a Teensy and a UART to USB bridge.

The host computer sends commands to the Teensy through the UART bridge. The Teensy pretends it is a keyboard and presses virtual buttons on the other PC. Etherkey is the software that runs on the Teensy and forwards keys from the host computer to the virtual keyboard.

The destination computer detected the new "keyboard" immediately and didn't need any setup.

Edit: I also got Etherkey running on a ATmega32u4 development board, which is more easily available and cheaper than the Teensy.

1
  • 1
    This is perhaps the closest thing to answering the question so far. The question, as clarified in the comments below it, is asking for a software solution. This answer requires buying hardware, but nothing too expensive, and doesn't require a soldering iron like some answers. In looking at the Teensy documentation I'm concerned it does not follow the USB standard strictly and so might not be detected by a all computers as a keyboard. In the years since the question was asked USB-C has become more common and should remove the need for any hardware beyond a passive cable.
    – MacGuffin
    Commented Feb 10, 2022 at 6:45
4

I eventually found a hardware device to do this on AliExpress. That makes it a bit of a black box, though I suspect internally it operates much like in the answer from Sjoerd.

The USB end of the device appears as a HID keyboard to the host, and I can connect to the serial end from another computer and send it characters which will then be 'typed'. There are some special patterns to allow modifier keys. If the sending computer doesn't have a real serial port, a common USB-Serial adapter can be used with this as well, though that makes it harder to tell which end is pretending to be the keyboard.

This was by far the cheapest solution I've found, ~$10 USD, compared to other products I've seen listed around $100 or more. If I needed more and the AliExpress product disappeared, I would try the Teensy solution.

enter image description here

3

You can use usbip to make USB devices (including a keyboard) on a host computer available as USB devices on a client computer over the network. As it's a USB device, it will be indistinguishable from any USB device attached locally.

Clients exist for Windows, and usbip has been a standard part of the kernel for a long time. Under Debian and Ubuntu, the usbip package contains the programs to set up and control such a connection.

Details on how to set it up can be easily googled, e.g. here

Similar questions:

5
  • 6
    Appreciate your response, but what I was going for involved an actual physical USB cable and should not require installing software on the machine where that I want to send the input to.
    – miguelv
    Commented Sep 26, 2016 at 15:30
  • 1
    @miguelv: You need USB device hardware in order to be seen as a keyboard device. No amount of software will cause a USB host port to act as a device.
    – Ben Voigt
    Commented Sep 26, 2016 at 16:07
  • Huh. What is the reason you don't just unplug the USB keyboard from the one PC, and plug it into the other PC? They are apparently close enough to put a cable between them. In other words, what's the actual problem you want to solve?
    – dirkt
    Commented Sep 26, 2016 at 17:14
  • And to add to @BenVoigt, finding any sort of hardware for a PC that's going to act as an USB client (no matter if it's USB OTG or not) will be damned difficult.
    – dirkt
    Commented Sep 26, 2016 at 17:15
  • Apple computers with USB-C ports support target disk mode by USB. This existed since 2015. It would not have been difficult to find in late 2016, Apple sold plenty of computers with the ability to act as a client USB device by then. It was perhaps expensive but not difficult. Inspection of Apple hardware shows they used fairly common USB controllers, nothing unusual but the software that enabled the computer to act like a USB client device.
    – MacGuffin
    Commented Feb 12, 2022 at 21:00
1

Given the time between the OP and now, this may be moot. However, for any others with a similar question, I propose the following solution:

  1. Buy a cheap usb keyboard, the ones that are like $5 to $20 or so.
  2. Disassemble it and take the controller and usb plug section, then wire-up your "controller" to the contact connections intended for the keyboard matrix. (It goes without saying, that soldering will be required.)
  3. Map out the pins either by examining the contact matrix, or by program.
  4. Craft your control program using the mapping.
  5. Set your program to load and run OnBoot and off you go!

The control program can be written in any language with that supports the manner of output that will control the "key" matrix inputs of the keyboard controller, and the usb end plug, plugs into the target computer as a usb keyboard as desired.

If using a Linux based OS, Python is likely your language of choice. If using a Windows based OS, .Net is likely your language of choice (specific flavor C#, VB is up to you). It's likely even Node.js or PHP could be used if you can control GPIO or Parallel port pins.

Happy Hacking!

1
  • I think your answer shouldn't be downvoted. This answers question even if it's a lot of effort and better answer is possible.
    – Karol Zlot
    Commented Jun 17, 2023 at 14:11
1

Use Logitech Unifying USB receiver and emulate virtual keyboard with this: https://github.com/RoganDawes/LOGITacker

Should be about $20 total.

1
  • That software appears to use the Logitech receiver but the transmitter is a different product. The controlled computer would have the Logitech receiver but the controlling computer would have hardware from someplace else. This looks like an incomplete answer but still very close to the intended goal of the question asked.
    – MacGuffin
    Commented Feb 10, 2022 at 6:57
1

I'm facing the same situation (specific scenario: I need to unlock my workstation remotely from the PRE-OS BitLocker screen). I've ordered the following HW, so I'm posting this to share my research, but not my experiences

The 'source' computer has the following:

This should provide the source machine the same functionality as this $500 USB all-in-one.


The 'target' computer has the following:

  • HDMI splitter so I can still have console when I'm at the computer. Lower-end devices can be found on AMZN for $15 USD.

Total cost will be ( $20 + $90 + $15 ) * 2 = $250 USD so each computer in the pair can monitor and manage the other machine from POST to OS fully online (run level 5).

Wish me luck getting my admin to approve this expense!

1
  • Might be cheaper for anybody stumbling on this - TInyPilot off the shelf $300 in 2024 and PiKVM Hat + a PI and some work for less than $200.
    – FastAl
    Commented Mar 15 at 15:38
0

One possible solution is to add a Bluetooth dongle to the target PC, and emulate a Bluetooth keyboard from the host PC.

1
  • I don't know if I tried that specific MacOS Bluetooth keyboard emulator app or something else but I recall the delay being so annoying that it would be unusable for anything but a very last resort. Your mileage may vary. Also, this does not meet the requirement of emulating a USB keyboard, it emulates a Bluetooth keyboard. It appears the original question was edited to add this detail so it may have been a correct answer at the time it was posted.
    – MacGuffin
    Commented Oct 7, 2022 at 3:04
0

I have the same issue, and I spotted the pikvm hardware solution which may fix the issue for you indirectly, however for my budget I was looking for something much less costly. I am still searching.

1

You must log in to answer this question.

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