fuchsia.hardware.power.source

Added: HEAD

PROTOCOLS

Source

Defined in fuchsia.hardware.power.source/source.fidl

GetSpec

Returns static hardware characteristics that do not change during operation.

Request

<EMPTY>

Response

NameType
payload Source_GetSpec_Result

GetStatus

Returns dynamic status of the source immediately.

Request

<EMPTY>

Response

NameType
payload Source_GetStatus_Result

SetRole

Set the role of this specific node.

Errors:

  • INVALID_ARGS: If the provided role is invalid.
  • NOT_SUPPORTED: If the requested role is not supported by the hardware.
  • INTERNAL: If an unexpected error occurred.

Request

NameType
role Role

Response

NameType
payload Source_SetRole_Result

Watch

Change notification for power source state using a "hanging-get" pattern.

The first call to this method returns the current hardware state immediately. Subsequent calls block until a change occurs that matches the provided masks.

At most one Watch call may be outstanding at a time per connection. Completing a call acknowledges that the client has received the previous update.

Power Management and Suspend

To prevent lost wakeups, the server (driver) must ensure that the Watch call remains active (and hardware interrupts armed) while the system is suspended.

  • Interest Triggers: If a change in the interest mask occurs while the system is suspended, the server MUST NOT complete the Watch call until the system wakes for another reason (e.g., a wake_on event or external trigger). This ensures the CPU remains asleep for non-critical updates.
  • Wake-On Triggers: If a change in the wake_on mask occurs, the server MUST wake the system and complete the call immediately with a wake_lease.

As a result of this queuing behavior, if multiple changes occur while the system is suspended, they may be merged into a single returned status table, and intermediate state transitions may be lost.

  • interest: The client wants to be notified if any of the fields present in this table change. If any field in interest changes, the method returns.
  • wake_on: Similar to interest, but if a change occurs in these fields, the server will attempt to keep the system awake using the provided lease (or by returning a wake_lease) until the client acknowledges the update.
  • lease: A power lease token used to coordinate handoff between the server and client, ensuring the system does not suspend before the client can process a critical power event.

Returns:

  • status: The updated status table containing the fields that changed.
  • wake_lease: An optional lease token provided if the change triggered a wake_on condition and the server is maintaining system state.

Request

NameType
interest Status
wake_on Status
lease fuchsia.power.system/LeaseToken

Response

NameType
payload Source_Watch_Result

STRUCTS

Source_GetSpec_Response

Defined in fuchsia.hardware.power.source/source.fidl

FieldTypeDescriptionDefault
spec Spec No default

Source_GetStatus_Response

Defined in fuchsia.hardware.power.source/source.fidl

FieldTypeDescriptionDefault
status Status No default

Source_SetRole_Response

Defined in fuchsia.hardware.power.source/source.fidl

<EMPTY>

Source_Watch_Response resource

Defined in fuchsia.hardware.power.source/source.fidl

FieldTypeDescriptionDefault
status Status No default
wake_lease fuchsia.power.system/LeaseToken No default

ENUMS

Error flexible

Type: uint32

Defined in fuchsia.hardware.power.source/source.fidl

General errors returned by power source protocols.

NameValueDescription
1

An unexpected error occurred within the driver or service.

2

The requested operation or field is not supported by this hardware.

3

One or more arguments provided to the method were invalid.

SourceType flexible

Type: uint32

Defined in fuchsia.hardware.power.source/source.fidl

The type of power source connected to the device.

NameValueDescription
1

Standard wall-plug or DC barrel-jack power. Typically uses the base fuchsia.hardware.power.source/Source protocol.

2

Internal or external chemical battery. See fuchsia.hardware.power.battery/Battery.

3

Power supplied over a USB connection. See fuchsia.hardware.power.usb/UsbSource.

TABLES

Auto

Defined in fuchsia.hardware.power.source/source.fidl

OrdinalFieldTypeDescription

Disconnected

Defined in fuchsia.hardware.power.source/source.fidl

OrdinalFieldTypeDescription

SinkRole

Defined in fuchsia.hardware.power.source/source.fidl

OrdinalFieldTypeDescription
name string

Name of the source it's drawing from.

type SourceType

What type of source it's drawing from.

SourceRole

Defined in fuchsia.hardware.power.source/source.fidl

OrdinalFieldTypeDescription

Spec

Defined in fuchsia.hardware.power.source/source.fidl

Static hardware characteristics of a power source.

OrdinalFieldTypeDescription
name string

Unique name of the source (e.g., "USB-C", "Main Battery").

supported_roles vector<Role>

The roles this source is capable of performing.

manufacturer string

The name of the manufacturer of this hardware.

model_name string

The model name or number assigned by the manufacturer.

type SourceType

The category of this power entity.

Status

Defined in fuchsia.hardware.power.source/source.fidl

Dynamic status of a power source.

OrdinalFieldTypeDescription
present bool

Whether the power entity is currently physically present.

voltage_uv uint32

The voltage at the node, in microvolts.

current_ua int32

The current flowing at the node, in microamps. Positive means flowing out (if Source) or in (if Sink).

current_role Role

The role the node is currently performing.

UNIONS

Role flexible

Defined in fuchsia.hardware.power.source/source.fidl

The role a power node plays in the system.

OrdinalVariantTypeDescription
disconnected Disconnected

The node is disconnected or isolated from the power system.

source SourceRole

The node provides energy to the common system bus.

sink SinkRole

The node consumes or stores energy from the common bus.

auto Auto

The hardware automatically decides the role based on physical detection.

Source_GetSpec_Result strict

Defined in fuchsia.hardware.power.source/source.fidl

OrdinalVariantTypeDescription
response Source_GetSpec_Response
err Error
framework_err internal

Source_GetStatus_Result strict

Defined in fuchsia.hardware.power.source/source.fidl

OrdinalVariantTypeDescription
response Source_GetStatus_Response
err Error
framework_err internal

Source_SetRole_Result strict

Defined in fuchsia.hardware.power.source/source.fidl

OrdinalVariantTypeDescription
response Source_SetRole_Response
err Error
framework_err internal

Source_Watch_Result strict resource

Defined in fuchsia.hardware.power.source/source.fidl

OrdinalVariantTypeDescription
response Source_Watch_Response
framework_err internal

SERVICES

Service

Defined in fuchsia.hardware.power.source/source.fidl

NameTypeTransport
source fuchsia.hardware.power.source/Source Channel