PROTOCOLS
Source
Defined in fuchsia.hardware.power.source/source.fidl
GetSpec
Returns static hardware characteristics that do not change during operation.
Request
<EMPTY>
Response
| Name | Type |
|---|---|
payload |
Source_GetSpec_Result
|
GetStatus
Returns dynamic status of the source immediately.
Request
<EMPTY>
Response
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
role |
Role
|
Response
| Name | Type |
|---|---|
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
interestmask occurs while the system is suspended, the server MUST NOT complete theWatchcall until the system wakes for another reason (e.g., awake_onevent or external trigger). This ensures the CPU remains asleep for non-critical updates. - Wake-On Triggers: If a change in the
wake_onmask occurs, the server MUST wake the system and complete the call immediately with awake_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 ininterestchanges, the method returns.wake_on: Similar tointerest, but if a change occurs in these fields, the server will attempt to keep the system awake using the providedlease(or by returning awake_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 awake_oncondition and the server is maintaining system state.
Request
| Name | Type |
|---|---|
interest |
Status
|
wake_on |
Status
|
lease |
fuchsia.power.system/LeaseToken
|
Response
| Name | Type |
|---|---|
payload |
Source_Watch_Result
|
STRUCTS
Source_GetSpec_Response
Defined in fuchsia.hardware.power.source/source.fidl
| Field | Type | Description | Default |
|---|---|---|---|
spec |
Spec
|
No default |
Source_GetStatus_Response
Defined in fuchsia.hardware.power.source/source.fidl
| Field | Type | Description | Default |
|---|---|---|---|
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
| Field | Type | Description | Default |
|---|---|---|---|
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.
| Name | Value | Description |
|---|---|---|
INTERNAL |
1 |
An unexpected error occurred within the driver or service. |
NOT_SUPPORTED |
2 |
The requested operation or field is not supported by this hardware. |
INVALID_ARGS |
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.
| Name | Value | Description |
|---|---|---|
AC |
1 |
Standard wall-plug or DC barrel-jack power. Typically uses the base fuchsia.hardware.power.source/Source protocol. |
BATTERY |
2 |
Internal or external chemical battery. See fuchsia.hardware.power.battery/Battery. |
USB |
3 |
Power supplied over a USB connection. See fuchsia.hardware.power.usb/UsbSource. |
TABLES
Auto
Defined in fuchsia.hardware.power.source/source.fidl
| Ordinal | Field | Type | Description |
|---|
Disconnected
Defined in fuchsia.hardware.power.source/source.fidl
| Ordinal | Field | Type | Description |
|---|
SinkRole
Defined in fuchsia.hardware.power.source/source.fidl
| Ordinal | Field | Type | Description |
|---|---|---|---|
1 |
name |
string
|
Name of the source it's drawing from. |
2 |
type |
SourceType
|
What type of source it's drawing from. |
SourceRole
Defined in fuchsia.hardware.power.source/source.fidl
| Ordinal | Field | Type | Description |
|---|
Spec
Defined in fuchsia.hardware.power.source/source.fidl
Static hardware characteristics of a power source.
| Ordinal | Field | Type | Description |
|---|---|---|---|
1 |
name |
string
|
Unique name of the source (e.g., "USB-C", "Main Battery"). |
2 |
supported_roles |
vector<Role>
|
The roles this source is capable of performing. |
3 |
manufacturer |
string
|
The name of the manufacturer of this hardware. |
4 |
model_name |
string
|
The model name or number assigned by the manufacturer. |
5 |
type |
SourceType
|
The category of this power entity. |
Status
Defined in fuchsia.hardware.power.source/source.fidl
Dynamic status of a power source.
| Ordinal | Field | Type | Description |
|---|---|---|---|
1 |
present |
bool
|
Whether the power entity is currently physically present. |
2 |
voltage_uv |
uint32
|
The voltage at the node, in microvolts. |
3 |
current_ua |
int32
|
The current flowing at the node, in microamps. Positive means flowing out (if Source) or in (if Sink). |
4 |
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.
| Ordinal | Variant | Type | Description |
|---|---|---|---|
1 |
disconnected |
Disconnected
|
The node is disconnected or isolated from the power system. |
2 |
source |
SourceRole
|
The node provides energy to the common system bus. |
3 |
sink |
SinkRole
|
The node consumes or stores energy from the common bus. |
4 |
auto |
Auto
|
The hardware automatically decides the role based on physical detection. |
Source_GetSpec_Result strict
Defined in fuchsia.hardware.power.source/source.fidl
| Ordinal | Variant | Type | Description |
|---|---|---|---|
1 |
response |
Source_GetSpec_Response
|
|
2 |
err |
Error
|
|
3 |
framework_err |
internal
|
Source_GetStatus_Result strict
Defined in fuchsia.hardware.power.source/source.fidl
| Ordinal | Variant | Type | Description |
|---|---|---|---|
1 |
response |
Source_GetStatus_Response
|
|
2 |
err |
Error
|
|
3 |
framework_err |
internal
|
Source_SetRole_Result strict
Defined in fuchsia.hardware.power.source/source.fidl
| Ordinal | Variant | Type | Description |
|---|---|---|---|
1 |
response |
Source_SetRole_Response
|
|
2 |
err |
Error
|
|
3 |
framework_err |
internal
|
Source_Watch_Result strict resource
Defined in fuchsia.hardware.power.source/source.fidl
| Ordinal | Variant | Type | Description |
|---|---|---|---|
1 |
response |
Source_Watch_Response
|
|
3 |
framework_err |
internal
|
SERVICES
Service
Defined in fuchsia.hardware.power.source/source.fidl
| Name | Type | Transport |
|---|---|---|
| source |
fuchsia.hardware.power.source/Source
|
Channel |