Bewerken

Delen via


UcmConnectorTypeCAttach function (ucmmanager.h)

Notifies the USB connector manager framework extension (UcmCx) when a partner connector is attached.

Syntax

NTSTATUS UcmConnectorTypeCAttach(
  [in] UCMCONNECTOR                       Connector,
  [in] PUCM_CONNECTOR_TYPEC_ATTACH_PARAMS Params
);

Parameters

[in] Connector

Handle to the connector object that the client driver received in the previous call to UcmConnectorCreate.

[in] Params

A pointer to a driver-allocated UCM_CONNECTOR_TYPEC_ATTACH_PARAMS that has been initialized by calling UCM_CONNECTOR_TYPEC_ATTACH_PARAMS_INIT.

Return value

UcmConnectorTypeCAttach returns STATUS_SUCCESS if the operation succeeds. Otherwise, this method can return an appropriate NTSTATUS value.

Remarks

When a connection to a partner connector is detected, the client driver calls this method to notify UcmCx with information about the partner connector. That information includes the connector role, down stream or upstream facing port, the amount of current connector can draw or deliver, and charging state. UcmCx uses that information to perform certain operations. For example, it may determine the role of the partner connector attached, and configure the USB controller in host or peripheral mode.

Typically, every UcmConnectorTypeCAttach call has a subsequent UcmConnectorTypeCDetach call to notify UcmCx when the partner connector is detached. However, when a powered cable without an upstream port is attached (indicated by Params->PortPartnerType set to UcmTypeCPortStatePoweredCableNoUfp). The client driver can call UcmConnectorTypeCAttach again when a connection is detected to the upstream port to the powered cable.

Examples

        UCM_CONNECTOR_TYPEC_ATTACH_PARAMS attachParams;

        UCM_CONNECTOR_TYPEC_ATTACH_PARAMS_INIT(
            &attachParams,
            UcmTypeCPortStateDfp);
        attachParams.CurrentAdvertisement = UcmTypeCCurrent1500mA;

        status = UcmConnectorTypeCAttach(
                    Connector,
                    &attachParams);
        if (!NT_SUCCESS(status))
        {
            TRACE_ERROR(
                "UcmConnectorTypeCAttach() failed with %!STATUS!.",
                status);
            goto Exit;
        }

        TRACE_INFO("UcmConnectorTypeCAttach() succeeded.");

Requirements

Requirement Value
Minimum supported client Windows 10
Minimum supported server Windows Server 2016
Target Platform Windows
Minimum KMDF version 1.15
Minimum UMDF version 2.15
Header ucmmanager.h (include Ucmcx.h)
Library UcmCxstub.lib
IRQL PASSIVE_LEVEL

See also

UCM_CONNECTOR_TYPEC_ATTACH_PARAMS

UCM_CONNECTOR_TYPEC_ATTACH_PARAMS_INIT

UcmConnectorCreate