public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* uvcvideo: Trying to lower the URB buffers on eMPIA minicam
@ 2013-04-24 22:47 Pierre ANTOINE
  2013-04-25 11:36 ` Laurent Pinchart
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre ANTOINE @ 2013-04-24 22:47 UTC (permalink / raw)
  To: linux-media

Hello guys,

My nickname is Nunux, I'm a geek, and need some help ...

I just buy ten minicam to do a poker TV table.
The minicam are eMPIA: eb1a:299f

I've a PC with 1 internal USB BUS 2.0 and 3 PCI extension cards USB BUS 2.0

Currently, I can have only one cam eMPIA working per USB BUS but no more
even if I set the lower resolution of 160x120.

[ 2768.783291] uvcvideo: Device requested 1024 B/frame bandwidth.
[ 2768.783295] uvcvideo: Selecting alternate setting 4 (2736 B/frame bandwidth).
[ 2768.783641] uvcvideo: Allocated 5 URB buffers of 15x2736 bytes each.
[ 2768.783664] uvcvideo: Failed to submit URB 0 (-28).

So I can have 4 minicam at a time, but need 10.

I'm running Linux 3.5.0 on Ubuntu.

pierre@SuperTable:/usr/src/linux-source-3.5.0/linux-source-3.5.0/drivers/media/video/uvc$
uvcdynctrl -f -d /dev/video0
Listing available frame formats for device /dev/video0:
Pixel format: YUYV (YUV 4:2:2 (YUYV); MIME type: video/x-raw-yuv)
  Frame size: 640x480
    Frame rates: 30
  Frame size: 160x120
    Frame rates: 30
  Frame size: 176x144
    Frame rates: 30
  Frame size: 320x240
    Frame rates: 30
  Frame size: 352x288
    Frame rates: 30
  Frame size: 640x480
    Frame rates: 30

I try to patch uvc_video.c like this:
                /* Isochronous endpoint, select the alternate setting. */
                //bandwidth = stream->ctrl.dwMaxPayloadTransferSize;
                bandwidth = 1024;


That help me to reduce the USB bandwidth down to 1024 on a Microsoft LifeCam
Cinema:

[  944.410066] USB Video Class driver (1.1.1)
[  948.636665] uvcvideo: Device requested 1024 B/frame bandwidth.
[  948.636670] uvcvideo: Selecting alternate setting 4 (1024 B/frame bandwidth).
[  948.912793] uvcvideo: Allocated 5 URB buffers of 32x1024 bytes each.

And allow me to run up to 3 Microsoft LifeCam Cinema on the same PCI USB Card.

But it's not working on eMPIA minicam:

[  982.488896] uvcvideo: Device requested 1024 B/frame bandwidth.
[  982.488901] uvcvideo: Selecting alternate setting 4 (2736 B/frame bandwidth).
[  982.489355] uvcvideo: Allocated 5 URB buffers of 32x2736 bytes each.

Because even if the request bandwdith is fixed to 1024, there is no endpoint
with such lower bandwidth.

--------------

So my question is, is it possible to lower the bandwidth of the endpoint,
or use a different bandwidth, or the do anything to run 3 cams per usb ports ?

I host a mini poker mtt for my wife birthday this saturday, and hope get some
thing to work before...

So any help or comments would be really appreciated,

Many regards,

Nunux

------------------------------------------------

Bus 004 Device 002: ID eb1a:299f eMPIA Technology, Inc.
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0xeb1a eMPIA Technology, Inc.
  idProduct          0x299f
  bcdDevice            0.05
  iManufacturer           1
  iProduct                2
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          441
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass         14 Video
      bFunctionSubClass       3 Video Interface Collection
      bFunctionProtocol       0
      iFunction               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      1 Video Control
      bInterfaceProtocol      0
      iInterface              0
      VideoControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdUVC               1.00
        wTotalLength           77
        dwClockFrequency       30.000000MHz
        bInCollection           1
        baInterfaceNr( 0)       1
      VideoControl Interface Descriptor:
        bLength                18
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0201 Camera Sensor
        bAssocTerminal          0
        iTerminal               0
        wObjectiveFocalLengthMin      0
        wObjectiveFocalLengthMax      0
        wOcularFocalLength            0
        bControlSize                  3
        bmControls           0x00000004
          Auto-Exposure Priority
      VideoControl Interface Descriptor:
        bLength                26
        bDescriptorType        36
        bDescriptorSubtype      6 (EXTENSION_UNIT)
        bUnitID                 2
        guidExtensionCode         {92423946-d10c-e34a-8783-3133f9eaaa3b}
        bNumControl             3
        bNrPins                 1
        baSourceID( 0)          1
        bControlSize            1
        bmControls( 0)       0xff
        iExtension              0
      VideoControl Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      5 (PROCESSING_UNIT)
      Warning: Descriptor too short
        bUnitID                 3
        bSourceID               2
        wMaxMultiplier          0
        bControlSize            2
        bmControls     0x0000157f
          Brightness
          Contrast
          Hue
          Saturation
          Sharpness
          Gamma
          White Balance Temperature
          Backlight Compensation
          Power Line Frequency
          White Balance Temperature, Auto
        iProcessing             0
        bmVideoStandards     0x 9
          None
          SECAM - 625/50
      VideoControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             4
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID               3
        iTerminal               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              16
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      VideoStreaming Interface Descriptor:
        bLength                            14
        bDescriptorType                    36
        bDescriptorSubtype                  1 (INPUT_HEADER)
        bNumFormats                         1
        wTotalLength                      253
        bEndPointAddress                  129
        bmInfo                              0
        bTerminalLink                       4
        bStillCaptureMethod                 2
        bTriggerSupport                     0
        bTriggerUsage                       0
        bControlSize                        1
        bmaControls( 0)                    27
      VideoStreaming Interface Descriptor:
        bLength                            27
        bDescriptorType                    36
        bDescriptorSubtype                  4 (FORMAT_UNCOMPRESSED)
        bFormatIndex                        1
        bNumFrameDescriptors                6
        guidFormat
{59555932-0000-1000-8000-00aa00389b71}
        bBitsPerPixel                      16
        bDefaultFrameIndex                  1
        bAspectRatioX                       0
        bAspectRatioY                       0
        bmInterlaceFlags                 0x00
          Interlaced stream or variable: No
          Fields per frame: 2 fields
          Field 1 first: No
          Field pattern: Field 1 only
          bCopyProtect                      0
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         1
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            640
        wHeight                           480
        dwMinBitRate                147456000
        dwMaxBitRate                147456000
        dwMaxVideoFrameBufferSize      614400
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         2
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            160
        wHeight                           120
        dwMinBitRate                  9216000
        dwMaxBitRate                  9216000
        dwMaxVideoFrameBufferSize       38400
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         3
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            176
        wHeight                           144
        dwMinBitRate                 12165120
        dwMaxBitRate                 12165120
        dwMaxVideoFrameBufferSize       50688
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         4
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            320
        wHeight                           240
        dwMinBitRate                 36864000
        dwMaxBitRate                 36864000
        dwMaxVideoFrameBufferSize      153600
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         5
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            352
        wHeight                           288
        dwMinBitRate                 48660480
        dwMaxBitRate                 48660480
        dwMaxVideoFrameBufferSize      202752
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         6
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            640
        wHeight                           480
        dwMinBitRate                147456000
        dwMaxBitRate                147456000
        dwMaxVideoFrameBufferSize      614400
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            26
        bDescriptorType                    36
        bDescriptorSubtype                  3 (STILL_IMAGE_FRAME)
        bEndpointAddress                    0
        bNumImageSizePatterns               5
        wWidth( 0)                        640
        wHeight( 0)                       480
        wWidth( 1)                        352
        wHeight( 1)                       288
        wWidth( 2)                        320
        wHeight( 2)                       240
        wWidth( 3)                        176
        wHeight( 3)                       144
        wWidth( 4)                        160
        wHeight( 4)                       120
        bNumCompressionPatterns             5
      VideoStreaming Interface Descriptor:
        bLength                             6
        bDescriptorType                    36
        bDescriptorSubtype                 13 (COLORFORMAT)
        bColorPrimaries                     1 (BT.709,sRGB)
        bTransferCharacteristics            1 (BT.709)
        bMatrixCoefficients                 4 (SMPTE 170M (BT.601))
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x1400  3x 1024 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x13d0  3x 976 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       3
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x13b0  3x 944 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       4
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x1390  3x 912 bytes
        bInterval               1

-- 
--------------------------------------
           ANTOINE Pierre

 nunux@free.fr
--------------------------------------




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: uvcvideo: Trying to lower the URB buffers on eMPIA minicam
  2013-04-24 22:47 uvcvideo: Trying to lower the URB buffers on eMPIA minicam Pierre ANTOINE
@ 2013-04-25 11:36 ` Laurent Pinchart
  2013-04-25 19:13   ` Pierre ANTOINE
  0 siblings, 1 reply; 7+ messages in thread
From: Laurent Pinchart @ 2013-04-25 11:36 UTC (permalink / raw)
  To: Pierre ANTOINE; +Cc: linux-media

Hi Pierre,

On Thursday 25 April 2013 00:47:53 Pierre ANTOINE wrote:
> Hello guys,
> 
> My nickname is Nunux, I'm a geek, and need some help ...
> 
> I just buy ten minicam to do a poker TV table.
> The minicam are eMPIA: eb1a:299f
> 
> I've a PC with 1 internal USB BUS 2.0 and 3 PCI extension cards USB BUS 2.0
> 
> Currently, I can have only one cam eMPIA working per USB BUS but no more
> even if I set the lower resolution of 160x120.
> 
> [ 2768.783291] uvcvideo: Device requested 1024 B/frame bandwidth.
> [ 2768.783295] uvcvideo: Selecting alternate setting 4 (2736 B/frame
> bandwidth). [ 2768.783641] uvcvideo: Allocated 5 URB buffers of 15x2736
> bytes each. [ 2768.783664] uvcvideo: Failed to submit URB 0 (-28).
> 
> So I can have 4 minicam at a time, but need 10.
> 
> I'm running Linux 3.5.0 on Ubuntu.
> 
> pierre@SuperTable:/usr/src/linux-source-3.5.0/linux-source-3.5.0/drivers/med
> ia/video/uvc$ uvcdynctrl -f -d /dev/video0
> Listing available frame formats for device /dev/video0:
> Pixel format: YUYV (YUV 4:2:2 (YUYV); MIME type: video/x-raw-yuv)
>   Frame size: 640x480
>     Frame rates: 30
>   Frame size: 160x120
>     Frame rates: 30
>   Frame size: 176x144
>     Frame rates: 30
>   Frame size: 320x240
>     Frame rates: 30
>   Frame size: 352x288
>     Frame rates: 30
>   Frame size: 640x480
>     Frame rates: 30
> 
> I try to patch uvc_video.c like this:
>                 /* Isochronous endpoint, select the alternate setting. */
>                 //bandwidth = stream->ctrl.dwMaxPayloadTransferSize;
>                 bandwidth = 1024;
> 
> 
> That help me to reduce the USB bandwidth down to 1024 on a Microsoft LifeCam
> Cinema:
> 
> [  944.410066] USB Video Class driver (1.1.1)
> [  948.636665] uvcvideo: Device requested 1024 B/frame bandwidth.
> [  948.636670] uvcvideo: Selecting alternate setting 4 (1024 B/frame
> bandwidth). [  948.912793] uvcvideo: Allocated 5 URB buffers of 32x1024
> bytes each.
> 
> And allow me to run up to 3 Microsoft LifeCam Cinema on the same PCI USB
> Card.
> 
> But it's not working on eMPIA minicam:
> 
> [  982.488896] uvcvideo: Device requested 1024 B/frame bandwidth.
> [  982.488901] uvcvideo: Selecting alternate setting 4 (2736 B/frame
> bandwidth). [  982.489355] uvcvideo: Allocated 5 URB buffers of 32x2736
> bytes each.
> 
> Because even if the request bandwdith is fixed to 1024, there is no endpoint
> with such lower bandwidth.
> 
> --------------
> 
> So my question is, is it possible to lower the bandwidth of the endpoint,
> or use a different bandwidth, or the do anything to run 3 cams per usb ports
> ?

That largely depends on the device. Even when not requiring the full bandwidth 
on average, devices might send data in bursts (memory is expensive), in which 
case you will need to allocate an average bandwidth larger than or equal to 
the peak bandwidth (that's how USB works). However, your device might not need 
the high bandwidth it reports in its endpoint descriptors. There's no way to 
tell short of trying.

As a quick hack it's probably possible to patch the USB core to lower the 
endpoint bandwidth in the endpoint USB descriptors for that device. That's 
pretty dirty, but will at least let you find out whether your device can work 
at lower bandwidth.

> I host a mini poker mtt for my wife birthday this saturday, and hope get
> some thing to work before...
> 
> So any help or comments would be really appreciated,

Just for my records, could you please repost the 'lsusb -v -d eb1a:299f' 
output running as root ? The string descriptors are not displayed otherwise.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: uvcvideo: Trying to lower the URB buffers on eMPIA minicam
  2013-04-25 11:36 ` Laurent Pinchart
@ 2013-04-25 19:13   ` Pierre ANTOINE
  2013-04-25 22:55     ` Laurent Pinchart
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre ANTOINE @ 2013-04-25 19:13 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Pierre ANTOINE, linux-media

Selon Laurent Pinchart <laurent.pinchart@ideasonboard.com>:
>
> Just for my records, could you please repost the 'lsusb -v -d eb1a:299f'
> output running as root ? The string descriptors are not displayed otherwise.
>
> --
> Regards,
>
> Laurent Pinchart
>
> --

Hi Laurent,

Please find the requested informations as root.

Where do you think I can try to hack the bandwidth size ?

Something like: source/drivers/usb/core/config.c usb_parse_endpoint() ?

Many regards,

Pierre

-----------------------

pierre@SuperTable:~$ sudo lsusb -v -d eb1a:299f
[sudo] password for pierre:

Bus 004 Device 002: ID eb1a:299f eMPIA Technology, Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0xeb1a eMPIA Technology, Inc.
  idProduct          0x299f
  bcdDevice            0.05
  iManufacturer           1 Image Processor
  iProduct                2 USB 2.0 PC Cam
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          441
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass         14 Video
      bFunctionSubClass       3 Video Interface Collection
      bFunctionProtocol       0
      iFunction               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      1 Video Control
      bInterfaceProtocol      0
      iInterface              0
      VideoControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdUVC               1.00
        wTotalLength           77
        dwClockFrequency       30.000000MHz
        bInCollection           1
        baInterfaceNr( 0)       1
      VideoControl Interface Descriptor:
        bLength                18
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0201 Camera Sensor
        bAssocTerminal          0
        iTerminal               0
        wObjectiveFocalLengthMin      0
        wObjectiveFocalLengthMax      0
        wOcularFocalLength            0
        bControlSize                  3
        bmControls           0x00000004
          Auto-Exposure Priority
      VideoControl Interface Descriptor:
        bLength                26
        bDescriptorType        36
        bDescriptorSubtype      6 (EXTENSION_UNIT)
        bUnitID                 2
        guidExtensionCode         {92423946-d10c-e34a-8783-3133f9eaaa3b}
        bNumControl             3
        bNrPins                 1
        baSourceID( 0)          1
        bControlSize            1
        bmControls( 0)       0xff
        iExtension              0
      VideoControl Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      5 (PROCESSING_UNIT)
      Warning: Descriptor too short
        bUnitID                 3
        bSourceID               2
        wMaxMultiplier          0
        bControlSize            2
        bmControls     0x0000157f
          Brightness
          Contrast
          Hue
          Saturation
          Sharpness
          Gamma
          White Balance Temperature
          Backlight Compensation
          Power Line Frequency
          White Balance Temperature, Auto
        iProcessing             0
        bmVideoStandards     0x 9
          None
          SECAM - 625/50
      VideoControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             4
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID               3
        iTerminal               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              16
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      VideoStreaming Interface Descriptor:
        bLength                            14
        bDescriptorType                    36
        bDescriptorSubtype                  1 (INPUT_HEADER)
        bNumFormats                         1
        wTotalLength                      253
        bEndPointAddress                  129
        bmInfo                              0
        bTerminalLink                       4
        bStillCaptureMethod                 2
        bTriggerSupport                     0
        bTriggerUsage                       0
        bControlSize                        1
        bmaControls( 0)                    27
      VideoStreaming Interface Descriptor:
        bLength                            27
        bDescriptorType                    36
        bDescriptorSubtype                  4 (FORMAT_UNCOMPRESSED)
        bFormatIndex                        1
        bNumFrameDescriptors                6
        guidFormat                           
{59555932-0000-1000-8000-00aa00389b71}
        bBitsPerPixel                      16
        bDefaultFrameIndex                  1
        bAspectRatioX                       0
        bAspectRatioY                       0
        bmInterlaceFlags                 0x00
          Interlaced stream or variable: No
          Fields per frame: 2 fields
          Field 1 first: No
          Field pattern: Field 1 only
          bCopyProtect                      0
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         1
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            640
        wHeight                           480
        dwMinBitRate                147456000
        dwMaxBitRate                147456000
        dwMaxVideoFrameBufferSize      614400
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         2
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            160
        wHeight                           120
        dwMinBitRate                  9216000
        dwMaxBitRate                  9216000
        dwMaxVideoFrameBufferSize       38400
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         3
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            176
        wHeight                           144
        dwMinBitRate                 12165120
        dwMaxBitRate                 12165120
        dwMaxVideoFrameBufferSize       50688
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         4
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            320
        wHeight                           240
        dwMinBitRate                 36864000
        dwMaxBitRate                 36864000
        dwMaxVideoFrameBufferSize      153600
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         5
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            352
        wHeight                           288
        dwMinBitRate                 48660480
        dwMaxBitRate                 48660480
        dwMaxVideoFrameBufferSize      202752
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         6
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            640
        wHeight                           480
        dwMinBitRate                147456000
        dwMaxBitRate                147456000
        dwMaxVideoFrameBufferSize      614400
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            26
        bDescriptorType                    36
        bDescriptorSubtype                  3 (STILL_IMAGE_FRAME)
        bEndpointAddress                    0
        bNumImageSizePatterns               5
        wWidth( 0)                        640
        wHeight( 0)                       480
        wWidth( 1)                        352
        wHeight( 1)                       288
        wWidth( 2)                        320
        wHeight( 2)                       240
        wWidth( 3)                        176
        wHeight( 3)                       144
        wWidth( 4)                        160
        wHeight( 4)                       120
        bNumCompressionPatterns             5
      VideoStreaming Interface Descriptor:
        bLength                             6
        bDescriptorType                    36
        bDescriptorSubtype                 13 (COLORFORMAT)
        bColorPrimaries                     1 (BT.709,sRGB)
        bTransferCharacteristics            1 (BT.709)
        bMatrixCoefficients                 4 (SMPTE 170M (BT.601))
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x1400  3x 1024 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x13d0  3x 976 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       3
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x13b0  3x 944 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       4
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x1390  3x 912 bytes
        bInterval               1
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)
pierre@SuperTable:~$

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: uvcvideo: Trying to lower the URB buffers on eMPIA minicam
  2013-04-25 19:13   ` Pierre ANTOINE
@ 2013-04-25 22:55     ` Laurent Pinchart
  2013-04-26  0:03       ` Pierre ANTOINE
  0 siblings, 1 reply; 7+ messages in thread
From: Laurent Pinchart @ 2013-04-25 22:55 UTC (permalink / raw)
  To: Pierre ANTOINE; +Cc: linux-media

Hi Pierre,

On Thursday 25 April 2013 21:13:48 Pierre ANTOINE wrote:
> Selon Laurent Pinchart <laurent.pinchart@ideasonboard.com>:
> > Just for my records, could you please repost the 'lsusb -v -d eb1a:299f'
> > output running as root ? The string descriptors are not displayed
> > otherwise.
> 
> Hi Laurent,
> 
> Please find the requested informations as root.

Thank you. I'll update the supported devices list on the uvcvideo website. 
Could you please give me the exact model name of the camera ?

> Where do you think I can try to hack the bandwidth size ?
> 
> Something like: source/drivers/usb/core/config.c usb_parse_endpoint() ?

Yes, that looks good. Just make sure you only hack the endpoint bandwidth for 
the webcam and not for the other USB devices.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: uvcvideo: Trying to lower the URB buffers on eMPIA minicam
  2013-04-25 22:55     ` Laurent Pinchart
@ 2013-04-26  0:03       ` Pierre ANTOINE
  2013-04-26  0:41         ` Laurent Pinchart
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre ANTOINE @ 2013-04-26  0:03 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Pierre ANTOINE, linux-media

Selon Laurent Pinchart <laurent.pinchart@ideasonboard.com>:

> Thank you. I'll update the supported devices list on the uvcvideo website.
> Could you please give me the exact model name of the camera ?

The product description is here:

http://www.amazon.fr/dp/B00A487TPC/ref=pe_205631_30430471_3p_M3_dp_1

That is: Supereyes from XCSource know on Amazon as Microscope USB Cam.

>
> Yes, that looks good. Just make sure you only hack the endpoint bandwidth for
> the webcam and not for the other USB devices.
>

I'm trying this one:

---------------------------------------
        if (to_usb_device(ddev)->speed == USB_SPEED_HIGH)
        {
                unsigned maxp;

                maxp = usb_endpoint_maxp(&endpoint->desc) & 0x07ff;
                if (maxp == 912) endpoint->desc.wMaxPacketSize =
cpu_to_le16(256);
                dev_warn(ddev, "Hack 912 to 256 downsize endpoint by Nunux");
        }
---------------------------------------

That seem to trigger ... but not working ... and not showing is lsusb ...




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: uvcvideo: Trying to lower the URB buffers on eMPIA minicam
  2013-04-26  0:03       ` Pierre ANTOINE
@ 2013-04-26  0:41         ` Laurent Pinchart
  2013-04-26  0:56           ` Pierre ANTOINE
  0 siblings, 1 reply; 7+ messages in thread
From: Laurent Pinchart @ 2013-04-26  0:41 UTC (permalink / raw)
  To: Pierre ANTOINE; +Cc: linux-media

Hi Pierre,

On Friday 26 April 2013 02:03:49 Pierre ANTOINE wrote:
> Selon Laurent Pinchart <laurent.pinchart@ideasonboard.com>:
> > Thank you. I'll update the supported devices list on the uvcvideo website.
> > Could you please give me the exact model name of the camera ?
> 
> The product description is here:
> 
> http://www.amazon.fr/dp/B00A487TPC/ref=pe_205631_30430471_3p_M3_dp_1
> 
> That is: Supereyes from XCSource know on Amazon as Microscope USB Cam.

Thank you.

> > Yes, that looks good. Just make sure you only hack the endpoint bandwidth
> > for the webcam and not for the other USB devices.
> 
> I'm trying this one:
> 
> ---------------------------------------
>         if (to_usb_device(ddev)->speed == USB_SPEED_HIGH)
>         {
>                 unsigned maxp;
> 
>                 maxp = usb_endpoint_maxp(&endpoint->desc) & 0x07ff;
>                 if (maxp == 912) endpoint->desc.wMaxPacketSize =
> cpu_to_le16(256);
>                 dev_warn(ddev, "Hack 912 to 256 downsize endpoint by
> Nunux"); }
> ---------------------------------------
> 
> That seem to trigger ... but not working ... and not showing is lsusb ...

lsusb parses the raw descriptors. Could you print the wMaxPacketSize value for 
all the endpoints in the uvcvideo driver ? The value is also exported through 
a sysfs attribute.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: uvcvideo: Trying to lower the URB buffers on eMPIA minicam
  2013-04-26  0:41         ` Laurent Pinchart
@ 2013-04-26  0:56           ` Pierre ANTOINE
  0 siblings, 0 replies; 7+ messages in thread
From: Pierre ANTOINE @ 2013-04-26  0:56 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media

Laurent,

I finally did it !

On usbcore, I correct the bandwidth of endpoint 4 from 912 to 1024.

maxp = usb_endpoint_maxp(&endpoint->desc) & 0x07ff;
if (maxp == 912) endpoint->desc.wMaxPacketSize = cpu_to_le16(1024);

On uvcvideo:
I set: 768 B/frame bandwidth
I use endpoint alt-setting 4 by disabling some checking code.
And I get uvcvideo: Allocated 5 URB buffers of 32x1024 bytes each.

So I can run the 4 cam on the same USB card:

gst-launch v4l2src device=/dev/video0 !
'video/x-raw-yuv,width=160,height=120,framerate=30/1' ! xvimagesink
gst-launch v4l2src device=/dev/video1 !
'video/x-raw-yuv,width=160,height=120,framerate=30/1' ! xvimagesink
gst-launch v4l2src device=/dev/video2 !
'video/x-raw-yuv,width=160,height=120,framerate=30/1' ! xvimagesink
gst-launch v4l2src device=/dev/video3 !
'video/x-raw-yuv,width=160,height=120,framerate=30/1' ! xvimagesink

I will try to do it less dirty next week ...

Thank's a lot for pointing me on usbcore ...

Many regards,

Pierre

Selon Laurent Pinchart <laurent.pinchart@ideasonboard.com>:

> lsusb parses the raw descriptors. Could you print the wMaxPacketSize value
> for all the endpoints in the uvcvideo driver ? The value is also exported
through
> a sysfs attribute.
>
> --
> Regards,
>
> Laurent Pinchart
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-04-26  0:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-24 22:47 uvcvideo: Trying to lower the URB buffers on eMPIA minicam Pierre ANTOINE
2013-04-25 11:36 ` Laurent Pinchart
2013-04-25 19:13   ` Pierre ANTOINE
2013-04-25 22:55     ` Laurent Pinchart
2013-04-26  0:03       ` Pierre ANTOINE
2013-04-26  0:41         ` Laurent Pinchart
2013-04-26  0:56           ` Pierre ANTOINE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox