I'm planning to build a device using either a Raspberry Pi A or Radxa board with the aim of emulating a slave device (unified keyboard and mouse) via commands sent by the board (possibly by a slave device to the board? or a network protocol). As I understand from the specifications of the two boards, there are USB OTG ports that allow for acting as a slave device, however from my knowledge, USB OTG only allows a fixed set of functions as a slave device. Is it possible to make the specific USB port I wish to perform emulation from slave-only considering it is an OTG port? Also, how do I handle driver recognition in this case? Where is the firmware embedded for USB OTG?

  • \$\begingroup\$ I think you misunderstood USB OTG. OTG is slave to slave connection and slave emulates host. \$\endgroup\$
    – ylem
    Commented Oct 5, 2014 at 12:09
  • \$\begingroup\$ OTG is when a device which is normally a slave becomes a (limited function) master. Do you just want to build a slave device (a composite keyboard / mouse)? \$\endgroup\$
    – brhans
    Commented Oct 6, 2014 at 3:13
  • \$\begingroup\$ @user1448742 Hello, thank you for the answers. Yes, I appears I've misunderstood that USB OTG is not a host emulating a slave but rather the other way around. \$\endgroup\$
    – Bryan C
    Commented Oct 23, 2014 at 6:59
  • \$\begingroup\$ @brhans I want to build an interface that will allow output from one slave device to "pass through" the interface to output on the other end, as a slave device input. The idea may sound stupid (why don't just use a USB extension cable?) but there is a very real reason for this. The interface must thus be able to a) accept input from a slave device, and at the same time b) emulate this output as though it as a slave device. I may have found a means to do this via software, but how do I implement slave device firmware on the interface device for the host to recognise? OTG seems to be limited... \$\endgroup\$
    – Bryan C
    Commented Oct 23, 2014 at 7:03

1 Answer 1


Ok, so you need a device with at least 2 USB ports. One of these must be a slave port which you will connect to a host PC and the other port must be a host which you will connect a keyboard/mouse/whatever. Your device will then enumerate and handle the slave device(s) on its host port, process any information and/or events from these devices, and then forward this data out of its slave port up to the host PC. So to answer your question simply: yes this is possible.

But, I don't think its going to be possible with either of the boards you're looking at. The one half would be fairly straightforward. These boards would be quite happy using one of their USB ports to talk to your keyboard/mouse device(s). The problem comes about when you want to use them to emulate a particular type of slave device to your host PC. These kind of boards are typically configured to provide a very limited selection of USB profiles to choose from when connecting them to a PC (such as a mass-storage device, serial port emulation, camera or possibly some kind of debugging interface) and you'd find it quite difficult to change this to look like something else - in your case a HID device like a keyboard and/or mouse. I'm not saying its impossible, but I don't know enough about these boards and its not obvious from their simple overviews that they support this.

This is the kind of application where you will probably need to work at a lower level - more directly with the firmware on a suitable microcontroller or microprocessor.

If I were to try to pull something like this off, I'd be inclined to set up a pair of microcontrollers back-to-back. One of them is the USB OTG host to your keyboard/mouse, the other one acts as a keyboard/mouse compound device to your host PC, and they're connected to each other using SPI.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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