Re: Regarding DFU+ IOCTL_INTERNAL_USB_CYCLE_PORT



Hi,
I will also post the debug prints that I got from dbgview.

Returning DFUReset status 0
PNP Request (IRP_MN_QUERY_DEVICE_RELATIONS)
PNP Request (IRP_MN_QUERY_DEVICE_RELATIONS)
PNP Request (IRP_MN_SURPRISE_REMOVAL)
To SURPRISEREMOVED from WORKING
status IoCallDriver:103
status SendAwaitUrb:c000009d
Error C000009D trying to deconfigure device
IoDeleteSymbolic link 0
NEW Entering AddDevice: DriverObject 86268030, pdo 857D2030 (Max Dev
Count 1)
IoCreateDevice returned - c0000035
Device count - 0.
Failed to create deivce object - c0000035
IRP_MJ_CLEANUP
status :0
IRP_MJ_CLOSE
No queue elements for freeing.
PNP Request (IRP_MN_REMOVE_DEVICE)
To REMOVED from SURPRISEREMOVED
Entering DriverUnload: DriverObject 86268030
NU Entering DriverEntry: DriverObject 86268030

In the above log u can see that symbolic link is also destroyed
correctly in surprise removal function.
My application calls createfile,deviceIocontrol with custom reset
command and close file.






zyx wrote:
Hi,
I am implementing DFU support to the usb function driver.For DFU
support,I need to re enumerate the device so that while enumerating all
the other drivers are unloaded and DFU supported USB function driver
gets loaded.I have posted my piece of code down.

PAGED_CODE();
NTSTATUS status;
PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;
KEVENT event;
KeInitializeEvent(&event, NotificationEvent, FALSE);
IO_STATUS_BLOCK iostatus;

PIRP Irp =
IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_CYCLE_PORT,
pdx->LowerDeviceObject, NULL, 0, NULL, 0, TRUE, &event,
&iostatus);
KdPrint((DRIVERNAME " - IoBuildDeviceIoControlRequest %X \n",
iostatus.Status));
KdPrint((DRIVERNAME " - IRP Pointer %X \n", Irp));
PIO_STACK_LOCATION stack = IoGetNextIrpStackLocation(Irp);
stack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
stack->Parameters.DeviceIoControl.IoControlCode =
IOCTL_INTERNAL_USB_CYCLE_PORT;
//stack->Parameters.Others.Argument1 = (PVOID) urb;

status = IoCallDriver(pdx->LowerDeviceObject, Irp);
KdPrint((DRIVERNAME " - After IoCallDriver %X \n", status));

if (status == STATUS_PENDING)
{
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE,
NULL);
status = iostatus.Status;

}
KdPrint((DRIVERNAME " - IoBuildDeviceIoControlRequest %X \n",
iostatus.Status));
if (!NT_SUCCESS(status))
{
KdPrint((DRIVERNAME " - Error %X trying to reset device\n",
status));
}
KdPrint((DRIVERNAME " - Returning DFUReset status %X \n", status));
return status;.


The problem here is my device is getting reset.But when it enumerates
again I am getting STATUS_NAME_OBJECT_COLLISION error.IoCreateDevice
fails.
The hardware device I am using is a bluetooth dongle.
Help me thru this.

.