Re: Advice needed concerning ISOC transactions for a webcam

Ilyes Gouta <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Hi Alan,

Thanks for the reply.

Well, the webcam (0402:5602) is a USB 2.0 Camera that comes embedded into laptops (ex: Acer).
Here is the output of lsusb -v:

Bus 001 Device 003: ID 0402:5602 ALi Corp.
Device Descriptor:
   bLength                18
   bDescriptorType         1
   bcdUSB               2.00
   bDeviceClass            0 (Defined at Interface level)
   bDeviceSubClass         0
   bDeviceProtocol         0
   bMaxPacketSize0        64
   idVendor           0x0402 ALi Corp.
   idProduct          0x5602
   bcdDevice            1.00
   iManufacturer           0
   iProduct                1 USB2.0 Camera
   iSerial                 0
   bNumConfigurations      1
   Configuration Descriptor:
     bLength                 9
     bDescriptorType         2
     wTotalLength          101
     bNumInterfaces          1
     bConfigurationValue     1
     iConfiguration          0
     bmAttributes         0xa0
       Remote Wakeup
     MaxPower              500mA
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        0
       bAlternateSetting       0
       bNumEndpoints           2
       bInterfaceClass       255 Vendor Specific Class
       bInterfaceSubClass    255 Vendor Specific Subclass
       bInterfaceProtocol    255 Vendor Specific Protocol
       iInterface              0
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x81  EP 1 IN
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0000  1x 0 bytes
         bInterval               1
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x82  EP 2 IN
         bmAttributes            3
           Transfer Type            Interrupt
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0000  1x 0 bytes
         bInterval               4
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        0
       bAlternateSetting       1
       bNumEndpoints           2
       bInterfaceClass       255 Vendor Specific Class
       bInterfaceSubClass    255 Vendor Specific Subclass
       bInterfaceProtocol    255 Vendor Specific Protocol
       iInterface              0
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x81  EP 1 IN
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x1400  3x 0 bytes
         bInterval               1
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x82  EP 2 IN
         bmAttributes            3
           Transfer Type            Interrupt
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0010  1x 16 bytes
         bInterval               4
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        0
       bAlternateSetting       2
       bNumEndpoints           2
       bInterfaceClass       255 Vendor Specific Class
       bInterfaceSubClass    255 Vendor Specific Subclass
       bInterfaceProtocol    255 Vendor Specific Protocol
       iInterface              0
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x81  EP 1 IN
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x1380  3x 896 bytes
         bInterval               1
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x82  EP 2 IN
         bmAttributes            3
           Transfer Type            Interrupt
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0010  1x 16 bytes
         bInterval               4
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        0
       bAlternateSetting       3
       bNumEndpoints           2
       bInterfaceClass       255 Vendor Specific Class
       bInterfaceSubClass    255 Vendor Specific Subclass
       bInterfaceProtocol    255 Vendor Specific Protocol
       iInterface              0
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x81  EP 1 IN
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x1300  3x 768 bytes
         bInterval               1
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x82  EP 2 IN
         bmAttributes            3
           Transfer Type            Interrupt
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0010  1x 16 bytes
         bInterval               4
Device Qualifier (for other device speed):
   bLength                10
   bDescriptorType         6
   bcdUSB               2.00
   bDeviceClass            0 (Defined at Interface level)
   bDeviceSubClass         0
   bDeviceProtocol         0
   bMaxPacketSize0        64
   bNumConfigurations      1

The camera is high-speed capable and I'm not really managing any polling interval (and why I need this? ISOCs should be 
self-sustainable). I start by allocating ISOCs URBs, fill the fields accordingly and submit them. Once an ISOC URB comes 
back the system calls my completion handler, I process it and resubmit it. Standard procedure. The problem is that 
sometimes, URBs don't come back (or seems so). Is it possible that I'm using the wrong alternate setting? I have to 
check this...

BR,
Ilyes Gouta.

Alan Stern wrote:
> hOn Sun, 7 Oct 2007, Ilyes Gouta wrote:
> 
>> Hi!
>>
>> I'm writing a driver for a webcam for Linux. The cam is based on ALi's
>> M5602 USB bridge and I pretty much got it almost working since I'm
>> able to get the raw bayer data from it.
>>
>> I'm however facing a strange behaviour since sometimes the cam seems
>> stuck (after getting it correctly initialized and all) and doesn't
>> want to exchange ISOCs packets.
> 
> Can you be more precise?  What exactly goes wrong?
> 
> More background would help.  Is the camera a full-speed or high-speed 
> device?  What is the Iso polling interval?  Which host controller 
> driver are you using?  What does the debugging log show?
> 
>>  Unloading the driver and reinserting
>> it repeatedly (without recompilation) , fixes the issue, i.e I get the
>> ISOCs packets flowing again between the host and the webcam.
>>
>> The other day, I added a added a couple of printk in my
>> isoc_urb_complete handler and got my driver working again, not all the
>> time but it was better than without them. So this suggested to me that
>> the host is kind of faster than the webcam (???) and which expects
>> ISOCs to be resubmited in a slower pace or something.
>>
>> I'd really want to know if some body came across such a situation and
>> if it really make sense to slowdown ISOC URBs re-submission. Is it
>> possible that ALi's M5602 USB bridge is kind of faulty and is causing
>> these troubles?
> 
> It seems unlikely.  Historically the Iso support has been the weakest 
> part of Linux's IP stack; you may be encountering some of those 
> problems.
> 
> Alan Stern
> 
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.