UsbPm_AssignConnectorPowerLevel function (usbpmapi.h)
Attempts a PD contract renegotiation with the specified voltage/current/power value.
Syntax
NTSTATUS UsbPm_AssignConnectorPowerLevel(
[In] USBPM_CLIENT ClientHandle,
[In] USBPM_CONNECTOR ConnectorHandle,
[In] PUSBPM_ASSIGN_CONNECTOR_POWER_LEVEL_PARAMS Params
);
Parameters
[In] ClientHandle
The handle that the client driver received in a previous call to UsbPm_Register.
[In] ConnectorHandle
The connector handle provided by Policy Manager when it calls the driver's implementation of EVT_USBPM_EVENT_CALLBACK. The handle is set in the EventData.ConnectorStateChange.ConnectorHandle member of the Params value.
[In] Params
A pointer to a driver-provided USBPM_ASSIGN_CONNECTOR_POWER_LEVEL_PARAMS structure that contains the voltage/current/power value to negotiate. Initialize the structure by calling USBPM_ASSIGN_CONNECTOR_POWER_LEVEL_PARAMS_INIT.
Specifying 0 as the voltage/current/power value for a connector in power sink role causes the connector to stop charging.
Return value
Returns STATUS_SUCCESS if the operation succeeds. Otherwise, returns an appropriate NTSTATUS value.
Remarks
The negotiated settings are persistent only as long as the port partner is attached, and is discarded when the port partner is detached. The client driver is required to call this function based on the current connector state, without assuming the previous setting.
If this call succeeds, the request has been accepted but PD contract renegotiation might not be complete. The result of PD contract renegotiation can be either success or failure.
As a result of successful PD contract renegotiation, EVT_USBPM_EVENT_CALLBACK is invoked with a connector state change event. If PD contract renegotiation request fails, the callback function is not invoked. For example, the request gets rejected by the partner, or is no longer valid because the connector state has changed.
In Windows 10, version 1809, the driver can only call this function with the power role of UsbCPowerRoleSink and when a partner is attached to the connector.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 10, version 1809 |
Minimum KMDF version | 1.27 |
Minimum UMDF version | 2.27 |
Header | usbpmapi.h |
Library | UsbPmApi.lib |
IRQL | PASSIVE_LEVEL |