Using BeagleBoneBlack to emulate USB keyboard?


I have an old BeagleBone Black (A5A, 2GB version), and I would like to
use it to emulate an external USB keyboard. I was thinking... I would
SSH into BBB and run some commands to send keymap data to PC through
    - either mini-USB port
    - or debug serial-to-USB cable.
As far as PC is concerned, it's receiving key presses.

Is this possible?
Where can I start my reading?

Yes, it is possible.

As far as where to start leaning ? Well, you need to learn libusb, and about the USB HID protocol. Passed that, you’re going to have to figure out how to write a Windows USB HID driver, prorbably also using libusb . . . It’s a fairly complex subject that I also personally did some reading on, but never finished.

err, yeah oops. Where ? Use google and keywords “USB HID protocol”, “libusb”, and just start reading everything you can find.

There may be a quick and dirty shortcut to avoid going down the “gotta learn the low-level details of usb” rabbit hole. You can use a usb gadget to make the mini usb port appear as a serial port to your BBB software. Took about 2 lines of bash if I recall. Sorry, I don’t have the details handy at the moment, I did this a while back. I think I got this from Jan Axelrod, maybe even on her website. If not, then her USB complete book.

Linux Gadget Drivers + BeagleBone hardware should allow you to emulate a USB keyboard.

If you are emulating a keyboard, no PC driver is needed.


I did a talk about how to do this at DEFCON this year. One device to pwn them all. Files you need here

So Phil . . . if you’re going to send files to others on the group, you may want to leave out files such as “” . . .heh ! :wink:

SO, the companion slides to go with those files: related material starts at page 22.

Great job Phil. I did not realize creating a faux USB HID device was so easy. Well, “easy” when one lays out in great detail how it’s done :wink:

Thank you. It’s been bookmarked and downloaded. I’ll start reading. I’m encouraged by the fact that you can script this.

Hello Phil,
I try executing your script would you have information on what to do if /sys/kernel/config is not available, I did search on google with no success