Condividi tramite


funzione WDF_USB_CONTROL_SETUP_PACKET_INIT_FEATURE (wdfusb.h)

[Si applica a KMDF e UMDF]

La funzione WDF_USB_CONTROL_SETUP_PACKET_INIT_FEATURE inizializza una struttura WDF_USB_CONTROL_SETUP_PACKET per un trasferimento di controllo USB che imposta o cancella una funzionalità del dispositivo.

Sintassi

void WDF_USB_CONTROL_SETUP_PACKET_INIT_FEATURE(
  [out] PWDF_USB_CONTROL_SETUP_PACKET Packet,
  [in]  WDF_USB_BMREQUEST_RECIPIENT   BmRequestRecipient,
  [in]  USHORT                        FeatureSelector,
  [in]  USHORT                        Index,
  [in]  BOOLEAN                       SetFeature
);

Parametri

[out] Packet

Puntatore a una struttura WDF_USB_CONTROL_SETUP_PACKET.

[in] BmRequestRecipient

Valore WDF_USB_BMREQUEST_RECIPIENT-typed archiviato nel membro Packet.bm.Request.Recipient della struttura WDF_USB_CONTROL_SETUP_PACKET.

[in] FeatureSelector

Valore specifico della funzionalità archiviato nel membro Packet.wValue.Value della struttura WDF_USB_CONTROL_SETUP_PACKET.

[in] Index

Valore di indice specifico della funzionalità archiviato nel membro Packet.wIndex.Value della struttura WDF_USB_CONTROL_SETUP_PACKET.

[in] SetFeature

Valore booleano che, se TRUE, indica che verrà impostata la funzionalità specificata. Se false, la funzionalità specificata verrà cancellata.

Valore restituito

Nessuno

Osservazioni

La funzione WDF_USB_CONTROL_SETUP_PACKET_INIT_FEATURE esegue le operazioni seguenti:

  1. Zeri la struttura WDF_USB_CONTROL_SETUP_PACKET.
  2. Imposta il membro Packet.bm.Request.Type su BmRequestStandard.
  3. Imposta il membro Packet.bm.Request.Dir su BmRequestDeviceToDevice.
  4. Imposta il membro Packet.bRequest su un valore di richiesta "set feature" o "clear feature", in base all'argomento SetFeature.
  5. Imposta altri membri della struttura utilizzando gli argomenti di input della funzione WDF_USB_CONTROL_SETUP_PACKET_INIT_FEATURE.
Per inizializzare una struttura WDF_USB_CONTROL_SETUP_PACKET, il driver deve chiamare una delle funzioni seguenti:

Esempi

Nell'esempio di codice seguente viene inizializzata una struttura WDF_USB_CONTROL_SETUP_PACKET.

WDF_USB_CONTROL_SETUP_PACKET packet;

WDF_USB_CONTROL_SETUP_PACKET_INIT_FEATURE(
                                          &packet,
                                          BMREQUEST_TO_DEVICE,
                                          USB_DEVICE_DESCRIPTOR_TYPE,
                                          0,
                                          FALSE
                                          );

Fabbisogno

Requisito Valore
piattaforma di destinazione Universale
versione minima di KMDF 1.0
versione minima di UMDF 2.0
intestazione wdfusb.h (include Wdfusb.h)

Vedere anche

WDF_USB_BMREQUEST_RECIPIENT

WDF_USB_CONTROL_SETUP_PACKET

WDF_USB_CONTROL_SETUP_PACKET_INIT

WDF_USB_CONTROL_SETUP_PACKET_INIT_CLASS

WDF_USB_CONTROL_SETUP_PACKET_INIT_GET_STATUS

WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR