Submitting IRP_MJ_DEVICE_CONTROl irps to USB bus driver

hi

Can somebody explain to me how the USB bus driver processes an IRP (sent to it from a USB function driver) with major function = IRP_MJ_DEVICE_CONTROL? How does it know to send data off to the device and how does it know to send it endpoint 0? In general, what does the bus driver do with this type of IRP?

The reason I ask is that I am looking at some sample Driver Studio code that allocates an IRP and submits it. What I don’t understand is why the IRP major code is set to IRP_MJ_DEVICE_CONTROL (it also sets the IOCTL to a locally defined value and passes the pointer to the parameter in Parameters.Others.Argument1). Somehow the data submitted ends up over at the device.

This is the first time I’ve seen IRP_MJ_DEVICE_CONTROL used instead of IRP_MJ_INTERNAL_DEVICE_CONTROL.

Also, what is the difference between sending an IRP this way down to the bus driver versus calling UsbBuildVendorRequest()?

Finally, I tried implementing the same functionality under the DDK using:

KeIntializeEvent( &event, NotifcationEvent, FALSE );
irp = IoBuildDeviceIoControl(IOCTL_THEIRS, DevExt->Underlying USBBusPDO, &DataToPass16Bits, sizeof(DataToPass16Bits), NULL, 0,
FALSE, /* major code = IRP_MJ_DEVICE_CONTROL, &event, &ioStatus );

but I see nothing on the USB analyzer. I am going to try pass the address of the data in the Arguments1 parameter, as I do below.

I think I need to do the following, but haveven’t tried it yet:
nextStack = IoGetNextIrpStackLocation(irp);
nextStack->Parameters.Others.Argument1 = &DataToPass16Bits;

thanks
Sharon

S. Drasnin wrote:

Can somebody explain to me how the USB bus driver processes an IRP
(sent to it from a USB function driver) with major function =
IRP_MJ_DEVICE_CONTROL? How does it know to send data off to the device
and how does it know to send it endpoint 0? In general, what does the
bus driver do with this type of IRP?

The reason I ask is that I am looking at some sample Driver Studio
code that allocates an IRP and submits it. What I don’t understand is
why the IRP major code is set to IRP_MJ_DEVICE_CONTROL (it also sets
the IOCTL to a locally defined value and passes the pointer to the
parameter in Parameters.Others.Argument1). Somehow the data
submitted ends up over at the device.

Is there possibly another filter in the path? Is it, perhaps, sending
the ioctl to itself, instead of the next driver down, and allowing its
own DeviceControl handler to create the URB? Can you post a code
snippet? I’ve never seen a USB bus request that used IRP_MJ_DEVICE_CONTROL.


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

Tim: Thanks for that recommendation. You were right on about another driver handling it.

----- Original Message -----
From: Tim Roberts
To: Windows System Software Devs Interest List
Sent: Monday, August 01, 2005 5:43 PM
Subject: Re: [ntdev] Submitting IRP_MJ_DEVICE_CONTROl irps to USB bus driver

S. Drasnin wrote:

> Can somebody explain to me how the USB bus driver processes an IRP
> (sent to it from a USB function driver) with major function =
> IRP_MJ_DEVICE_CONTROL? How does it know to send data off to the device
> and how does it know to send it endpoint 0? In general, what does the
> bus driver do with this type of IRP?
>
> The reason I ask is that I am looking at some sample Driver Studio
> code that allocates an IRP and submits it. What I don’t understand is
> why the IRP major code is set to IRP_MJ_DEVICE_CONTROL (it also sets
> the IOCTL to a locally defined value and passes the pointer to the
> parameter in Parameters.Others.Argument1). Somehow the data
> submitted ends up over at the device.

Is there possibly another filter in the path? Is it, perhaps, sending
the ioctl to itself, instead of the next driver down, and allowing its
own DeviceControl handler to create the URB? Can you post a code
snippet? I’ve never seen a USB bus request that used IRP_MJ_DEVICE_CONTROL.


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


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

You are currently subscribed to ntdev as: xxxxx@msn.com
To unsubscribe send a blank email to xxxxx@lists.osr.com