Package: android.hardware.usb@1.0

types

Properties

Status

enum Status: uint32_t
Details
Members
SUCCESS = 0
ERROR = 1
error value when the HAL operation fails for reasons not listed here.
INVALID_ARGUMENT = 2
error value returned when input argument is invalid.
UNRECOGNIZED_ROLE = 3
error value returned when role string is unrecognized.

PortRoleType

enum PortRoleType: uint32_t

Denotes the Port role type.Passed as an argument for functions used to query or change port roles.

Details
Members
DATA_ROLE = 0
Denotes the data role of the port.The port can either be a "host" or a "device" for data.This maps to the PortDataRole enum.
POWER_ROLE = 1
Denotes the power role of the port.The port can either be a "source" or "sink" for power.This maps to PortPowerRole enum.
MODE = 2
USB ports can be a pure DFP port which can only act as a host.A UFP port which can only act as a device.Or a dual role ports which can either can as a host or a device.This property is used to mention them.

PortDataRole

enum PortDataRole: uint32_t
Details
Members
NONE = 0
Indicates that the port does not have a data role.In case of DRP, the current data role of the port is only resolved when the type-c handshake happens.
HOST = 1
Indicates that the port is acting as a host for data.
DEVICE = 2
Indicated that the port is acting as a device for data.
NUM_DATA_ROLES = 3
Annotations
export

PortPowerRole

enum PortPowerRole: uint32_t
Details
Members
NONE = 0
Indicates that the port does not have a power role.In case of DRP, the current power role of the port is only resolved when the type-c handshake happens.
SOURCE = 1
Indicates that the port is supplying power to the other port.
SINK = 2
Indicates that the port is sinking power from the other port.
NUM_POWER_ROLES = 3
Annotations
export

PortMode

enum PortMode: uint32_t
Details
Members
NONE = 0
Indicates that the port does not have a mode.In case of DRP, the current mode of the port is only resolved when the type-c handshake happens.
UFP = 1
Indicates that port can only act as device for data and sink for power.
DFP = 2
Indicates the port can only act as host for data and source for power.
DRP = 3
Indicates can either act as UFP or DFP at a given point of time.
NUM_MODES = 4
Annotations
export

PortRole

struct PortRole {PortRoleType type; uint32_t role}

Used as a container to send port role information.

Details
Members
type
Indicates the type of Port Role.Maps to the PortRoleType enum.
role
when type is HAL_USB_DATA_ROLE pass values from enum PortDataRole.when type is HAL_USB_POWER_ROLE pass values from enum PortPowerRole.when type is HAL_USB_MODE pass values from enum PortMode.

PortStatus

struct PortStatus {string portName; PortDataRole currentDataRole; PortPowerRole currentPowerRole; PortMode currentMode; bool canChangeMode; bool canChangeDataRole; bool canChangePowerRole; PortMode supportedModes}

Used as the container to report data back to the caller.Represents the current connection status of a single USB port.

Details
Members
portName
Name of the port.Used as the port's id by the caller.
currentDataRole
Data role of the port.
currentPowerRole
Power Role of thte port.
currentMode
Mode in which the port is connected.Can be UFP or DFP.
canChangeMode
True indicates that the port's mode can be changed.False otherwise.
canChangeDataRole
True indicates that the port's data role can be changed.False otherwise.For example, true if Type-C PD PD_SWAP is supported.
canChangePowerRole
True indicates that the port's power role can be changed.False otherwise.For example, true if Type-C PD PR_SWAP is supported.
supportedModes
Identifies the type of the local port.
UFP - Indicates that port can only act as device for data and sink for power.DFP - Indicates the port can only act as host for data and source for power.DRP - Indicates can either act as UFP or DFP at a given point of time.