Hi,
I used Walter Oney’s usbint sample as base for my interrupt pipe transfers. There are almost no diferences in my code. My problem is that I don’t understand IoSetCompletionRoutine well. I thought that this macro only set up the routine which will be called by the lower device driver in IoCompleteRequest. But my completion routine is called immediatly and the result code in Irp->IoStatus.Status is C000000D ? STATUS_INVALID_PARAMETER.
But there are only 5 parameters and I inicialized all of them as well as the usbint sample does. Is there something that I overlooked?
STEPS
-
I allocate memory for Irp and urb in AddDevice routine
Irp = IoAllocateIrp(deviceExtension->PhysicalDeviceObject->StackSize, FALSE);
urb = (PURB) ExAllocatePool(NonPagedPool, sizeof(struct _URB_BULK_OR_INTERRUPT_TRANSFER));
-
I inicialize urb for reading the interrupt pipe (IRP_MN_START_DEVICE)
UsbBuildInterruptOrBulkTransferRequest(urb, sizeof(struct _URB_BULK_OR_INTERRUPT_TRANSFER), deviceExtension->InterruptPipeHandle, &deviceExtension->InterruptData, NULL, 0x08, SBD_TRANSFER_DIRECTION_IN | USBD_SHORT_TRANSFER_OK, NULL);
-
I call IoSetCompletionRoutine
IoSetCompletionRoutine(Irp, (PIO_COMPLETION_ROUTINE) OnInterrupt, (PVOID)deviceExtension, TRUE, TRUE, TRUE);
-
the OnInterrupt routine is called immediatly and I got the result C000000D before I call IoCallDriver…
Do you have any idea how to solve this problem?
Thanx
Jan
The invalid parameter is coming from the usb core stack, not the I/O manager. I think you are confusing returning from IoCallDriver with before calling IoCallDriver. If you set a breakpoint on your completion routine, you will see that the irp is being completed in the context of IoCallDriver … basically, you have called IoCallDriver, but the call has not yet returned control to your driver. Does the usb status code in the URB contain an error? Are you sending the URB to the device object you were give in IoAttachDeviceToDeviceStack? Has deviceExtension->InterruptPipeHandle been initialized when you called UsbBuildinterruptOrBulkTransferRequest?
d
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Jan Halama
Sent: Wednesday, August 18, 2004 2:26 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB interrupt pipe problem
Hi,
?I used Walter Oney’s usbint sample as base for my interrupt pipe transfers. There?are almost no diferences in my code. My problem is that I don’t understand IoSetCompletionRoutine well. I thought that this?macro only set up the routine which will be called by the lower device driver?in IoCompleteRequest. But my completion routine is called immediatly and the result code in Irp->IoStatus.Status is C000000D?? STATUS_INVALID_PARAMETER.
?But there are only 5 parameters and I inicialized all of them as well as?the usbint sample does. Is there something that I overlooked?
?
STEPS
- I allocate memory for Irp and urb in AddDevice routine
??? ??? Irp = IoAllocateIrp(deviceExtension->PhysicalDeviceObject->StackSize, FALSE);
??? urb = (PURB) ExAllocatePool(NonPagedPool, sizeof(struct _URB_BULK_OR_INTERRUPT_TRANSFER));
- I inicialize urb for reading the interrupt pipe (IRP_MN_START_DEVICE)
UsbBuildInterruptOrBulkTransferRequest(urb,?sizeof(struct _URB_BULK_OR_INTERRUPT_TRANSFER), deviceExtension->InterruptPipeHandle,?&deviceExtension->InterruptData, NULL, 0x08, SBD_TRANSFER_DIRECTION_IN?| USBD_SHORT_TRANSFER_OK, NULL);
- I call IoSetCompletionRoutine
IoSetCompletionRoutine(Irp, (PIO_COMPLETION_ROUTINE) OnInterrupt, (PVOID)deviceExtension, TRUE, TRUE, TRUE);
?
- the OnInterrupt routine is called immediatly and I got the result C000000D before I call IoCallDriver…
?
?Do you have any idea how to solve this problem?
?
Thanx
Jan
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
Thank you,
now it is clear and the problem is solved.
The invalid parameter is coming from the usb core stack, not the I/O
manager. I think you are confusing returning from IoCallDriver with before
calling IoCallDriver. If you set a breakpoint on your completion routine,
you will see that the irp is being completed in the context of IoCallDriver
... basically, you have called IoCallDriver, but the call has not yet
returned control to your driver. Does the usb status code in the URB
contain an error? Are you sending the URB to the device object you were
give in IoAttachDeviceToDeviceStack? Has
deviceExtension->InterruptPipeHandle been initialized when you called
UsbBuildinterruptOrBulkTransferRequest?
d
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jan Halama
Sent: Wednesday, August 18, 2004 2:26 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB interrupt pipe problem
Hi,
I used Walter Oney's usbint sample as base for my interrupt pipe transfers.
There are almost no diferences in my code. My problem is that I don't
understand IoSetCompletionRoutine well. I thought that this macro only set
up the routine which will be called by the lower device driver in
IoCompleteRequest. But my completion routine is called immediatly and the
result code in Irp->IoStatus.Status is C000000D ? STATUS_INVALID_PARAMETER.
But there are only 5 parameters and I inicialized all of them as well as the
usbint sample does. Is there something that I overlooked?
STEPS
-
I allocate memory for Irp and urb in AddDevice routine
Irp = IoAllocateIrp(deviceExtension->PhysicalDeviceObject->StackSize,
FALSE);
urb = (PURB) ExAllocatePool(NonPagedPool, sizeof(struct
_URB_BULK_OR_INTERRUPT_TRANSFER));
-
I inicialize urb for reading the interrupt pipe (IRP_MN_START_DEVICE)
UsbBuildInterruptOrBulkTransferRequest(urb, sizeof(struct
_URB_BULK_OR_INTERRUPT_TRANSFER), deviceExtension->InterruptPipeHandle,
&deviceExtension->InterruptData, NULL, 0x08, SBD_TRANSFER_DIRECTION_IN |
USBD_SHORT_TRANSFER_OK, NULL);
-
I call IoSetCompletionRoutine
IoSetCompletionRoutine(Irp, (PIO_COMPLETION_ROUTINE) OnInterrupt,
(PVOID)deviceExtension, TRUE, TRUE, TRUE);
-
the OnInterrupt routine is called immediatly and I got the result
C000000D before I call IoCallDriver...
Do you have any idea how to solve this problem?
Thanx
Jan
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com