problem with open bulk streams in windows 8

I am currently testing stream functionality of USB3.0 in windows 8.0. In my WDM function driver when I issue open stream request with URB type URB_FUNCTION_OPEN_STATIC_STREAMS , I am getting STATUS_INVALID_PARAMETER in iostatus and in URB status I am getting USBD_STATUS_INVALID_URB_FUNCTION. Using USBD_QueryUsbCapability() my WDM driver gets that device is superspeed and underlying Host controller is supporting 255 maximum streams.

So can anyone help me what is wrong or is I am missing something? There is no example Microsoft has provided for open stream using WDM.

One more thing My device is also supporting 2 streams and that it is reporting in its endpoint companion descriptor.

xxxxx@slscorp.com wrote:

I am currently testing stream functionality of USB3.0 in windows 8.0. In my WDM function driver when I issue open stream request with URB type URB_FUNCTION_OPEN_STATIC_STREAMS , I am getting STATUS_INVALID_PARAMETER in iostatus and in URB status I am getting USBD_STATUS_INVALID_URB_FUNCTION. Using USBD_QueryUsbCapability() my WDM driver gets that device is superspeed and underlying Host controller is supporting 255 maximum streams.

Can you show us your code? Did you already configure the device and set
up your interface?

So can anyone help me what is wrong or is I am missing something? There is no example Microsoft has provided for open stream using WDM.

That’s because there are very, very, very few good use cases. Bulk
streams were added only for the Mass Storage Class people, and even at
this point it’s not at all clear that it was worth the trouble. There’s
a relatively large amount of overhead in the USB stack to handle them.


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

I already successfully configured device and I am also getting pipe handles in interface list. That pipe handle I am using to open streams for pipe.

This is my code to prepare URB for open stream request

pStreamInfo->NumberOfStreams = supportedStreams; // min(no streams supported by host,device)

pStreamInfo->StreamList = (PUSBD_STREAM_INFORMATION)ExAllocatePoolWithTag(
NonPagedPool,
supportedStreams * sizeof(USBD_STREAM_INFORMATION),
BULKTAG);

if (pStreamInfo->StreamList == NULL) {
status = STATUS_INSUFFICIENT_RESOURCES;
goto End;
}

for(i = 0; i < supportedStreams; i++)
{
pStreamInfo->StreamList[i].StreamID = i + 1;
}

status = USBD_UrbAllocate(deviceExtension->UsbdHandle, &pUrb);

if (!NT_SUCCESS(status)){
pUrb = NULL;
status = STATUS_INSUFFICIENT_RESOURCES;
goto End;
}

pUrb->UrbOpenStaticStreams.Hdr.Length = sizeof(struct _URB_OPEN_STATIC_STREAMS);
pUrb->UrbOpenStaticStreams.Hdr.Function = URB_FUNCTION_OPEN_STATIC_STREAMS;
pUrb->UrbOpenStaticStreams.PipeHandle = Pipe->pipeInfo.PipeHandle;//Handle get from set configuration request
pUrb->UrbOpenStaticStreams.NumberOfStreams = pStreamInfo->NumberOfStreams;
pUrb->UrbOpenStaticStreams.StreamInfoSize = sizeof(USBD_STREAM_INFORMATION);
pUrb->UrbOpenStaticStreams.Streams = pStreamInfo->StreamList;
pUrb->UrbOpenStaticStreams.StreamInfoVersion = URB_OPEN_STATIC_STREAMS_VERSION_100;

// Send the URB down the stack
status = CallUSBD(DeviceObject, pUrb);

if (NT_SUCCESS(status)) {
Pipe->StreamConfigured = TRUE;
}

xxxxx@slscorp.com wrote:

I already successfully configured device and I am also getting pipe handles in interface list. That pipe handle I am using to open streams for pipe.

I don’t see any problems here. When you call this, the status you get
back from CallUSBD is STATUS_INVALID_PARAMETER?

You don’t have to fill in the StreamID in the array – the host
controller driver will do that for you. That whole structure is an output.

There is a macro to fill in the URB – UsbBuildOpenStaticStreamsRequest…

The DeviceObject in the CallUSBD call is the next driver below you?
It’s not YOUR DeviceObject?


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

Are you querying for the host controller’s streams capability at runtime before the first time you send URB_FUNCTION_OPEN_STATIC_STREAMS?

Are you allocating the URB using USBD_UrbAllocate? (http://msdn.microsoft.com/en-us/library/windows/hardware/hh450844(v=vs.85).aspx)

Tim,
I already use that macro to initialize open stream urb but I got same error as I am getting in current code.

Philip,

As i already mention I am getting 255 stream support from host and after that i am sending open stream urb for 2 streams. And for urb allocation i am using same function mention by you

Is there any suggestion for How to open static stream using WDM?

xxxxx@slscorp.com wrote:

Is there any suggestion for How to open static stream using WDM?

You didn’t answer the second of my questions in the last email. I
noticed that your call to CallUSBD passed a DeviceObject. I asked:

The DeviceObject in the CallUSBD call is the next driver below you?
It’s not YOUR DeviceObject?

because it’s common in driver routines for the variable called
“DeviceObject” to be an input to the function. In that case, it would
be your own DeviceObject, not the device object of the driver below you,
which is where the call should be targeted.


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

Hi Tim thats my customize function. I am passing DeviceObject as argument. In CallUSBD filrst I get my deviceExtension and in deviceextension I have stored Deviceobject of next driver below me. So In IoCallDriver I am passing deviceObject of next lower driver not my DeviceObject.

USBD_AssignUrbToIoStackLocation is required as well. Are you using that function in creating the IRP that you will send for opening static streams?

xxxxx@microsoft.com wrote:

USBD_AssignUrbToIoStackLocation is required as well.

Why? What does that do beyond just setting Parameters.Others.Argument1,
which has been the standard procedure since time immemorial?


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

Thanks Philip and Tim,

As per Philip suggestion, I just modified my code and now URB is completing successfully and I am getting stream Handle for each stream in structure.

Again

Thanks for Help