Support for USB On-The-Go (OTG)

The usblauncher service supports USB OTG by allowing role-swapping of the USB stack. This way, the target system can act sometimes as the host and sometimes as the slave device in a USB link.

Our usblauncher implementation does not support any OTG communication protocols designed to detect device attachments (ADP), manage power on a USB link (SRP), or negotiate the roles of two devices sharing a USB link (HNP). Instead, usblauncher offers software support for OTG by allowing client applications running on the target system to swap roles with devices at the other end of a USB link (i.e., a one-to-one connection). To do this, applications can instruct usblauncher to restart the USB stack in a different mode (i.e., host or device).

A client application must monitor the USB bus and other hardware to determine which mode the target system should enter into. When the application knows this, it can issue the start_stack command through PPS to the device control object. When requesting that the stack run in device mode, the application can specify a USB personality to expose to the USB host at the other end of the connection. The usblauncher service will then launch the appropriate drivers for the specified personality.

Consider the following scenario, in which an application running on a computer detects hardware events and responds by changing the role of the USB stack:

  1. The user inserts a cable into a port on the target system

    The application detects the cable attachment and tells usblauncher to start the USB stack in device mode by sending the start_stack::device,n command to the device control object. Here, n is a number indicating the set of USB descriptors that usblauncher should expose to the USB host at the other end of the connection.

  2. The user removes the cable

    The application detects the cable removal and instructs usblauncher to slay the USB stack by issuing the start_stack::none command to the same PPS object.

  3. The user plugs a USB stick into the target

    The application detects the USB stick and tells usblauncher to start the USB stack in host mode by issuing the start_stack::host command to the device control object. This way, the computer can manage the USB link and download data from the USB stick as needed.