다음을 통해 공유


UsbBuildVendorRequest macro

The UsbBuildVendorRequest macro formats an URB to send a vendor or class-specific command to a USB device, interface, endpoint, or other device-defined target.

Syntax

void UsbBuildVendorRequest(
  [in]           PURB   Urb,
  [in]           USHORT Function,
  [in]           USHORT Length,
  [in]           ULONG  TransferFlags,
  [in]           UCHAR  ReservedBits,
  [in]           UCHAR  Request,
  [in]           USHORT Value,
  [in]           USHORT Index,
  [in, optional] PVOID  TransferBuffer,
  [in, optional] PMDL   TransferBufferMDL,
  [in]           ULONG  TransferBufferLength,
  [in]           PURB   Link
);

Parameters

  • Urb [in]
    Pointer to an URB that is to be formatted as a vendor or class request.

  • Function [in]
    Must be set to one of the following values:

    • URB_FUNCTION_VENDOR_DEVICE
      Indicates the URB is a vendor-defined request for a USB device.

    • URB_FUNCTION_VENDOR_INTERFACE
      Indicates the URB is a vendor-defined request for an interface on a USB device.

    • URB_FUNCTION_VENDOR_ENDPOINT
      Indicates the URB is a vendor-defined request for an endpoint, in an interface, on a USB device.

    • URB_FUNCTION_VENDOR_OTHER
      Indicates the URB is a vendor-defined request for a device-defined target.

    • URB_FUNCTION_CLASS_DEVICE
      Indicates the URB is a USB-defined class request for a USB device.

    • URB_FUNCTION_CLASS_INTERFACE
      Indicates the URB is a USB-defined class request for an interface on a USB device.

    • URB_FUNCTION_CLASS_ENDPOINT
      Indicates the URB is a USB-defined class request for an endpoint, in an interface, on a USB device.

    • URB_FUNCTION_CLASS_OTHER
      Indicates the URB is a USB-defined class request for a device-defined target.

  • Length [in]
    Specifies the length, in bytes, of the URB.

  • TransferFlags [in]
    Specifies zero, one, or a combination of the following flags:

    • USBD_TRANSFER_DIRECTION_IN
      Is set to request data from a device. To transfer data to a device, this flag must be clear.

    • USBD_SHORT_TRANSFER_OK
      Can be used if USBD_TRANSFER_DIRECTION_IN is set. If set, directs the HCD not to return an error if a packet is received from the device that is shorter than the maximum packet size for the endpoint. Otherwise, a short request returns an error condition.

  • ReservedBits [in]
    Specifies a value, from 4 to 31 inclusive, that becomes part of the request type code in the USB-defined setup packet. This value is defined by USB for a class request or the vendor for a vendor request.

  • Request [in]
    Specifies the USB or vendor-defined request code for the device, interface, endpoint, or other device-defined target.

  • Value [in]
    Is a value, specific to Request, that becomes part of the USB-defined setup packet for the target. This value is defined by the creator of the code used in Request.

  • Index [in]
    Specifies the device-defined identifier if the request is for an endpoint, interface, or device-defined target. Otherwise, Index must be zero.

  • TransferBuffer [in, optional]
    Pointer to a resident buffer for the transfer or is NULL if an MDL is supplied in TransferBufferMDL. The contents of this buffer depend on the value of TransferFlags. If USBD_TRANSFER_DIRECTION_IN is specified, this buffer will contain data read from the device on return from the HCD. Otherwise, this buffer contains driver-supplied data to be transferred to the device.

  • TransferBufferMDL [in, optional]
    Pointer to an MDL that describes a resident buffer or is NULL if a buffer is supplied in TransferBuffer. The contents of the buffer depend on the value of TransferFlags. If USBD_TRANSFER_DIRECTION_IN is specified, the described buffer will contain data read from the device on return from the HCD. Otherwise, the buffer contains driver-supplied data to be transferred to the device. The MDL must be allocated from nonpaged pool.

  • TransferBufferLength [in]
    Specifies the length, in bytes, of the buffer specified in TransferBuffer or described in TransferBufferMDL.

  • Link [in]
    Reserved. Must be set to NULL.

Return value

This macro does not return a value.

Requirements

Target platform

Desktop

Header

Usbdlib.h (include Usbdlib.h)

See also

URB

_URB_CONTROL_VENDOR_OR_CLASS_REQUEST

USB device driver programming reference

 

 

Send comments about this topic to Microsoft