Z
zyx
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.
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.