Partager via


EVT_UCX_ROOTHUB_GET_30PORT_INFO fonction de rappel (ucxroothub.h)

Implémentation du pilote client qu’UCX appelle lorsqu’il reçoit une demande d’informations sur les ports USB 3.0 sur le hub racine.

Syntaxe

EVT_UCX_ROOTHUB_GET_30PORT_INFO EvtUcxRoothubGet30PortInfo;

void EvtUcxRoothubGet30PortInfo(
  [in] UCXROOTHUB UcxRootHub,
  [in] WDFREQUEST Request
)
{...}

Paramètres

[in] UcxRootHub

Handle vers un objet UCX qui représente le hub racine.

[in] Request

Structure de type _ROOTHUB_30PORT_INFO.

Valeur de retour

Aucun

Remarques

Le pilote client UCX inscrit cette fonction de rappel auprès de l’extension UCX (Host Controller Extension) USB en appelant la méthode UcxRootHubCreate.

Le tableau PortInfoArray de la structure _ROOTHUB_30PORT_INFO contient une liste de ports USB 3.0 pris en charge par le hub racine.

Le pilote client retourne l’état d’achèvement dans demande et dans l’USBD_STATUS dans l’en-tête URB. Le pilote peut effectuer l’opération WDFREQUEST de manière asynchrone.

Exemples

VOID
RootHub_EvtRootHubGet30PortInfo(
    UCXROOTHUB         UcxRootHub,
    WDFREQUEST         Request
)
/*++

    For sample demonstration purposes, this function returns statically
    defined information for the single 3.0 port.

--*/
{
    PUCX_ROOTHUB_CONTEXT    ucxRootHubContext;
    WDF_REQUEST_PARAMETERS  wdfRequestParams;
    PROOTHUB_30PORTS_INFO   rootHub30PortsInfo;
    NTSTATUS                status;

    ucxRootHubContext = GetUcxRootHubContext(UcxRootHub);

    WDF_REQUEST_PARAMETERS_INIT(&wdfRequestParams);
    WdfRequestGetParameters(Request, &wdfRequestParams);

    rootHub30PortsInfo = (PROOTHUB_30PORTS_INFO)wdfRequestParams.Parameters.Others.Arg1;

    if (rootHub30PortsInfo->Size < sizeof(ROOTHUB_30PORTS_INFO)) {
        DbgTrace(TL_ERROR, RootHub, "Invalid ROOTHUB_30PORTS_INFO Size %d", rootHub30PortsInfo->Size);
        status = STATUS_INVALID_PARAMETER;
        goto RootHub_EvtRootHubGet30PortInfoEnd;
    }

    if (rootHub30PortsInfo->NumberOfPorts != ucxRootHubContext->NumberOf30Ports) {
        DbgTrace(TL_ERROR, RootHub, "Invalid ROOTHUB_30PORTS_INFO NumberOfPorts %d", rootHub30PortsInfo->NumberOfPorts);
        status = STATUS_INVALID_PARAMETER;
        goto RootHub_EvtRootHubGet30PortInfoEnd;
    }

    if (rootHub30PortsInfo->PortInfoSize < sizeof(ROOTHUB_30PORT_INFO)) {
        DbgTrace(TL_ERROR, RootHub, "Invalid ROOTHUB_30PORT_INFO Size %d", rootHub30PortsInfo->PortInfoSize);
        status = STATUS_INVALID_PARAMETER;
        goto RootHub_EvtRootHubGet30PortInfoEnd;
    }

    //
    // Return static root hub 3.0 port information.
    //
    rootHub30PortsInfo->PortInfoArray[0]->PortNumber = ROOTHUB_30_PORT_PORT_NUMBER;
    rootHub30PortsInfo->PortInfoArray[0]->Removable = TriStateTrue;

    status = STATUS_SUCCESS;

    DbgTrace(TL_INFO, RootHub, "RootHub_EvtRootHubGet30PortInfo");

RootHub_EvtRootHubGet30PortInfoEnd:

    WdfRequestComplete(Request, status);
}

Exigences

Exigence Valeur
plateforme cible Windows
version minimale de KMDF 1.0
version minimale de UMDF 2.0
d’en-tête ucxroothub.h (include Ucxclass.h)
IRQL DISPATCH_LEVEL

Voir aussi

_ROOTHUB_30PORT_INFO