Beispiel #1
0
NTSTATUS
ResetDevice(
  _In_ WDFDEVICE Device
)
/*++

Routine Description:

    This routine calls WdfUsbTargetDeviceResetPortSynchronously to reset the device if it's still
    connected.

Arguments:

    Device - Handle to a framework device

Return Value:

    NT status value

--*/
{
  PDEVICE_CONTEXT pDeviceContext;
  NTSTATUS status;

  Rio500_DbgPrint(3, ("ResetDevice - begins\n"));

  PAGED_CODE();

  pDeviceContext = GetDeviceContext(Device);
    
  //
  // A reset-device
  // request will be stuck in the USB until the pending transactions
  // have been canceled. Similarly, if there are pending tranasfers on the BULK
  // _In_/OUT pipe cancel them.
  // To work around this issue, the driver should stop the continuous reader
  // (by calling WdfIoTargetStop) before resetting the device, and restart the
  // continuous reader (by calling WdfIoTargetStart) after the request completes.
  //
  StopAllPipes(pDeviceContext);
    
  //
  // It may not be necessary to check whether device is connected before
  // resetting the port.
  //
  status = WdfUsbTargetDeviceIsConnectedSynchronous(pDeviceContext->WdfUsbTargetDevice);

  if (NT_SUCCESS(status)) {
    status = WdfUsbTargetDeviceResetPortSynchronously(pDeviceContext->WdfUsbTargetDevice);
  }

  StartAllPipes(pDeviceContext);
    
  Rio500_DbgPrint(3, ("ResetDevice - ends\n"));
  return status;
}
Beispiel #2
0
static NTSTATUS UsbChief_ResetDevice(IN WDFDEVICE Device)
{
	PDEVICE_CONTEXT pDeviceContext;
	NTSTATUS status;

	UsbChief_DbgPrint(0, ("\n"));

	PAGED_CODE();

	pDeviceContext = GetDeviceContext(Device);

	UsbChief_StopAllPipes(pDeviceContext);

	status = WdfUsbTargetDeviceIsConnectedSynchronous(pDeviceContext->WdfUsbTargetDevice);

	if(NT_SUCCESS(status)) {
		status = WdfUsbTargetDeviceResetPortSynchronously(pDeviceContext->WdfUsbTargetDevice);
	}

	UsbChief_StartAllPipes(pDeviceContext);
	return status;
}
Beispiel #3
0
/*++
Routine Description:

This routine calls WdfUsbTargetDeviceResetPortSynchronously to reset the device if it's still
connected.

Arguments:

Device - Handle to a framework device

Return Value:

NT status value
--*/
NTSTATUS ResetDevice(IN WDFDEVICE Device)

{
    PDEVICE_CONTEXT pDeviceContext;
    NTSTATUS status;

    PSDrv_DbgPrint(3, ("ResetDevice - begins\n"));

    PAGED_CODE();

    pDeviceContext = GetDeviceContext(Device);
    
    // A reset-device
    // request will be stuck in the USB until the pending transactions
    // have been canceled. Similarly, if there are pending transfers on the BULK
    // IN/OUT pipe cancel them.
    // To work around this issue, the driver should stop the continuous reader
    // (by calling WdfIoTargetStop) before resetting the device, and restart the
    // continuous reader (by calling WdfIoTargetStart) after the request completes.
    StopAllPipes(pDeviceContext);
    
    // It may not be necessary to check whether device is connected before
    // resetting the port.
    status = WdfUsbTargetDeviceIsConnectedSynchronous(pDeviceContext->WdfUsbTargetDevice);

    if(NT_SUCCESS(status))
	{
        status = WdfUsbTargetDeviceResetPortSynchronously(pDeviceContext->WdfUsbTargetDevice);
    }

    StartAllPipes(pDeviceContext);
    
    PSDrv_DbgPrint(3, ("ResetDevice - ends\n"));

    return status;
}