Partager via


EVT_UCX_ROOTHUB_GET_20PORT_INFO fonction de rappel (ucxroothub.h)

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

Syntaxe

EVT_UCX_ROOTHUB_GET_20PORT_INFO EvtUcxRoothubGet20PortInfo;

void EvtUcxRoothubGet20PortInfo(
  [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_20PORT_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_20PORTS_INFO contient une liste de ports USB 2.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_EvtRootHubGet20PortInfo(
    UCXROOTHUB         UcxRootHub,
    WDFREQUEST         Request
)
/*++

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

--*/
{
    PUCX_ROOTHUB_CONTEXT    ucxRootHubContext;
    WDF_REQUEST_PARAMETERS  wdfRequestParams;
    PROOTHUB_20PORTS_INFO   rootHub20PortsInfo;
    NTSTATUS                status;

    ucxRootHubContext = GetUcxRootHubContext(UcxRootHub);

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

    rootHub20PortsInfo = (PROOTHUB_20PORTS_INFO)wdfRequestParams.Parameters.Others.Arg1;

    if (rootHub20PortsInfo->Size < sizeof(ROOTHUB_20PORTS_INFO)) {
        DbgTrace(TL_ERROR, RootHub, "Invalid ROOTHUB_20PORTS_INFO Size %d", rootHub20PortsInfo->Size);
        status = STATUS_INVALID_PARAMETER;
        goto RootHub_EvtRootHubGet20PortInfoEnd;
    }

    if (rootHub20PortsInfo->NumberOfPorts != ucxRootHubContext->NumberOf20Ports) {
        DbgTrace(TL_ERROR, RootHub, "Invalid ROOTHUB_20PORTS_INFO NumberOfPorts %d", rootHub20PortsInfo->NumberOfPorts);
        status = STATUS_INVALID_PARAMETER;
        goto RootHub_EvtRootHubGet20PortInfoEnd;
    }

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

    //
    // Return static root hub 2.0 port information.
    //
    rootHub20PortsInfo->PortInfoArray[0]->PortNumber = ROOTHUB_20_PORT_PORT_NUMBER;
    rootHub20PortsInfo->PortInfoArray[0]->Removable = TriStateTrue;

    status = STATUS_SUCCESS;

    DbgTrace(TL_INFO, RootHub, "RootHub_EvtRootHubGet20PortInfo");

RootHub_EvtRootHubGet20PortInfoEnd:

    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_20PORTS_INFO