IRP_MJ_INTERNAL_DEVICE_CONTROL fails in usb driver

Hi

I have Created a usb driver based on bulkusb from ddk.in this
IRP_MJ_INTERNAL_DEVICE_CONTROL got cancelled. what should be the possible
reason for that…Can i send more details

I think my driver is not communicating with the host. How i will attach
my device to the host…

please help me to find out the solution .

Niraj

Niraj Jha wrote:

Hi

I have Created a usb driver based on bulkusb from ddk.in
http: this IRP_MJ_INTERNAL_DEVICE_CONTROL got cancelled.
> what should be the possible reason for that…Can i send more details

You certainly will need to send more details. Do you really mean
“cancelled”, as in “my cancel routine gets called”, or do you mean that
it returns with an error? Which error? Does it return immediately, or
does it take time? What kind of URB are you sending? Can you post the
code that creates the URB and IRP clear through to the IoCallDriver?

> I think my driver is not communicating with the host. How i will
> attach my device to the host…

I don’t understand the question. You ARE the host. Do you mean the USB
host controller? If so, your driver wouldn’t have been loaded unless
your device was already attached. Bulkusb dumps the configuration data
to the debug log. Does that show the pipe info you expect?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.</http:>

Hi Sir

Thanks for this kind response.As i told i am using BulkUsb sample.i have
implemented only few controls…

Reading Operation fails and it holts the program flow for some time. The
return status code is C0000120.This is the code of that section.

rwContext->Urb = urb;

rwContext->Mdl = mdl;

rwContext->Length = totalLength - stageLength;

rwContext->Numxfer = 0;

rwContext->VirtualAddress = virtualAddress + stageLength;

rwContext->DeviceExtension = deviceExtension;

nextStack = IoGetNextIrpStackLocation(Irp);

nextStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;

nextStack->Parameters.Others.Argument1 = (PVOID) urb;

nextStack->Parameters.DeviceIoControl.IoControlCode =

IOCTL_INTERNAL_USB_SUBMIT_URB;

IoSetCompletionRoutine(Irp,

(PIO_COMPLETION_ROUTINE)BulkUsb_ReadWriteCompletion,

rwContext,

TRUE,

TRUE,

TRUE);

IoMarkIrpPending(Irp);

ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject,

Irp);

As i think the error is due to my driver stack is not connected to
system stack.If so then how i will connect my driver stack to controlers
stack , or system stack.

Niraj

On 6/15/06, Tim Roberts wrote:
>
> Niraj Jha wrote:
>
> > Hi
> >
> > I have Created a usb driver based on bulkusb from ddk.in
> > http: this IRP_MJ_INTERNAL_DEVICE_CONTROL got cancelled.
> > what should be the possible reason for that…Can i send more details
>
>
> You certainly will need to send more details. Do you really mean
> “cancelled”, as in “my cancel routine gets called”, or do you mean that
> it returns with an error? Which error? Does it return immediately, or
> does it take time? What kind of URB are you sending? Can you post the
> code that creates the URB and IRP clear through to the IoCallDriver?
>
> > I think my driver is not communicating with the host. How i will
> > attach my device to the host…
>
>
> I don’t understand the question. You ARE the host. Do you mean the USB
> host controller? If so, your driver wouldn’t have been loaded unless
> your device was already attached. Bulkusb dumps the configuration data
> to the debug log. Does that show the pipe info you expect?
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
></http:>

How did you install your driver? Did you use add new hardware or a command line tool like devcon? Or did you install your driver by going through the found new hardware wizard when your usb device was plugged in. To see if you are installed on the right stack, run

!devstack

And send the output. If the device node path starts with usb, you are on the right stakc. If it starts with anything else, like root, you installed your driver incorrectly.

d

– I can spell, I just can’t type.
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Niraj Jha
Sent: Thursday, June 15, 2006 8:48 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] IRP_MJ_INTERNAL_DEVICE_CONTROL fails in usb driver

Hi Sir
?
Thanks for this kind response.As i told i am using BulkUsb sample.i have implemented only few controls…
?
? Reading Operation fails and it holts the program flow for some time. The return status code is C0000120.This is the code of that section.
rwContext->Urb = urb;
rwContext->Mdl = mdl;
rwContext->Length = totalLength - stageLength;
rwContext->Numxfer = 0;
rwContext->VirtualAddress = virtualAddress + stageLength;
rwContext->DeviceExtension = deviceExtension;
nextStack = IoGetNextIrpStackLocation(Irp);
nextStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
nextStack->Parameters.Others.Argument1 = (PVOID) urb;
nextStack->Parameters.DeviceIoControl.IoControlCode =
IOCTL_INTERNAL_USB_SUBMIT_URB;
IoSetCompletionRoutine(Irp,
(PIO_COMPLETION_ROUTINE)BulkUsb_ReadWriteCompletion,
rwContext,
TRUE,
TRUE,
TRUE);
IoMarkIrpPending(Irp);
?
ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject,
Irp);
?? As i think the error is due to my driver stack? is not connected to system stack.If so then how i will connect my driver stack to controlers stack , or system stack.
Niraj

?
On 6/15/06, Tim Roberts wrote:
Niraj Jha wrote:

> Hi
>
>???I have Created a usb driver based on bulkusb from ddk.in
> http: this IRP_MJ_INTERNAL_DEVICE_CONTROL got cancelled.
> what should be the possible reason for that…Can i send more details

You certainly will need to send more details.??Do you really mean
“cancelled”, as in “my cancel routine gets called”, or do you mean that
it returns with an error???Which error???Does it return immediately, or
does it take time???What kind of URB are you sending???Can you post the
code that creates the URB and IRP clear through to the IoCallDriver?

>???I think my driver is not communicating with the host. How i will
> attach my device to the host…

I don’t understand the question.??You ARE the host.??Do you mean the USB
host controller??? If so, your driver wouldn’t have been loaded unless
your device was already attached.??Bulkusb dumps the configuration data
to the debug log.??Does that show the pipe info you expect?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</http:>

Hi sir
the stack trace is …

kd> !devstack 0x811bbad0

!DevObj !DrvObj !DevExt ObjectName

ffb9a418 \Driver\Jinvani ffb9a4d0 00000053

811bbad0 \Driver\usbhub 811bbb88 USBPDO-1

!DevNode 8122fb10 :

DeviceInst is “USB\Vid_0471&Pid_8888\5&1f8fd7d0&0&1”

ServiceName is “Jinvani”

i use to install my driver by going through the found new hardware wizard.

Niraj

On 6/16/06, Doron Holan wrote:
>
> How did you install your driver? Did you use add new hardware or a
> command line tool like devcon? Or did you install your driver by going
> through the found new hardware wizard when your usb device was plugged
> in. To see if you are installed on the right stack, run
>
> !devstack
>
> And send the output. If the device node path starts with usb, you are on
> the right stakc. If it starts with anything else, like root, you installed
> your driver incorrectly.
>
> d
>
> – I can spell, I just can’t type.
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] On Behalf Of Niraj Jha
> Sent: Thursday, June 15, 2006 8:48 PM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] IRP_MJ_INTERNAL_DEVICE_CONTROL fails in usb driver
>
> Hi Sir
>
> Thanks for this kind response.As i told i am using BulkUsb sample.i have
> implemented only few controls…
>
> Reading Operation fails and it holts the program flow for some time. The
> return status code is C0000120.This is the code of that section.
> rwContext->Urb = urb;
> rwContext->Mdl = mdl;
> rwContext->Length = totalLength - stageLength;
> rwContext->Numxfer = 0;
> rwContext->VirtualAddress = virtualAddress + stageLength;
> rwContext->DeviceExtension = deviceExtension;
> nextStack = IoGetNextIrpStackLocation(Irp);
> nextStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
> nextStack->Parameters.Others.Argument1 = (PVOID) urb;
> nextStack->Parameters.DeviceIoControl.IoControlCode =
> IOCTL_INTERNAL_USB_SUBMIT_URB;
> IoSetCompletionRoutine(Irp,
> (PIO_COMPLETION_ROUTINE)BulkUsb_ReadWriteCompletion,
> rwContext,
> TRUE,
> TRUE,
> TRUE);
> IoMarkIrpPending(Irp);
>
> ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject,
> Irp);
> As i think the error is due to my driver stack is not connected to system
> stack.If so then how i will connect my driver stack to controlers stack ,
> or system stack.
> Niraj
>
>
> On 6/15/06, Tim Roberts wrote:
> Niraj Jha wrote:
>
> > Hi
> >
> >I have Created a usb driver based on bulkusb from ddk.in
> > http: this IRP_MJ_INTERNAL_DEVICE_CONTROL got cancelled.
> > what should be the possible reason for that…Can i send more details
>
>
> You certainly will need to send more details.Do you really mean
> “cancelled”, as in “my cancel routine gets called”, or do you mean that
> it returns with an error?Which error?Does it return immediately, or
> does it take time?What kind of URB are you sending?Can you post the
> code that creates the URB and IRP clear through to the IoCallDriver?
>
> >I think my driver is not communicating with the host. How i will
> > attach my device to the host…
>
>
> I don’t understand the question.You ARE the host.Do you mean the USB
> host controller? If so, your driver wouldn’t have been loaded unless
> your device was already attached.Bulkusb dumps the configuration data
> to the debug log.Does that show the pipe info you expect?
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> — Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List
> Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
></http:>

You are installed on the right stack. Areyo usending I/O to your attached device in your IoCallDriver()?

d

– I can spell, I just can’t type.
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Niraj Jha
Sent: Tuesday, June 20, 2006 5:14 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] IRP_MJ_INTERNAL_DEVICE_CONTROL fails in usb driver

Hi sir
?? the stack trace is …
?
kd> !devstack 0x811bbad0
!DevObj !DrvObj !DevExt ObjectName
ffb9a418 \Driver\Jinvani ffb9a4d0 00000053

811bbad0 \Driver\usbhub 811bbb88 USBPDO-1
!DevNode 8122fb10 :
DeviceInst is “USB\Vid_0471&Pid_8888\5&1f8fd7d0&0&1”
ServiceName is “Jinvani”
?
i use to install my driver??by going through the found new hardware wizard.
?
Niraj

?
On 6/16/06, Doron Holan wrote:
How did you install your driver???Did you use add new hardware or a command line tool like devcon???Or did you install your driver by going through the found new hardware wizard when your usb device was plugged in.??To see if you are installed on the right stack, run

!devstack

And send the output.??If the device node path starts with usb, you are on the right stakc.??If it starts with anything else, like root, you installed your driver incorrectly.

d

– I can spell, I just can’t type.
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Niraj Jha
Sent: Thursday, June 15, 2006 8:48 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] IRP_MJ_INTERNAL_DEVICE_CONTROL fails in usb driver

Hi Sir

Thanks for this kind response.As i told i am using BulkUsb sample.i have implemented only few controls…

Reading Operation fails and it holts the program flow for some time. The return status code is C0000120.This is the code of that section.
rwContext->Urb = urb;
rwContext->Mdl = mdl;
rwContext->Length = totalLength - stageLength;
rwContext->Numxfer = 0;
rwContext->VirtualAddress = virtualAddress + stageLength;
rwContext->DeviceExtension = deviceExtension;
nextStack = IoGetNextIrpStackLocation(Irp);
nextStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
nextStack->Parameters.Others.Argument1 = (PVOID) urb;
nextStack->Parameters.DeviceIoControl.IoControlCode =
IOCTL_INTERNAL_USB_SUBMIT_URB;
IoSetCompletionRoutine(Irp,
(PIO_COMPLETION_ROUTINE)BulkUsb_ReadWriteCompletion,
rwContext,
TRUE,
TRUE,
TRUE);
IoMarkIrpPending(Irp);

ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject,
Irp);
As i think the error is due to my driver stack is not connected to system stack.If so then how i will connect my driver stack to controlers stack , or system stack.
Niraj

On 6/15/06, Tim Roberts < xxxxx@probo.com> wrote:
Niraj Jha wrote:

> Hi
>
>I have Created a usb driver based on bulkusb from ddk.in
> < http://ddk.in> this IRP_MJ_INTERNAL_DEVICE_CONTROL got cancelled.
> what should be the possible reason for that…Can i send more details

You certainly will need to send more details.Do you really mean
“cancelled”, as in “my cancel routine gets called”, or do you mean that
it returns with an error?Which error?Does it return immediately, or
does it take time?What kind of URB are you sending?Can you post the
code that creates the URB and IRP clear through to the IoCallDriver?

>I think my driver is not communicating with the host. How i will
> attach my device to the host…

I don’t understand the question.You ARE the host.Do you mean the USB
host controller? If so, your driver wouldn’t have been loaded unless
your device was already attached.Bulkusb dumps the configuration data
to the debug log.Does that show the pipe info you expect?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer