EVT_UFX_DEVICE_DEFAULT_ENDPOINT_ADD callback function (ufxclient.h)

The client driver's implementation to create a default control endpoint.

Syntax

EVT_UFX_DEVICE_DEFAULT_ENDPOINT_ADD EvtUfxDeviceDefaultEndpointAdd;

void EvtUfxDeviceDefaultEndpointAdd(
  [in]      UFXDEVICE unnamedParam1,
  [in]      USHORT unnamedParam2,
  [in, out] PUFXENDPOINT_INIT unnamedParam3
)
{...}

Parameters

[in] unnamedParam1

The handle to a USB device object that the client driver received in a previous call to the UfxDeviceCreate.

[in] unnamedParam2

The default maximum packet size that can be sent from or to this endpoint.

[in, out] unnamedParam3

A pointer to an UFXENDPOINT_INIT opaque structure that contains the endpoint descriptor required to create an endpoint object.

Return value

None

Remarks

The client driver for the function host controller registers its EVT_UFX_DEVICE_DEFAULT_ENDPOINT_ADD implementation with the USB function class extension (UFX) by calling the UfxDeviceCreate method.

To create the endpoint the client driver is expected to initialize the attributes of the endpoint’s transfer and command queues, and then call UfxEndpointCreate to create the endpoint. After the default control endpoint is created, UFX is ready to process setup packets and other control transfer packets from host.

The client driver indicates completion of this event by calling the UfxDeviceEventComplete method.

Examples


EVT_UFX_DEVICE_DEFAULT_ENDPOINT_ADD UfxDevice_EvtDeviceDefaultEndpointAdd;

VOID
UfxDevice_EvtDeviceDefaultEndpointAdd (
    _In_ UFXDEVICE UfxDevice,
    _In_ USHORT MaxPacketSize,
    _Inout_ PUFXENDPOINT_INIT EndpointInit
    )
/*++

Routine Description:

    EvtDeviceDefaultEndpointAdd handler for the UFXDEVICE object.
    Creates UFXENDPOINT object corresponding to the default endpoint of the
    device.

Arguments:

    UfxDevice - UFXDEVICE object representing the device.

    MaxPacketSize - Max packet size of the device's default endpoint.

    EndpointInit - Pointer to the Opaque UFXENDPOINT_INIT object

--*/
{
    NTSTATUS Status;
    USB_ENDPOINT_DESCRIPTOR Descriptor;

    PAGED_CODE();

    TraceEntry();

    Descriptor.bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE;
    Descriptor.bEndpointAddress = 0;
    Descriptor.bInterval = 0;
    Descriptor.bLength = sizeof(USB_ENDPOINT_DESCRIPTOR);
    Descriptor.bmAttributes = USB_ENDPOINT_TYPE_CONTROL;
    Descriptor.wMaxPacketSize = MaxPacketSize;

    // #### TODO: Insert code to add the endpoint. 
    // See code example for EVT_UFX_DEVICE_ENDPOINT_ADD ####

End:
    UfxDeviceEventComplete(UfxDevice, Status);
    TraceExit();
}

Requirements

Requirement Value
Target Platform Windows
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header ufxclient.h
IRQL PASSIVE_LEVEL

See also

UfxDeviceCreate

UfxDeviceEventComplete