This document describes the On-The-Go (OTG) states and state transitions that occur on a Symbian platform device.
It is important for your USB control application to keep a constant watch over the OTG state of the device it is running on. For information about how to make your control application do this, see Monitoring the phone's USB host/OTG state.
This document provides supplementary information about each of the possible states and suggests something of their practical significance for the USB control application.
The main OTG states that your USB control application will see are defined in the Enum TUsbOtgState. They are published (by USB Manager) by means of the KUsbOtgStateProperty publish-and-subscribe key. The USB control application needs to monitor this property constantly (see Monitoring the phone's USB host/OTG state).
The states are as follows:
A-idle (EUsbOtgStateAIdle)
In this state the Symbian platform device is an A-device in an idle state, and VBus is down.
Appropriate behaviour for the USB control application is to listen for:
incoming SRP received events from USB Manager (see Monitoring requests for the phone to become a USB host ).
session request events from USB Manager (see Monitoring requests for the phone to become a USB host ).
A-host (EUsbOtgStateAHost)
In this state the Symbian platform device is an A-device that is acting as host and powering VBus.
Appropriate behaviour for the USB control application is to watch for when the USB connection goes idle, so that it knows when to drop VBus. For information about how to make the control application do this, see Monitoring whether the phone's bus connection is idle or busy.
For information about dropping VBus, see Dropping VBus.
A-peripheral (EUsbOtgStateAPeripheral)
In this state the Symbian platform device is an A-device that is in peripheral mode (but is powering VBus).
Appropriate behaviour for the USB control application is simply to watch the KUsbOtgStateProperty publish-and-subscribe key for when the state changes again to A-host (see above).
A-VBus-error (EUsbOtgStateAVBusError)
In this state the Symbian platform device is an A-device and a B-device has drawn too much power from it; the result is that the A-device cannot maintain the voltage on VBus that is required to indicate its presence to the B-device.
When the Symbian platform device is in this state, therefore, the USB control application needs to call RUsb::BusClearError() to bring VBus down and restore the A-device to an A-idle state (see The OTG state transitions).
You must also display a message telling the phone's user to remove the offending device from the phone.
B-idle (EUsbOtgStateBIdle)
In this state the Symbian platform device is a B-device but VBus is not currently being powered by the A-device (or there is no A-device attached).
Appropriate behaviour for the USB control application is to:
monitor for VBus coming up again (see Monitoring whether VBus is powered ) and then to attempt to start USB services (see Starting USB services ).
monitor for session requests from local applications (see Monitoring requests for the phone to become a USB host ), and to try to take on the host role by calling RUsb::BusRequest() if a session request is detected.
B-peripheral (EUsbOtgStateBPeripheral)
In this state the Symbian platform device is a B-device acting as a peripheral and VBus is being powered (by the A-device).
Appropriate behaviour for the USB control application is to monitor for session requests from local applications (see Monitoring requests for the phone to become a USB host ), and to try to take on the host role by calling RUsb::BusRequest() if a session request is detected.
B-host (EUsbOtgStateBHost)
In this state the Symbian platform device is a B-device acting as a USB host; the Function Drivers are in control.
Appropriate behaviour for the USB control application is simply to monitor the OTG state (see Monitoring the phone's USB host/OTG state to see when the device returns to a B-peripheral state (see above).