Read data transfer length...

bridged with qdn.public.ddk.usb
Post Reply
David Raimond

Read data transfer length...

Post by David Raimond » Wed Dec 05, 2001 6:13 pm

Hello,

When i format a read bulk (or interrupt) urb, with the last
usbd_setup_bulk() parameter which is not equal to the pipe
wmMaxPacketSize, the next usbd_urb_status() function returns an EIO
error with an USBD_STATUS_CMP_ERR completion status. Does it mean that
the read request data transfer length must always be equal to the
wmMaxPacketSize ? According to the DDK documentation, this error code
means that the transfer is completed but an error occured... The problem
is that the data buffer is not correctly filled. On the other hand, when
the last parameter of the setup function is equal to the wmMaxPacketSize
of the pipe, everything is ok...

Does anyone have an idea ?

Target = x86 / QNX6.10

Thanks for your help,
Regards,
David.

David Raimond

Re: Read data transfer length...

Post by David Raimond » Fri Dec 07, 2001 7:23 pm

Hello all,

It seems that this status code appears, on a bulk transfer, with the
three following conditions :

1/ You format an urb with a data buffer length which is not a multiple
of wmPacketSize.
2/ The data frame from the device has a length which is a multiple of
this wmPacketSize.
3/ The device doesn't send a NULL packet a the end of the frame.

The reason seems to be that the usb stack gives the hand back to the
client when one of the following conditions appears :

1/ The requested data length is exactly received.
2/ A NULL data packet is received.
3/ An incomplete (not equal to wmPacketSize) data frame is received.

So, if the requested data stage(in the usbd_setup_bulk function) is not
a multiple of wmPacketSize and that the device doesn't send a NULL
packet after a data stage which is a multiple of wmPacketSize, the usb
stack waits (the client is blocked) for the next data stage to fill the
client buffer. When the next frame appears, there is not enough room in
the client buffer to copy all data of the second data stage... the
usbd_status_urb function returns an EIO error with a read completion
status of USBD_STATUS_CMP_ERR...
To avoid this error, you must always format the urb (usbd_setup_bulk
function) where data stage length is a multiple of wmPacketSize...

Now, I don't understand why this doesn't work on an interrupt pipe...
Let's take an example :
Mouse wmPacketSize = 4 (Interrupt pipe)
If I format the urb with a data length of 4, it works very well.
If I format the urb with a data length of 8, it doesn't work (the
previous error is returned by the usbd_status_urb function).
The mouse data packet have a length of 4 bytes and no NULL packet are
send after a data stage. I tried with on a full speed device interrupt
pipe and the result is the same.

If anyone has an idea...
Thanks for your help !
Regards.

David.





David Raimond wrote:
Hello,

When i format a read bulk (or interrupt) urb, with the last
usbd_setup_bulk() parameter which is not equal to the pipe
wmMaxPacketSize, the next usbd_urb_status() function returns an EIO
error with an USBD_STATUS_CMP_ERR completion status. Does it mean that
the read request data transfer length must always be equal to the
wmMaxPacketSize ? According to the DDK documentation, this error code
means that the transfer is completed but an error occured... The problem
is that the data buffer is not correctly filled. On the other hand, when
the last parameter of the setup function is equal to the wmMaxPacketSize
of the pipe, everything is ok...

Does anyone have an idea ?

Target = x86 / QNX6.10

Thanks for your help,
Regards,
David.

Post Reply

Return to “qdn.public.ddk.usb”