Muokkaa

Jaa


Implementing a USB Idle Request IRP Completion Routine

When MiniportIdleNotification is called, the USB miniport driver calls IoCallDriver to issue an I/O request packet (IRP) for a USB idle request (IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION) to the underlying USB bus driver. The miniport driver issues this IRP to inform the USB bus driver that the network adapter is idle and must be suspended.

The USB miniport driver must also call IoSetCompletionRoutineEx in order to register a completion routine for the USB idle request IRP. The USB bus driver calls the completion routine when it completes the IRP after it is canceled by the USB miniport driver. The USB miniport driver cancels the IRP when NDIS cancels the idle notification by calling MiniportCancelIdleNotification.

The completion routine only has to call NdisMIdleNotificationComplete in order to notify NDIS that it can continue with the full-power state transition of the network adapter.

Note  The completion routine must return STATUS_MORE_PROCESSING_REQUIRED if the USB miniport driver will reuse the IRP resources during another idle notification from NDIS.

The following is an example of a completion routine for the USB idle request IRP.

//
// MiniportUsbIdleRequestCompletion()
//
// This is the IO_COMPLETION_ROUTINE for the selective suspend IOCTL.
// All that is needed is to inform NDIS that the IdleNotification
// operation is complete.
//
VOID MiniportUsbIdleRequestCompletion(PVOID AdapterContext)
{
    NdisMIdleNotificationComplete(Adapter->MiniportAdapterHandle);

    // We will be reusing the IRP later, so do not let the IO manager delete it.
    return STATUS_MORE_PROCESSING_REQUIRED;
}

For more information about the USB idle request callback routine, see USB Idle Request IRP Completion Routine.