Isochronous transfers

bridged with qdn.public.ddk.usb
Hercot Jean-Yves

Isochronous transfers

Post by Hercot Jean-Yves » Sun Mar 16, 2003 9:30 pm

Hi,

I'am writing a class driver for a usb webcam. I have to read the images
with isochronous transfers. Could someone tell me how isochronous transfers
work with Qnx (6.2)?

Thanx

York Du

Re: Isochronous transfers

Post by York Du » Mon Mar 17, 2003 8:18 am

I am glad to see that you are doing the same work with me except fot the
qnx6.1.

I had write a driver according to the UDDK 1.0 Beta but can't get video
data.My video camera is based ov511+ and what type of IC your camera
adopted?

dolphin GmbH

Re: Isochronous transfers

Post by dolphin GmbH » Tue Mar 18, 2003 7:29 am

RTP 620A
I try the same here, but all isochronous transfers are marked as complete
with error USBD_STATUS_CMP_ERR.
I also have a question about the length parameter in the
usbd_isochronous_setup().
Is it necc. to set exactely the maximum packet size as reported in the
endpoint descriptor ?
Do I need to 're-hook' the isochronous transfer urb in the completion
callback ?
Is the length parameter in the usbd_urb_status() valid if an error is
flagged in the urb status ?
TIA, peter

"Hercot Jean-Yves" <fa063821@skynet.be> schrieb im Newsbeitrag
news:b52p8o$mu2$1@inn.qnx.com...
Hi,

I'am writing a class driver for a usb webcam. I have to read the images
with isochronous transfers. Could someone tell me how isochronous
transfers
work with Qnx (6.2)?

Thanx

Henry Van Dyke

Re: Isochronous transfers

Post by Henry Van Dyke » Tue Mar 18, 2003 1:13 pm

dolphin GmbH (pw@dolphin.de) wrote:
: RTP 620A
: I try the same here, but all isochronous transfers are marked as complete
: with error USBD_STATUS_CMP_ERR.
: I also have a question about the length parameter in the
: usbd_isochronous_setup().


What is the Error code reported ?
Has the camera been enabled ?
Have sent a vendor command to start the camera capturing ?

: Is it necc. to set exactely the maximum packet size as reported in the
: endpoint descriptor ?

Currently Yes.


: Do I need to 're-hook' the isochronous transfer urb in the completion
: callback ?

Yes.

Generally a good way to handle an isoch camera would be :
(Your camera may vary)

1. Allocate buffer space for 2 or more frames of video data;
2. Allocate a bunch of urbs and buffers for urb data.
3. Enable camera capture, compression ...
4. Enqueue all urbs ( This keeps Isoch transactions ready for device
which will improve the frame rate )
5. In the CBF copy the data from the completed urb into aproprate place
in the first buffer. Increment the buffer pointer and re-hook the Urb.
6. When a video frame is complete switch to second buffer. Data from further
completed urbs should be copied into second buffer. How you know
when a frame is complete is dependant on the camera. Could be short
transfers(less than endpoint size) or there could be a header at the
beginning of each Isoch transfer that would give you this information.
7. It might also be a good idea to keep counts of video frame data
produced by your driver and consumed by a client(display). If the first
frame hasn't been completely read yet and the second frame buffer
fills then you would re-use the second buffer and drop the frame.


: Is the length parameter in the usbd_urb_status() valid if an error is
: flagged in the urb status ?
: TIA, peter

I don't think you can count on the length being valid if there is
an error reported.


: "Hercot Jean-Yves" <fa063821@skynet.be> schrieb im Newsbeitrag
: news:b52p8o$mu2$1@inn.qnx.com...
: > Hi,
: >
: > I'am writing a class driver for a usb webcam. I have to read the images
: > with isochronous transfers. Could someone tell me how isochronous
: transfers
: > work with Qnx (6.2)?
: >
: > Thanx
: >
: >

Peter

Re: Isochronous transfers

Post by Peter » Tue Mar 18, 2003 10:10 pm

THX Henry,
the architecture is not my problem Henry. Its all done incl. double
buffering, overlay support etc.
I allocate 10 urb and 10 data buffers in a ringbuffer and it works
fine....but all callbacks
end w/ a status of USBD_STATUS_CMP_ERR. The setup_isochronous() and
usbd_io()
does not return any error. My test equipment is a PCVC680k (Philips Vesta
WebCam).
I will try to verify the enable/capture command again to be sure its
working.
TIA Henry for your help.
cheers, peter
: RTP 620A
: I try the same here, but all isochronous transfers are marked as
complete
: with error USBD_STATUS_CMP_ERR.
: I also have a question about the length parameter in the
: usbd_isochronous_setup().


What is the Error code reported ?
Has the camera been enabled ?
Yes, setup to QCIF endpoint 4, alternnate 3, using YUV420p, uncompressed.
Have sent a vendor command to start the camera capturing ?
I will verify this.

: Is it necc. to set exactely the maximum packet size as reported in the
: endpoint descriptor ?
THX ...bad technics!

Currently Yes.


: Do I need to 're-hook' the isochronous transfer urb in the completion
: callback ?

Yes.

Generally a good way to handle an isoch camera would be :
(Your camera may vary)

1. Allocate buffer space for 2 or more frames of video data;
2. Allocate a bunch of urbs and buffers for urb data.
3. Enable camera capture, compression ...
4. Enqueue all urbs ( This keeps Isoch transactions ready for device
which will improve the frame rate )
5. In the CBF copy the data from the completed urb into aproprate place
in the first buffer. Increment the buffer pointer and re-hook the
Urb.
6. When a video frame is complete switch to second buffer. Data from
further
completed urbs should be copied into second buffer. How you know
when a frame is complete is dependant on the camera. Could be short
transfers(less than endpoint size) or there could be a header at
the
beginning of each Isoch transfer that would give you this
information.
7. It might also be a good idea to keep counts of video frame data
produced by your driver and consumed by a client(display). If the
first
frame hasn't been completely read yet and the second frame buffer
fills then you would re-use the second buffer and drop the frame.


: Is the length parameter in the usbd_urb_status() valid if an error is
: flagged in the urb status ?
: TIA, peter

I don't think you can count on the length being valid if there is
an error reported.


: "Hercot Jean-Yves" <fa063821@skynet.be> schrieb im Newsbeitrag
: news:b52p8o$mu2$1@inn.qnx.com...
: > Hi,
:
: > I'am writing a class driver for a usb webcam. I have to read the
images
: > with isochronous transfers. Could someone tell me how isochronous
: transfers
: > work with Qnx (6.2)?
:
: > Thanx
:
:

Henry Van Dyke

Re: Isochronous transfers

Post by Henry Van Dyke » Wed Mar 19, 2003 1:20 pm

Peter (nospam@nospam.at.all) wrote:
: THX Henry,
: the architecture is not my problem Henry. Its all done incl. double
: buffering, overlay support etc.

Ok.

: I allocate 10 urb and 10 data buffers in a ringbuffer and it works
: fine....but all callbacks
: end w/ a status of USBD_STATUS_CMP_ERR. The setup_isochronous() and
: usbd_io()
: does not return any error. My test equipment is a PCVC680k (Philips Vesta
: WebCam).

Is there no other error reported with USBD_STATUS_CMP_ERR. If you look
in the header file "/usr/include/sys/usbdi.h" you'll see :

#define USBD_URB_STATUS_MASK 0xFF000000
#define USBD_STATUS_INPROG 0x00000000
#define USBD_STATUS_CMP 0x01000000
#define USBD_STATUS_CMP_ERR 0x02000000
#define USBD_STATUS_TIMEOUT 0x04000000
#define USBD_STATUS_ABORTED 0x08000000

#define USBD_USB_STATUS_MASK 0x00FFFFFF
#define USBD_STATUS_CRC_ERR 0x00000001
#define USBD_STATUS_BITSTUFFING 0x00000002
#define USBD_STATUS_TOGGLE_MISMATCH 0x00000003
#define USBD_STATUS_STALL 0x00000004
#define USBD_STATUS_DEV_NOANSWER 0x00000005
#define USBD_STATUS_PID_FAILURE 0x00000006
#define USBD_STATUS_BAD_PID 0x00000007
#define USBD_STATUS_DATA_OVERRUN 0x00000008
#define USBD_STATUS_DATA_UNDERRUN 0x00000009
#define USBD_STATUS_BUFFER_OVERRUN 0x0000000C
#define USBD_STATUS_BUFFER_UNDERRUN 0x0000000E
#define USBD_STATUS_NOT_ACCESSED 0x0000000F

You should see some some error code in the lower bits
of the status returned from usbd_urb_status as well
as USBD_STATUS_CMP_ERR

So if the device was stalling the Isoch request you
should see. USBD_STATUS_CMP_ERR | USBD_STATUS_STALL(0x02000004)

What chipset are running the camera on, UHCI or OHCI ?
Can you try running the USB stack with -vvvvv options
ie. deu-ohci -vvvvvv, or devu-uhci -vvvv

This will log information using slogger. Use sloginfo
to see if there are any obvious errors reported by
the USB stack.

: I will try to verify the enable/capture command again to be sure its
: working.

Ok.

Do you have a USB analyzer available ?



: TIA Henry for your help.
: cheers, peter
: > : RTP 620A
: > : I try the same here, but all isochronous transfers are marked as
: complete
: > : with error USBD_STATUS_CMP_ERR.
: > : I also have a question about the length parameter in the
: > : usbd_isochronous_setup().
: >
: >
: > What is the Error code reported ?
: > Has the camera been enabled ?
: Yes, setup to QCIF endpoint 4, alternnate 3, using YUV420p, uncompressed.
: > Have sent a vendor command to start the camera capturing ?
: I will verify this.
: >
: > : Is it necc. to set exactely the maximum packet size as reported in the
: > : endpoint descriptor ?
: THX ...bad technics!
: >
: > Currently Yes.
: >
: >
: > : Do I need to 're-hook' the isochronous transfer urb in the completion
: > : callback ?
: >
: > Yes.
: >
: > Generally a good way to handle an isoch camera would be :
: > (Your camera may vary)
: >
: > 1. Allocate buffer space for 2 or more frames of video data;
: > 2. Allocate a bunch of urbs and buffers for urb data.
: > 3. Enable camera capture, compression ...
: > 4. Enqueue all urbs ( This keeps Isoch transactions ready for device
: > which will improve the frame rate )
: > 5. In the CBF copy the data from the completed urb into aproprate place
: > in the first buffer. Increment the buffer pointer and re-hook the
: Urb.
: > 6. When a video frame is complete switch to second buffer. Data from
: further
: > completed urbs should be copied into second buffer. How you know
: > when a frame is complete is dependant on the camera. Could be short
: > transfers(less than endpoint size) or there could be a header at
: the
: > beginning of each Isoch transfer that would give you this
: information.
: > 7. It might also be a good idea to keep counts of video frame data
: > produced by your driver and consumed by a client(display). If the
: first
: > frame hasn't been completely read yet and the second frame buffer
: > fills then you would re-use the second buffer and drop the frame.
: >
: >
: > : Is the length parameter in the usbd_urb_status() valid if an error is
: > : flagged in the urb status ?
: > : TIA, peter
: >
: > I don't think you can count on the length being valid if there is
: > an error reported.
: >
: >
: > : "Hercot Jean-Yves" <fa063821@skynet.be> schrieb im Newsbeitrag
: > : news:b52p8o$mu2$1@inn.qnx.com...
: > : > Hi,
: > : >
: > : > I'am writing a class driver for a usb webcam. I have to read the
: images
: > : > with isochronous transfers. Could someone tell me how isochronous
: > : transfers
: > : > work with Qnx (6.2)?
: > : >
: > : > Thanx
: > : >
: > : >
: >

Peter

Re: Isochronous transfers

Post by Peter » Wed Mar 19, 2003 2:15 pm

: THX Henry,
: the architecture is not my problem Henry. Its all done incl. double
: buffering, overlay support etc.

Ok.

: I allocate 10 urb and 10 data buffers in a ringbuffer and it works
: fine....but all callbacks
: end w/ a status of USBD_STATUS_CMP_ERR. The setup_isochronous() and
: usbd_io()
: does not return any error. My test equipment is a PCVC680k (Philips
Vesta
: WebCam).

Is there no other error reported with USBD_STATUS_CMP_ERR. If you look
in the header file "/usr/include/sys/usbdi.h" you'll see :
No Henry :-( only the status 0x02000000)
#define USBD_URB_STATUS_MASK 0xFF000000
.....snip....
You should see some some error code in the lower bits
of the status returned from usbd_urb_status as well
as USBD_STATUS_CMP_ERR

So if the device was stalling the Isoch request you
should see. USBD_STATUS_CMP_ERR | USBD_STATUS_STALL(0x02000004)
No stall condition Henry, this is catched in the next line after
usbd_urb_status(...)
What chipset are running the camera on, UHCI or OHCI ?
UHCI
Can you try running the USB stack with -vvvvv options
ie. deu-ohci -vvvvvv, or devu-uhci -vvvv

This will log information using slogger. Use sloginfo
to see if there are any obvious errors reported by
the USB stack.
ok here it is:
Time Sev Major Minor Args
.......
Mar 19 15:30:15 2 12 0 udi_enumerate 806f014
Mar 19 15:30:16 2 12 0 CLASS_EnumerateDevice: parent 0, port 1,
speed 0
Mar 19 15:30:16 2 12 0 CLASS_EnumerateDevice: Get device
descriptor
Mar 19 15:30:16 2 12 0 CLASS_EnumerateDevice: Set address 1
Mar 19 15:30:16 2 12 0 CLASS_EnumerateDevice: Get full device
descriptor
Mar 19 15:30:16 2 12 0 CLASS_EnumerateDeviceConfiguration: Get
config descriptor
Mar 19 15:30:16 2 12 0 CLASS_EnumerateDeviceConfiguration: Get
full config descriptor
Mar 19 15:30:16 2 12 0 USB_SelectConfiguration: Set config devno
1, cfg 1
Mar 19 15:30:16 2 12 0 udi_in_out: devno 1 inserted
Mar 19 15:31:32 2 12 0 udi_enumerate 806f0a4
Mar 19 15:31:32 2 12 0 udi_in_out: devno 1 inserted
Mar 19 15:31:46 2 12 0 udi_select_interface: devno 1
Mar 19 15:31:46 2 12 0 USB_SelectInterface: Select iface devno 1,
ifc 0, alt 3
Mar 19 15:31:48 2 12 0 udi_select_interface: devno 1
Mar 19 15:31:48 2 12 0 USB_SelectInterface: Select iface devno 1,
ifc 0, alt 0
Mar 19 15:31:49 2 12 0 USB_SelectConfiguration: Set config devno
1, cfg 1
.......
from here my driver returns continously 0x0200000 status to stderr
: I will try to verify the enable/capture command again to be sure its
: working.

Ok.
Done.
BTW: I reuse the urb and the data buffer each time the CBF is invoked.
In case of a stall i reset the pipe and return w/o rehook the
isochronous.....
but this never happens.
Is it necc. to reset the urb for reuse if there is an error marked in the
status?
If I have a open pipe to the data isoch-endpoint, is it necc. to switch to
this interface
explizit bevor starting an isochronous_setup() with this pipe?
Ahhhh and....this webcam works w/ w2k, w98 and linux on the same hardware.
Do you have a USB analyzer available ?
:-( nope .....ehhhhh my wet finger :-)

TIA Henry
cheers, peter


: TIA Henry for your help.
: cheers, peter
: > : RTP 620A
: > : I try the same here, but all isochronous transfers are marked as
: complete
: > : with error USBD_STATUS_CMP_ERR.
: > : I also have a question about the length parameter in the
: > : usbd_isochronous_setup().
:
:
: > What is the Error code reported ?
: > Has the camera been enabled ?
: Yes, setup to QCIF endpoint 4, alternnate 3, using YUV420p,
uncompressed.
: > Have sent a vendor command to start the camera capturing ?
: I will verify this.
:
: > : Is it necc. to set exactely the maximum packet size as reported in
the
: > : endpoint descriptor ?
: THX ...bad technics!
:
: > Currently Yes.
:
:
: > : Do I need to 're-hook' the isochronous transfer urb in the
completion
: > : callback ?
:
: > Yes.
:
: > Generally a good way to handle an isoch camera would be :
: > (Your camera may vary)
:
: > 1. Allocate buffer space for 2 or more frames of video data;
: > 2. Allocate a bunch of urbs and buffers for urb data.
: > 3. Enable camera capture, compression ...
: > 4. Enqueue all urbs ( This keeps Isoch transactions ready for device
: > which will improve the frame rate )
: > 5. In the CBF copy the data from the completed urb into aproprate
place
: > in the first buffer. Increment the buffer pointer and re-hook
the
: Urb.
: > 6. When a video frame is complete switch to second buffer. Data
from
: further
: > completed urbs should be copied into second buffer. How you
know
: > when a frame is complete is dependant on the camera. Could be
short
: > transfers(less than endpoint size) or there could be a header
at
: the
: > beginning of each Isoch transfer that would give you this
: information.
: > 7. It might also be a good idea to keep counts of video frame data
: > produced by your driver and consumed by a client(display). If
the
: first
: > frame hasn't been completely read yet and the second frame
buffer
: > fills then you would re-use the second buffer and drop the
frame.
:
:
: > : Is the length parameter in the usbd_urb_status() valid if an error
is
: > : flagged in the urb status ?
: > : TIA, peter
:
: > I don't think you can count on the length being valid if there is
: > an error reported.
:
:
: > : "Hercot Jean-Yves" <fa063821@skynet.be> schrieb im Newsbeitrag
: > : news:b52p8o$mu2$1@inn.qnx.com...
: > : > Hi,
: > :
: > : > I'am writing a class driver for a usb webcam. I have to read the
: images
: > : > with isochronous transfers. Could someone tell me how isochronous
: > : transfers
: > : > work with Qnx (6.2)?
: > :
: > : > Thanx
: > :
: > :
:

Henry Van Dyke

Re: Isochronous transfers

Post by Henry Van Dyke » Wed Mar 19, 2003 2:50 pm

Peter (nospam@nospam.at.all) wrote:
: > : THX Henry,
: > : the architecture is not my problem Henry. Its all done incl. double
: > : buffering, overlay support etc.
: >
: > Ok.
: >
: > : I allocate 10 urb and 10 data buffers in a ringbuffer and it works
: > : fine....but all callbacks
: > : end w/ a status of USBD_STATUS_CMP_ERR. The setup_isochronous() and
: > : usbd_io()
: > : does not return any error. My test equipment is a PCVC680k (Philips
: Vesta
: > : WebCam).
: >
: > Is there no other error reported with USBD_STATUS_CMP_ERR. If you look
: > in the header file "/usr/include/sys/usbdi.h" you'll see :


: No Henry :-( only the status 0x02000000)

: >
: > #define USBD_URB_STATUS_MASK 0xFF000000
: ....snip....

: > You should see some some error code in the lower bits
: > of the status returned from usbd_urb_status as well
: > as USBD_STATUS_CMP_ERR
: >
: > So if the device was stalling the Isoch request you
: > should see. USBD_STATUS_CMP_ERR | USBD_STATUS_STALL(0x02000004)
: No stall condition Henry, this is catched in the next line after
: usbd_urb_status(...)
: >
: > What chipset are running the camera on, UHCI or OHCI ?

: UHCI

: > Can you try running the USB stack with -vvvvv options
: > ie. deu-ohci -vvvvvv, or devu-uhci -vvvv
: >
: > This will log information using slogger. Use sloginfo
: > to see if there are any obvious errors reported by
: > the USB stack.

: ok here it is:
: Time Sev Major Minor Args
: ......
: Mar 19 15:30:15 2 12 0 udi_enumerate 806f014
: Mar 19 15:30:16 2 12 0 CLASS_EnumerateDevice: parent 0, port 1,
: speed 0
: Mar 19 15:30:16 2 12 0 CLASS_EnumerateDevice: Get device
: descriptor
: Mar 19 15:30:16 2 12 0 CLASS_EnumerateDevice: Set address 1
: Mar 19 15:30:16 2 12 0 CLASS_EnumerateDevice: Get full device
: descriptor
: Mar 19 15:30:16 2 12 0 CLASS_EnumerateDeviceConfiguration: Get
: config descriptor
: Mar 19 15:30:16 2 12 0 CLASS_EnumerateDeviceConfiguration: Get
: full config descriptor
: Mar 19 15:30:16 2 12 0 USB_SelectConfiguration: Set config devno
: 1, cfg 1
: Mar 19 15:30:16 2 12 0 udi_in_out: devno 1 inserted
: Mar 19 15:31:32 2 12 0 udi_enumerate 806f0a4
: Mar 19 15:31:32 2 12 0 udi_in_out: devno 1 inserted
: Mar 19 15:31:46 2 12 0 udi_select_interface: devno 1
: Mar 19 15:31:46 2 12 0 USB_SelectInterface: Select iface devno 1,
: ifc 0, alt 3
: Mar 19 15:31:48 2 12 0 udi_select_interface: devno 1
: Mar 19 15:31:48 2 12 0 USB_SelectInterface: Select iface devno 1,
: ifc 0, alt 0
: Mar 19 15:31:49 2 12 0 USB_SelectConfiguration: Set config devno
: 1, cfg 1
: ......
: from here my driver returns continously 0x0200000 status to stderr


: >
: > : I will try to verify the enable/capture command again to be sure its
: > : working.
: >
: > Ok.
: Done.
: BTW: I reuse the urb and the data buffer each time the CBF is invoked.
: In case of a stall i reset the pipe and return w/o rehook the
: isochronous.....
: but this never happens.

could you post some code snippets of where you initially setup the isoch
urbs and where you re-hook them in your callback function?

: Is it necc. to reset the urb for reuse if there is an error marked in the
: status?

If an error is reported or not you, you should do a
usbd_setup_isochronous() for the urb before it gets re-hooked with
usbd_io().

: If I have a open pipe to the data isoch-endpoint, is it necc. to switch to
: this interface
: explizit bevor starting an isochronous_setup() with this pipe?


I'm not sure I understand this question.

If your device as multiple interfaces or alternates then you should
issue a usbd_select_interface() command to select the interface for which
the endpoints you are using.


: Ahhhh and....this webcam works w/ w2k, w98 and linux on the same hardware.

: >
: > Do you have a USB analyzer available ?

: :-( nope .....ehhhhh my wet finger :-)

: TIA Henry
: cheers, peter
: >
: >
: >
: > : TIA Henry for your help.
: > : cheers, peter
: > : > : RTP 620A
: > : > : I try the same here, but all isochronous transfers are marked as
: > : complete
: > : > : with error USBD_STATUS_CMP_ERR.
: > : > : I also have a question about the length parameter in the
: > : > : usbd_isochronous_setup().
: > : >
: > : >
: > : > What is the Error code reported ?
: > : > Has the camera been enabled ?
: > : Yes, setup to QCIF endpoint 4, alternnate 3, using YUV420p,
: uncompressed.
: > : > Have sent a vendor command to start the camera capturing ?
: > : I will verify this.
: > : >
: > : > : Is it necc. to set exactely the maximum packet size as reported in
: the
: > : > : endpoint descriptor ?
: > : THX ...bad technics!
: > : >
: > : > Currently Yes.
: > : >
: > : >
: > : > : Do I need to 're-hook' the isochronous transfer urb in the
: completion
: > : > : callback ?
: > : >
: > : > Yes.
: > : >
: > : > Generally a good way to handle an isoch camera would be :
: > : > (Your camera may vary)
: > : >
: > : > 1. Allocate buffer space for 2 or more frames of video data;
: > : > 2. Allocate a bunch of urbs and buffers for urb data.
: > : > 3. Enable camera capture, compression ...
: > : > 4. Enqueue all urbs ( This keeps Isoch transactions ready for device
: > : > which will improve the frame rate )
: > : > 5. In the CBF copy the data from the completed urb into aproprate
: place
: > : > in the first buffer. Increment the buffer pointer and re-hook
: the
: > : Urb.
: > : > 6. When a video frame is complete switch to second buffer. Data
: from
: > : further
: > : > completed urbs should be copied into second buffer. How you
: know
: > : > when a frame is complete is dependant on the camera. Could be
: short
: > : > transfers(less than endpoint size) or there could be a header
: at
: > : the
: > : > beginning of each Isoch transfer that would give you this
: > : information.
: > : > 7. It might also be a good idea to keep counts of video frame data
: > : > produced by your driver and consumed by a client(display). If
: the
: > : first
: > : > frame hasn't been completely read yet and the second frame
: buffer
: > : > fills then you would re-use the second buffer and drop the
: frame.
: > : >
: > : >
: > : > : Is the length parameter in the usbd_urb_status() valid if an error
: is
: > : > : flagged in the urb status ?
: > : > : TIA, peter
: > : >
: > : > I don't think you can count on the length being valid if there is
: > : > an error reported.
: > : >
: > : >
: > : > : "Hercot Jean-Yves" <fa063821@skynet.be> schrieb im Newsbeitrag
: > : > : news:b52p8o$mu2$1@inn.qnx.com...
: > : > : > Hi,
: > : > : >
: > : > : > I'am writing a class driver for a usb webcam. I have to read the
: > : images
: > : > : > with isochronous transfers. Could someone tell me how isochronous
: > : > : transfers
: > : > : > work with Qnx (6.2)?
: > : > : >
: > : > : > Thanx
: > : > : >
: > : > : >
: > : >
: >
: >

Peter

Re: Isochronous transfers

Post by Peter » Wed Mar 19, 2003 4:41 pm

INIT:
for (i = 0; i < MAX_ISO_BUFS; i++)
{
urb = pdev->sbuf.urb;
usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, pdev->sbuf.data,
pdev->vmax_packet_size);
usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler, pdev->sbuf.data,
USBD_TIME_INFINITY);
}

// callback
static void
pwc_isoc_handler(struct usbd_urb *urb, struct usbd_pipe *pipe, void *hdl) {
usbd_urb_status( urb, &fst, &flen );
if( ( fst & USBD_URB_STATUS_MASK ) != USBD_STATUS_CMP )
{
// check for a stall condition and clear it
if( ( fst & USBD_USB_STATUS_MASK ) == USBD_STATUS_STALL )
{
usbd_reset_pipe( pipe );
if( cam.verbose )
Trace("pwc_isoc_handler: STALL ustatus %x, %d", fst, flen);
}
if( cam.verbose )
Trace("pwc_isoc_handler: ustatus %x, %d", fst, flen );
return;
}
......
usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, hdl, pdev->vmax_packet_size);
usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler, hdl, USBD_TIME_INFINITY);
}

Henry Van Dyke

Re: Isochronous transfers

Post by Henry Van Dyke » Wed Mar 19, 2003 5:21 pm

Peter (nospam@nospam.at.all) wrote:
: INIT:
: for (i = 0; i < MAX_ISO_BUFS; i++)
: {
: urb = pdev->sbuf.urb;
: usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, pdev->sbuf.data,
: pdev->vmax_packet_size);
: usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler, pdev->sbuf.data,
: USBD_TIME_INFINITY);
: }

Try setting the direction flag URB_DIR_IN



: // callback
: static void
: pwc_isoc_handler(struct usbd_urb *urb, struct usbd_pipe *pipe, void *hdl) {
: usbd_urb_status( urb, &fst, &flen );
: if( ( fst & USBD_URB_STATUS_MASK ) != USBD_STATUS_CMP )
: {
: // check for a stall condition and clear it
: if( ( fst & USBD_USB_STATUS_MASK ) == USBD_STATUS_STALL )
: {
: usbd_reset_pipe( pipe );
: if( cam.verbose )
: Trace("pwc_isoc_handler: STALL ustatus %x, %d", fst, flen);
: }
: if( cam.verbose )
: Trace("pwc_isoc_handler: ustatus %x, %d", fst, flen );
: return;
: }
: .....
: usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, hdl, pdev->vmax_packet_size);
: usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler, hdl, USBD_TIME_INFINITY);
: }

Henry Van Dyke

Re: Isochronous transfers

Post by Henry Van Dyke » Wed Mar 19, 2003 6:20 pm

Peter (nospam@nospam.at.all) wrote:
: Ohhhh, yeah....now its working.

Thats good to hear

: damn I was looking over the code again and again and the doc says
: 'one of these flags'....but of course, the setup needs a direction.
: Henry, thank you very much for your help, you are my hero :-)
: cheers, peter

Your welcome..
I'm glad it didn't turn out to be anything too serious 8-)



: "Henry Van Dyke" <henry@93.com> schrieb im Newsbeitrag
: news:b5a8v9$l6k$1@nntp.qnx.com...
: > Peter (nospam@nospam.at.all) wrote:
: > : INIT:
: > : for (i = 0; i < MAX_ISO_BUFS; i++)
: > : {
: > : urb = pdev->sbuf.urb;
: > : usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, pdev->sbuf.data,
: > : pdev->vmax_packet_size);
: > : usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler, pdev->sbuf.data,
: > : USBD_TIME_INFINITY);
: > : }
: >
: > Try setting the direction flag URB_DIR_IN
: >
: >
: >
: > : // callback
: > : static void
: > : pwc_isoc_handler(struct usbd_urb *urb, struct usbd_pipe *pipe, void
: *hdl) {
: > : usbd_urb_status( urb, &fst, &flen );
: > : if( ( fst & USBD_URB_STATUS_MASK ) != USBD_STATUS_CMP )
: > : {
: > : // check for a stall condition and clear it
: > : if( ( fst & USBD_USB_STATUS_MASK ) == USBD_STATUS_STALL )
: > : {
: > : usbd_reset_pipe( pipe );
: > : if( cam.verbose )
: > : Trace("pwc_isoc_handler: STALL ustatus %x, %d", fst, flen);
: > : }
: > : if( cam.verbose )
: > : Trace("pwc_isoc_handler: ustatus %x, %d", fst, flen );
: > : return;
: > : }
: > : .....
: > : usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, hdl,
: pdev->vmax_packet_size);
: > : usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler, hdl,
: USBD_TIME_INFINITY);
: > : }
: >
: >

Peter

Re: Isochronous transfers

Post by Peter » Wed Mar 19, 2003 6:29 pm

Ohhhh, yeah....now its working.
damn I was looking over the code again and again and the doc says
'one of these flags'....but of course, the setup needs a direction.
Henry, thank you very much for your help, you are my hero :-)
cheers, peter

"Henry Van Dyke" <henry@93.com> schrieb im Newsbeitrag
news:b5a8v9$l6k$1@nntp.qnx.com...
Peter (nospam@nospam.at.all) wrote:
: INIT:
: for (i = 0; i < MAX_ISO_BUFS; i++)
: {
: urb = pdev->sbuf.urb;
: usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, pdev->sbuf.data,
: pdev->vmax_packet_size);
: usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler, pdev->sbuf.data,
: USBD_TIME_INFINITY);
: }

Try setting the direction flag URB_DIR_IN



: // callback
: static void
: pwc_isoc_handler(struct usbd_urb *urb, struct usbd_pipe *pipe, void
*hdl) {
: usbd_urb_status( urb, &fst, &flen );
: if( ( fst & USBD_URB_STATUS_MASK ) != USBD_STATUS_CMP )
: {
: // check for a stall condition and clear it
: if( ( fst & USBD_USB_STATUS_MASK ) == USBD_STATUS_STALL )
: {
: usbd_reset_pipe( pipe );
: if( cam.verbose )
: Trace("pwc_isoc_handler: STALL ustatus %x, %d", fst, flen);
: }
: if( cam.verbose )
: Trace("pwc_isoc_handler: ustatus %x, %d", fst, flen );
: return;
: }
: .....
: usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, hdl,
pdev->vmax_packet_size);
: usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler, hdl,
USBD_TIME_INFINITY);
: }


Hercot Jean-Yves

Re: Isochronous transfers

Post by Hercot Jean-Yves » Wed Mar 19, 2003 6:32 pm

Henry > I'll test all you have said about the isochronous transfers. I'll
post my question here if it doesn't work... ;-)

Thanx

"Henry Van Dyke" <henry@93.com> a écrit dans le message news:
b5acdd$ni0$1@nntp.qnx.com...
Peter (nospam@nospam.at.all) wrote:
: Ohhhh, yeah....now its working.

Thats good to hear

: damn I was looking over the code again and again and the doc says
: 'one of these flags'....but of course, the setup needs a direction.
: Henry, thank you very much for your help, you are my hero :-)
: cheers, peter

Your welcome..
I'm glad it didn't turn out to be anything too serious 8-)



: "Henry Van Dyke" <henry@93.com> schrieb im Newsbeitrag
: news:b5a8v9$l6k$1@nntp.qnx.com...
: > Peter (nospam@nospam.at.all) wrote:
: > : INIT:
: > : for (i = 0; i < MAX_ISO_BUFS; i++)
: > : {
: > : urb = pdev->sbuf.urb;
: > : usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, pdev->sbuf.data,
: > : pdev->vmax_packet_size);
: > : usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler,
pdev->sbuf.data,
: > : USBD_TIME_INFINITY);
: > : }
:
: > Try setting the direction flag URB_DIR_IN
:
:
:
: > : // callback
: > : static void
: > : pwc_isoc_handler(struct usbd_urb *urb, struct usbd_pipe *pipe, void
: *hdl) {
: > : usbd_urb_status( urb, &fst, &flen );
: > : if( ( fst & USBD_URB_STATUS_MASK ) != USBD_STATUS_CMP )
: > : {
: > : // check for a stall condition and clear it
: > : if( ( fst & USBD_USB_STATUS_MASK ) == USBD_STATUS_STALL )
: > : {
: > : usbd_reset_pipe( pipe );
: > : if( cam.verbose )
: > : Trace("pwc_isoc_handler: STALL ustatus %x, %d", fst, flen);
: > : }
: > : if( cam.verbose )
: > : Trace("pwc_isoc_handler: ustatus %x, %d", fst, flen );
: > : return;
: > : }
: > : .....
: > : usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, hdl,
: pdev->vmax_packet_size);
: > : usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler, hdl,
: USBD_TIME_INFINITY);
: > : }
:
:


Hercot Jean-Yves

Re: Isochronous transfers

Post by Hercot Jean-Yves » Wed Mar 19, 2003 8:43 pm

I have tried and it doesn't work :-(.

I have checked my code with Peter's one and it seems similar. When I setup
an isochronous I receive the callback (even if I don't enable Isoch
transfers on the cam) but the urb_status is set to 0x02040932.

The results of usb -vvv seems correct and the cam works well under windows
on the same computer.

I have noticed that the value returned by usbd_pipe_endpoint is 0 for the
control pipe and 129 for the Isoch/in pipe (it should be 1). It also
returns 129 with the other alternate settings.

Help me!!!! :-p

"Hercot Jean-Yves" <fa063821@skynet.be> a écrit dans le message news:
b5abul$f7k$1@inn.qnx.com...
Henry > I'll test all you have said about the isochronous transfers. I'll
post my question here if it doesn't work... ;-)

Thanx

"Henry Van Dyke" <henry@93.com> a écrit dans le message news:
b5acdd$ni0$1@nntp.qnx.com...
Peter (nospam@nospam.at.all) wrote:
: Ohhhh, yeah....now its working.

Thats good to hear

: damn I was looking over the code again and again and the doc says
: 'one of these flags'....but of course, the setup needs a direction.
: Henry, thank you very much for your help, you are my hero :-)
: cheers, peter

Your welcome..
I'm glad it didn't turn out to be anything too serious 8-)



: "Henry Van Dyke" <henry@93.com> schrieb im Newsbeitrag
: news:b5a8v9$l6k$1@nntp.qnx.com...
: > Peter (nospam@nospam.at.all) wrote:
: > : INIT:
: > : for (i = 0; i < MAX_ISO_BUFS; i++)
: > : {
: > : urb = pdev->sbuf.urb;
: > : usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, pdev->sbuf.data,
: > : pdev->vmax_packet_size);
: > : usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler,
pdev->sbuf.data,
: > : USBD_TIME_INFINITY);
: > : }
:
: > Try setting the direction flag URB_DIR_IN
:
:
:
: > : // callback
: > : static void
: > : pwc_isoc_handler(struct usbd_urb *urb, struct usbd_pipe *pipe,
void
: *hdl) {
: > : usbd_urb_status( urb, &fst, &flen );
: > : if( ( fst & USBD_URB_STATUS_MASK ) != USBD_STATUS_CMP )
: > : {
: > : // check for a stall condition and clear it
: > : if( ( fst & USBD_USB_STATUS_MASK ) == USBD_STATUS_STALL )
: > : {
: > : usbd_reset_pipe( pipe );
: > : if( cam.verbose )
: > : Trace("pwc_isoc_handler: STALL ustatus %x, %d", fst, flen);
: > : }
: > : if( cam.verbose )
: > : Trace("pwc_isoc_handler: ustatus %x, %d", fst, flen );
: > : return;
: > : }
: > : .....
: > : usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, hdl,
: pdev->vmax_packet_size);
: > : usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler, hdl,
: USBD_TIME_INFINITY);
: > : }
:
:




Henry Van Dyke

Re: Isochronous transfers

Post by Henry Van Dyke » Wed Mar 19, 2003 9:46 pm

Hercot Jean-Yves (fa063821@skynet.be) wrote:
: I have tried and it doesn't work :-(.

: I have checked my code with Peter's one and it seems similar. When I setup
: an isochronous I receive the callback (even if I don't enable Isoch
: transfers on the cam) but the urb_status is set to 0x02040932.

This doesn't like a valid urb_status at all.

What USB controller chip are you running on.
Could you post code snippets of where you are
enqueuing the urbs ?

: The results of usb -vvv seems correct and the cam works well under windows
: on the same computer.

: I have noticed that the value returned by usbd_pipe_endpoint is 0 for the
: control pipe and 129 for the Isoch/in pipe (it should be 1). It also
: returns 129 with the other alternate settings.

129 = 0x81

upper 4bits give direction(In) and lower 4 bits are the endpoint number.


: Help me!!!! :-p

: "Hercot Jean-Yves" <fa063821@skynet.be> a écrit dans le message news:
: b5abul$f7k$1@inn.qnx.com...
: > Henry > I'll test all you have said about the isochronous transfers. I'll
: > post my question here if it doesn't work... ;-)
: >
: > Thanx
: >
: > "Henry Van Dyke" <henry@93.com> a écrit dans le message news:
: > b5acdd$ni0$1@nntp.qnx.com...
: > > Peter (nospam@nospam.at.all) wrote:
: > > : Ohhhh, yeah....now its working.
: > >
: > > Thats good to hear
: > >
: > > : damn I was looking over the code again and again and the doc says
: > > : 'one of these flags'....but of course, the setup needs a direction.
: > > : Henry, thank you very much for your help, you are my hero :-)
: > > : cheers, peter
: > >
: > > Your welcome..
: > > I'm glad it didn't turn out to be anything too serious 8-)
: > >
: > >
: > >
: > > : "Henry Van Dyke" <henry@93.com> schrieb im Newsbeitrag
: > > : news:b5a8v9$l6k$1@nntp.qnx.com...
: > > : > Peter (nospam@nospam.at.all) wrote:
: > > : > : INIT:
: > > : > : for (i = 0; i < MAX_ISO_BUFS; i++)
: > > : > : {
: > > : > : urb = pdev->sbuf.urb;
: > > : > : usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, pdev->sbuf.data,
: > > : > : pdev->vmax_packet_size);
: > > : > : usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler,
: > pdev->sbuf.data,
: > > : > : USBD_TIME_INFINITY);
: > > : > : }
: > > : >
: > > : > Try setting the direction flag URB_DIR_IN
: > > : >
: > > : >
: > > : >
: > > : > : // callback
: > > : > : static void
: > > : > : pwc_isoc_handler(struct usbd_urb *urb, struct usbd_pipe *pipe,
: void
: > > : *hdl) {
: > > : > : usbd_urb_status( urb, &fst, &flen );
: > > : > : if( ( fst & USBD_URB_STATUS_MASK ) != USBD_STATUS_CMP )
: > > : > : {
: > > : > : // check for a stall condition and clear it
: > > : > : if( ( fst & USBD_USB_STATUS_MASK ) == USBD_STATUS_STALL )
: > > : > : {
: > > : > : usbd_reset_pipe( pipe );
: > > : > : if( cam.verbose )
: > > : > : Trace("pwc_isoc_handler: STALL ustatus %x, %d", fst, flen);
: > > : > : }
: > > : > : if( cam.verbose )
: > > : > : Trace("pwc_isoc_handler: ustatus %x, %d", fst, flen );
: > > : > : return;
: > > : > : }
: > > : > : .....
: > > : > : usbd_setup_isochronous(urb, URB_ISOCH_ASAP, 0, hdl,
: > > : pdev->vmax_packet_size);
: > > : > : usbd_io(urb, pdev->ep_iso_pipe, pwc_isoc_handler, hdl,
: > > : USBD_TIME_INFINITY);
: > > : > : }
: > > : >
: > > : >
: > >
: > >
: >
: >

Post Reply

Return to “qdn.public.ddk.usb”