EVT_UCM_CONNECTOR_SET_DATA_ROLE callback function (ucmmanager.h)
The client driver's implementation of the EVT_UCM_CONNECTOR_SET_DATA_ROLE event callback function that swaps the data role of the connector to the specified role when attached to a partner connector.
Syntax
EVT_UCM_CONNECTOR_SET_DATA_ROLE EvtUcmConnectorSetDataRole;
NTSTATUS EvtUcmConnectorSetDataRole(
[in] UCMCONNECTOR Connector,
[in] UCM_DATA_ROLE DataRole
)
{...}
Parameters
[in] Connector
Handle to the connector that the client driver received in a previous call to the UcmConnectorCreate method.
[in] DataRole
A UCM_TYPEC_PARTNER-typed flag that specifies the role to set.
Return value
If the operation is successful, the callback function must return STATUS_SUCCESS, or another status value for which NT_SUCCESS(status) equals TRUE. Otherwise it must return a status value for which NT_SUCCESS(status) equals FALSE.
Remarks
To register an EVT_UCM_CONNECTOR_SET_DATA_ROLE callback function, the client driver must call UcmConnectorCreate.
The USB connector manager framework extension (UcmCx) can request either UcmTypeCPortStateUfp or UcmTypeCPortStateDfp. If the port is already in the requested role, the client driver can complete the request without any changes. Otherwise, it starts a data-role swap operation (DR_Swap). The driver calls UcmConnectorDataDirectionChanged to notify UcmCx about the success or failure of that operation. The driver can call that method within the callback function.
The role persists for the current connection.
If a role-swap operation is pending, UcmCx does not request another role swap. Those operations are serialized across power and data role swaps.
After the swap operation completes, if the partner port sends a DR_Swap request, the client driver must reject the request.
Examples
EVT_UCM_CONNECTOR_SET_DATA_ROLE EvtSetDataRole;
NTSTATUS
EvtSetDataRole(
UCMCONNECTOR Connector,
UCM_TYPE_C_PORT_STATE DataRole
)
{
PCONNECTOR_CONTEXT connCtx;
TRACE_INFO("EvtSetDataRole(%!UCM_TYPE_C_PORT_STATE!) Entry", DataRole);
connCtx = GetConnectorContext(Connector);
TRACE_FUNC_EXIT();
return STATUS_SUCCESS;
}
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) |
IRQL | PASSIVE_LEVEL |