13

Does the Raspberry Pi model B+ have the capabilities of acting as a Human Interface Device (HID) with no extra hardware (other than a USB to USB cable)?

I saw this question but it was about capturing output from the computer. My goal would be to trick a computer into thinking a mouse/keyboard is attached and send key presses or mouse clicks. Any ideas?

0

2 Answers 2

7

Even though the USB port of the RPi is technically an On-the-go (OTG) chip that should support both a reduced set of host and client functionality (and could therefore play the role of an USB slave such as an HID) the B/B+ type of the RPi does not support the device mode. That is related to the included USB hub and the fact that the ethernet is tunneled through USB (see).

But... the Human Interface Devices (HID) only need the USB 1.1 Low Speed with 1.5 MBit/s data rate (well almost they say). So there are many solutions out there that use software based USB stacks to emulate an USB device. Those examples typically use microcontrollers that are way less "powerful" than the RaspberryPi (but of course they also have a significantly lower overhead). Examples include the Igor Plug (an IR remote control receiver based on an Atmel microcontroller) or microcontroller based "fake" keyboards or "key loggers".

If we believe How fast is GPIO+DMA? Multi I2S input then 1.5 MBit/s should be possible on the GPIO with DMA.

2
  • 2
    Somewhere the other day I saw a reference to promotional USB keys which do this -- you plug them in and, e.g., they start your web browser and take you to a specific page by emulating the keyboard events required. They register themselves as keyboards, not flash drives.
    – goldilocks
    Commented Jun 4, 2015 at 13:54
  • @goldilocks I hope this is it: hakshop.com/products/usb-rubber-ducky-deluxe Commented Dec 26, 2016 at 11:24
0

This can be done with ANY kind of Pi

The least-expensive solution is to use the Pi Zero.

The text of this link is way too long to post here, but the Zero can be any kind of HID. Keyboard, mouse, flash drive, camera, whatever you can think of.

Turning your Raspberry PI Zero into a USB Gadget

enter image description here

Making it a keyboard or mouse is easy.

4
  • This is also discussed here: raspberrypi.stackexchange.com/questions/43948/…
    – SDsolar
    Commented May 19, 2017 at 7:35
  • 3
    -1. Not only is your answer worthless for the OP who specifically asked about model B, but you also have edited the question so that it matches your answer better. Commented May 19, 2017 at 12:29
  • No, that wasn't me that did the title. It was done to link it to the duplicate. But in the end this is better because it can work with ANY KIND OF PI - EVEN THE $5 ONE.
    – SDsolar
    Commented Apr 5, 2018 at 2:04
  • 3
    Where did you find the "ANY" kind of pi ? In my researches I found "ONLY PI Zero", no other kind of Pi Commented Sep 16, 2019 at 8:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.