---
# System prepended metadata

title: 【Doc】【UCV】  Camera
tags: [Camera]

---


---

## 基本知識

---

* USB 運作模式
    * 『Host 負責主導整個 USB 結構的通訊』，會輪詢所有裝置需要傳送資料
    * 將以 PCI Bus 的形式存在供作業系統控制
        * lspci
            ```
            root@opkiller:~# lspci
            00:00.0 PCI bridge: Synopsys, Inc. DWC_usb3 / PCIe bridge (rev 01)
            ```
* USB 架構規範
    * 模式(Configurations)：只能一種模式，不能同時兩種模式並行運作。(韌體升級/一般模式)。
    * 介面(Interfaces)：一個 USB 裝置可能有很多個輸入或輸出介面。
    * 設定值(Settings)
    * 端點(Endpoints)
* USB Device 初始化流程
    * Host -> (GET/**問**) Device Descriptors = Enumeration
        * Device Descriptors
            * GET ->  模式的數量(bNumConfigurations) => Configuration Descriptors
            * GET ->  介面的數量(bNumInterfaces)  =>  Interface
            * GET ->  端點的數量(bNumEndpoints)  =>  **Endpoint (傳輸資料)**
                * **Endpoint 的傳輸形態**：
                    * Control 控制中斷模式 : 須有足夠頻寬完成每次傳輸(使用 Endpoint 0)。
                    * Bulk 批量傳輸 : 大量且安全的傳輸，且能夠分批。
                    * Isochronous 同步傳輸 : 大量且穩定持續但不保證安全的傳輸。
                    * Interrupt 中斷傳輸: 以輪詢機制來請求傳輸
            * GET ->  端點的資料傳輸模式(bmAttributes)  
    

* list-devices 定義
    * USB PHY 2.0 : 指 USB 2.0 的物理層（Physical Layer）
    * USB 2.0 Camera : 指一個使用 USB 2.0 介面的攝像頭

* 最大頻寬 (share in every device)
    * USB 2.0 最大頻寬為 480 Mbps（兆位元每秒）
    * USB 3.0 Gen 1 最大頻寬為 5 Gbps（兆位元每秒）- 超速（SuperSpeed）模式
    * USB 3.0 Gen 2 最大頻寬為 10 Gbps（兆位元每秒）

* 每個 USB 裝置的頻寬計算([粗略](https://www.mistralsolutions.com/articles/video-surveillance-bandwidth-requirements-calculation-utilization/))
    * Frame Size = Resolution * Colour Depth 
    * Bit Rate = Frame Size * Frame Rate (fps)
        * Example
            * Frame Size = (1280x720)x(8x3) = 22,118,400 bits = ~ 22.11 Mbps (Mbits/sec)
            * Bit Rate (Minimum Bandwidth) = 22.1184 Mbps * 30 = ~ 663 Mbps (Mbits/sec)
        Note : Maximum Bandwidth of USB 2.0 is 480 Mbps 
      
* 每個 USB 裝置的頻寬計算(實際)
    * 取決於多個因素，包括裝置本身的能力、連接的USB控制器和主機系統的支援能力。
    * 例子，如何計算 UVC Camera 的 Mbps 傳輸速率是否足夠
        1. 取得各 UVC 每禎所需要的頻寬
            * dmesg : Selecting alternate setting 11 (3060 B/frame bandwidth).
            * 每幀的長度為 125us
            * 每幀 3060 位元組等於 195 Mbps (3060 x 1000000/125 x 8)
        2.  計算當前所使用的 UVC 格式所傳輸的頻寬
            UVC Camera 所使用 RGB,  240p @ 25 FPS => 320x240x3x25 = 5760000 byte = 46 MB 



* 嵾考文獻 
    1. [Multiple UVC cameras on Linux: an unexpected challenge](https://www.thegoodpenguin.co.uk/blog/multiple-uvc-cameras-on-linux/)
    2. [Understanding why USB Isochronous Bandwidth Errors Occur](https://www.thegoodpenguin.co.uk/blog/understanding-why-usb-isochronous-bandwidth-errors-occur/)
    3. [淺談 USB 通訊架構之定義（一）](https://fred-zone.blogspot.com/2009/08/usb.html)
    4. [淺談 USB 通訊架構之定義（二）](https://fred-zone.blogspot.com/2009/08/usb_10.html)


</br>

---

## 實驗 1 : i.MX8 能否同時運行雙顆 UVC 攝像頭 
<p style="font-size: larger;">主要原因是 USB 2.0 的共享頻寬限制</p>

---

### Research Result

* Research USB Interface by using **dual- UCV camera** with difference resolution
    * 預計 MJPG 的壓縮比為 10:1

    | Resolution  | Bandwidth (bps) |i.MX8MP|i.MX8MM|
    |---|---|---|---|
    | **Hub 2.0 + dual camera USB 2.0:**|||
    |2 x 240p@30fps (MJPEG,YUV)| 5.5M + 36M  |**Work**|Fail|
    |2 x 480p@30fps (MJPEG,YUV)| 22M+ **147M**  |Fail|Fail|
    |480p@30fps, 240p@30fps (MJPEG YUV)| 22M + 36M  |Fail|Fail|
    |480p@25fps, 240p@30fps(YUV,YUV)| 184M + 36M |Fail|Fail|
    |720p@5fps, 240p@30fps(YUV,YUV) |73M + 36M |**Work**|Fail|
    | **Hub 3.0 + dual camera USB 2.0:**|||
    |2 x 240p@30fps (MJPEG,YUV)| 5.5M + 36M |**Work**|Fail|
    |2 x 480p@30fps (MJPEG,YUV)| 22M + 147M |Fail|Fail|
    |480p@30fps, 240p@30(MJPEG YUV)| 22M + 36M |**Work**|Fail|
    |720p@30fps, 240p@30(MJPEG YUV)| 66M + 36M |**Work**|Fail|
    |1080p@30fps, 240p@30(MJPEG YUV)| 149M + 36M |**Work**|Fail|
    |480p@25fps, 240p@30fps(YUV,YUV)| 184M + 36M |**Work**|Fail|
    |720p@5fps, 240p@30fps(YUV,YUV) |73M + 36M |**Work**|Fail|
    
    
    </br>
    
    * 造成雙鏡頭的 Fail 原因之一 : 頻寬不足
    
        * Message :　Failed to submit URB 0 (-28)
            ![](https://hackmd.io/_uploads/rkA-zSPzT.png)

        * Answer 
            * **Debug** : uvc_video.c , [linux-imx/version/git/drivers/media/usb/uvc]
                * URB（USB Request Block） 是 USB 驅動程式和 USB 設備之間進行通信的基本單位
                * Error :　Failed to submit URB 0 (-28) => 傳輸接收封包錯誤 = **頻寬不足**
                ```c++
                    //(1) URB 添加到 UVC 驅動程式的 URB 隊列中，並觸發相應的 USB 傳輸操作
                    /* Submit the URBs. */
                    for_each_uvc_urb(uvc_urb, stream) {
                        ret = uvc_submit_urb(uvc_urb, gfp_flags);
                        if (ret < 0) {
                            dev_err(&stream->intf->dev,
                                "Failed to submit URB %u (%d).\n",
                                uvc_urb_index(uvc_urb), ret);
                            uvc_video_stop_transfer(stream, 1);
                            return ret;
                        }
                    }
                    //(2) 用於支援 USB 視訊設備的驅動程式，它負責處理視訊數據的捕獲、編碼、解碼和顯示等操作
                    static int uvc_submit_urb(struct uvc_urb *uvc_urb, gfp_t mem_flags)
                    {
                        /* Sync DMA. */
                        dma_sync_sgtable_for_device(uvc_stream_to_dmadev(uvc_urb->stream),
                                        uvc_urb->sgt,
                                        uvc_stream_dir(uvc_urb->stream));
                        return usb_submit_urb(uvc_urb->urb, mem_flags);
                    }
                    //(3) 支援各種不同的 USB 設備，包括存儲設備、音訊設備、輸入設備等 
                    //link web = https://www.cnblogs.com/tureno/articles/6811367.html
                ``` 

            * **Graph of USB 2.0 HUB**
                ![](https://hackmd.io/_uploads/HkTQTRwza.png =70%x)

                Note : 因頻寬被均分給每個裝置(HUB + Camera * 2), 故每裝置的頻寬約 160 Mbps


        * 參考網站
            * [usb_submit_urb流程分析](https://www.twblogs.net/a/5e4edfb4bd9eee101df63c96)
            * [linux设备驱动之USB数据传输分析 usb_submit_urb](https://www.cnblogs.com/tureno/articles/6811367.html)
            * [vcvideo: Failed to submit URB 0 (-28)](https://support.xilinx.com/s/question/0D52E00006hpYmcSAE/uvcvideo-failed-to-submit-urb-0-28?language=en_US) -> replace USB 1.0 Hub to USB 2.0 Hub
            * [intr_urb_submit failed:-28 / No space left on device](https://e2e.ti.com/support/processors-group/processors/f/processors-forum/136197/intr_urb_submit-failed--28-no-space-left-on-device)
            * [**Linux 下打開多個 UVC 攝像頭報錯問題**](https://blog.csdn.net/qq_20862815/article/details/129163401)
                * 問題 ioctl(fd, VIDIC_STREAMON, &type) => 頻寬分配問題 = 並**非均分概念**
                * 解決方式 : 修改 vMaxPacketSize 與 bInterval 
                    * vMaxPacketSize 表示每次傳輸所使用的封包大小, 最大值 3072 (0x1400) 字節
                    * bInterval 表示每次間隔多久時間傳輸, 數值 1 為最快(125us) 至 數值 16 為最快(2^(15) * 125us)

        
* USB BitRate and Bandwidth (Hub + Dual UVC Camera)
    ```
    root@op-kiler-kivy:~# lsusb -t
    /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
        |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 1: Dev 10, If 0, Class=Video, Driver=uvcvideo, 480M
            |__ Port 1: Dev 10, If 1, Class=Video, Driver=uvcvideo, 480M
            |__ Port 2: Dev 11, If 3, Class=Audio, Driver=snd-usb-audio, 480M
            |__ Port 2: Dev 11, If 1, Class=Video, Driver=uvcvideo, 480M
            |__ Port 2: Dev 11, If 2, Class=Audio, Driver=snd-usb-audio, 480M
            |__ Port 2: Dev 11, If 0, Class=Video, Driver=uvcvideo, 480M
    ```  

</br>
</br>

---

### Device Info


$ v4l2-ctl --list-devices
```
root@opkiller:~# v4l2-ctl --list-devices
 ():
        /dev/v4l-subdev0
        /dev/v4l-subdev2
        /dev/v4l-subdev3

 (csi0):
        /dev/v4l-subdev1

FSL Capture Media Device (platform:32c00000.bus:camera):
        /dev/media1

VIV (platform:viv0):
        /dev/video4

vsi_v4l2dec (platform:vsi_v4l2dec):
        /dev/video1

vsi_v4l2enc (platform:vsi_v4l2enc):
        /dev/video0

viv_media (platform:vvcam-video.0):
        /dev/media2

USB PHY 2.0: USB 2.0 Camera (usb-xhci-hcd.1.auto-1.1):
        /dev/video2
        /dev/video3
        /dev/media0

USB2.0 Camera: USB2.0 Camera (usb-xhci-hcd.1.auto-1.4):
        /dev/video5
        /dev/video6
        /dev/media3

```
$ v4l2-ctl -d /dev/video2 --list-formats-ext
```
root@op-kiler-kivy:~# v4l2-ctl -d /dev/video2 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'MJPG' (Motion-JPEG, compressed)
                Size: Discrete 1920x1080
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 1280x720
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 640x480
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 640x360
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 352x288
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 320x240
                        Interval: Discrete 0.033s (30.000 fps)
        [1]: 'YUYV' (YUYV 4:2:2)
                Size: Discrete 1280x720
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 640x480
                        Interval: Discrete 0.040s (25.000 fps)
                Size: Discrete 640x360
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 352x288
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 320x240
                        Interval: Discrete 0.033s (30.000 fps)

```
$ v4l2-ctl -d /dev/video5 --list-formats-ext
```
root@op-kiler-kivy:~# v4l2-ctl -d /dev/video5 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'YUYV' (YUYV 4:2:2)
                Size: Discrete 640x480
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 160x120
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 176x144
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 320x240
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 352x288
                        Interval: Discrete 0.033s (30.000 fps)

```

</br>
</br>

---

### Platform : NXP i.MX8M Plus


#### (1) I.MX8M PLUS , dual USB-Webcamera , 640x480 (YUV + MJPG)    
* It's fail (Failed to allocate required memory.)
    ```
    gst-launch-1.0 \
    imxcompositor_g2d \
    background=0x000000FF \
    name=comp  \
    sink_0::xpos=0 sink_0::ypos=0 \
    sink_0::width=640 sink_0::height=480 \
    sink_1::xpos=640 sink_1::ypos=0\
    sink_1::width=640 sink_1::height=480 !  \
     waylandsink \
    v4l2src device=/dev/video5 !  \
    "video/x-raw,format=YUY2,width=640,height=480,framerate=30/1"  ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
    comp.sink_0 \
    v4l2src device=/dev/video2 !  \
    jpegdec !  video/x-raw,width=640,height=480,framerate=30/1   ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
     comp.sink_1
    ```
</br>

#### (2) I.MX8M PLUS , dual USB-Webcamera , 320x240 (YUV + MJPG)    
* It's **work**
    ```
    gst-launch-1.0 \
    imxcompositor_g2d \
    background=0x000000FF \
    name=comp  \
    sink_0::xpos=0 sink_0::ypos=0 \
    sink_0::width=640 sink_0::height=480 \
    sink_1::xpos=640 sink_1::ypos=0\
    sink_1::width=640 sink_1::height=480 !  \
     waylandsink \
    v4l2src device=/dev/video5 !  \
    "video/x-raw,format=YUY2,width=320,height=240,framerate=30/1"  ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
    comp.sink_0 \
    v4l2src device=/dev/video2 !  \
    jpegdec !  video/x-raw,width=320,height=240,framerate=30/1   ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
     comp.sink_1
     ```
     ![](https://hackmd.io/_uploads/rkewvLRbp.png)

</br>

#### (3) I.MX8M PLUS , dual USB-Webcamera , 480p@30 and 240p@30  (YUV + MJPG)
* It's fail (Failed to allocate required memory.)
    ```
    gst-launch-1.0 \
    imxcompositor_g2d \
    background=0x000000FF \
    name=comp  \
    sink_0::xpos=0 sink_0::ypos=0 \
    sink_0::width=640 sink_0::height=480 \
    sink_1::xpos=640 sink_1::ypos=0\
    sink_1::width=640 sink_1::height=480 !  \
     waylandsink \
    v4l2src device=/dev/video5 !  \
    "video/x-raw,format=YUY2,width=640,height=480,framerate=30/1"  ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
    comp.sink_0 \
    v4l2src device=/dev/video2 !  \
    jpegdec !  video/x-raw,width=320,height=240,framerate=30/1   ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
     comp.sink_1
     ```

#### (4) I.MX8M PLUS , dual USB-Webcamera , 480p@25 and 240p@30  (YUV + YUV)
* It's fail (Failed to allocate required memory.)
    ```
    gst-launch-1.0 \
    imxcompositor_g2d \
    background=0x000000FF \
    name=comp  \
    sink_0::xpos=0 sink_0::ypos=0 \
    sink_0::width=640 sink_0::height=480 \
    sink_1::xpos=640 sink_1::ypos=0\
    sink_1::width=640 sink_1::height=480 !  \
     waylandsink \
    v4l2src device=/dev/video2 !  \
    "video/x-raw,format=YUY2,width=640,height=480,framerate=25/1"  ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
    comp.sink_0 \
    v4l2src device=/dev/video5 !  \
    "video/x-raw,format=YUY2,width=320,height=240"    ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
     comp.sink_1
    ```
     
#### (5) I.MX8M PLUS , dual USB-Webcamera , 720p@5fps and 240p@30fps (YUV + YUV)
* It's **work**
    ```
    gst-launch-1.0 \
    imxcompositor_g2d \
    background=0x000000FF \
    name=comp  \
    sink_0::xpos=0 sink_0::ypos=0 \
    sink_0::width=640 sink_0::height=480 \
    sink_1::xpos=640 sink_1::ypos=0\
    sink_1::width=640 sink_1::height=480 !  \
     waylandsink \
    v4l2src device=/dev/video2 !  \
    "video/x-raw,format=YUY2,width=1280,height=720,framerate=5/1"  ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
    comp.sink_0 \
    v4l2src device=/dev/video5 !  \
    "video/x-raw,format=YUY2,width=320,height=240"    ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
     comp.sink_1
    ```
    ![](https://hackmd.io/_uploads/HJwzDDDza.png)


</br>
</br>
</br>

### Platform : NXP i.MX8M Min


#### (1) I.MX8M Min , dual USB-Webcamera , 640x480 (YUV + MJPG)
* It's fail (Failed to allocate required memory.)
    ```
    gst-launch-1.0 \
    imxcompositor_g2d \
    background=0x000000FF \
    name=comp  \
    sink_0::xpos=0 sink_0::ypos=0 \
    sink_0::width=640 sink_0::height=480 \
    sink_1::xpos=640 sink_1::ypos=0\
    sink_1::width=640 sink_1::height=480 !  \
     waylandsink \
    v4l2src device=/dev/video3 !  \
    "video/x-raw,format=YUY2,width=640,height=480,framerate=30/1"  ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
    comp.sink_0 \
    v4l2src device=/dev/video5 !  \
    jpegdec !  video/x-raw,width=640,height=480,framerate=30/1   ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
     comp.sink_1
    ```
</br>

#### (2) I.MX8M Min , dual USB-Webcamera , 320x240 (YUV + MJPG)
* It's fail (Failed to allocate required memory.)
    ```
    gst-launch-1.0 \
    imxcompositor_g2d \
    background=0x000000FF \
    name=comp  \
    sink_0::xpos=0 sink_0::ypos=0 \
    sink_0::width=640 sink_0::height=480 \
    sink_1::xpos=640 sink_1::ypos=0\
    sink_1::width=640 sink_1::height=480 !  \
     waylandsink \
    v4l2src device=/dev/video3 !  \
    "video/x-raw,format=YUY2,width=320,height=240,framerate=30/1"  ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
    comp.sink_0 \
    v4l2src device=/dev/video5 !  \
    jpegdec !  video/x-raw,width=320,height=240,framerate=30/1   ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
     comp.sink_1
     ```

</br>

#### (3) I.MX8M Min , dual USB-Webcamera , 480p and 240p (YUV + MJPG)
* It's fail (Failed to allocate required memory.)
    ```
    gst-launch-1.0 \
    imxcompositor_g2d \
    background=0x000000FF \
    name=comp  \
    sink_0::xpos=0 sink_0::ypos=0 \
    sink_0::width=640 sink_0::height=480 \
    sink_1::xpos=640 sink_1::ypos=0\
    sink_1::width=640 sink_1::height=480 !  \
     waylandsink \
    v4l2src device=/dev/video3 !  \
    "video/x-raw,format=YUY2,width=640,height=480,framerate=30/1"  ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
    comp.sink_0 \
    v4l2src device=/dev/video5 !  \
    jpegdec !  video/x-raw,width=320,height=240,framerate=30/1   ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
     comp.sink_1
     ```


#### (4) I.MX8M Min , dual USB-Webcamera , 480p@25 and 240p@30 (YUV + YUV) 
* It's fail (Failed to allocate required memory.)
    ```
    gst-launch-1.0 \
    imxcompositor_g2d \
    background=0x000000FF \
    name=comp  \
    sink_0::xpos=0 sink_0::ypos=0 \
    sink_0::width=640 sink_0::height=480 \
    sink_1::xpos=640 sink_1::ypos=0\
    sink_1::width=640 sink_1::height=480 !  \
     waylandsink \
    v4l2src device=/dev/video5 !  \
    "video/x-raw,format=YUY2,width=640,height=480,framerate=25/1"  ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
    comp.sink_0 \
    v4l2src device=/dev/video3 !  \
    "video/x-raw,format=YUY2,width=320,height=240"    ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
     comp.sink_1
    ```
     
#### (5) I.MX8M Min dual USB-Webcamera , 720p@5fps and 240p@30fps (YUV + YUV)
* It's fail (Failed to allocate required memory.)
    ```
    gst-launch-1.0 \
    imxcompositor_g2d \
    background=0x000000FF \
    name=comp  \
    sink_0::xpos=0 sink_0::ypos=0 \
    sink_0::width=640 sink_0::height=480 \
    sink_1::xpos=640 sink_1::ypos=0\
    sink_1::width=640 sink_1::height=480 !  \
     waylandsink \
    v4l2src device=/dev/video5 !  \
    "video/x-raw,format=YUY2,width=1280,height=720,framerate=5/1"  ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
    comp.sink_0 \
    v4l2src device=/dev/video3 !  \
    "video/x-raw,format=YUY2,width=320,height=240"    ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
     comp.sink_1
    ```
    
    
</br>
</br>
</br>

---

## 實驗 2  : MJPG 與 YUV 是否會造成 CPU 使用率上升

<p style="font-size: larger;">MJPG (use 47% CPU) , YUV (use 15% CPU) </p>

---

### 使用 MJPG 的 CPU 使用率
* 代碼
    ```
    gst-launch-1.0 \
    imxcompositor_g2d \
    background=0x000000FF \
    name=comp  \
    sink_0::xpos=0 sink_0::ypos=0 \
    sink_0::width=640 sink_0::height=480 \
    sink_1::xpos=640 sink_1::ypos=0\
    sink_1::width=640 sink_1::height=480 !  \
     waylandsink \
    v4l2src device=/dev/video6 !  \
    "video/x-raw,format=YUY2,width=320,height=240,framerate=30/1"  ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
    comp.sink_0 \
    v4l2src device=/dev/video4 !  \
    jpegdec !  video/x-raw,width=1280,height=720,framerate=30/1   ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
     comp.sink_1
    ```
* 結果
    ![](https://hackmd.io/_uploads/r1T5qcOMa.png)


</br>

### 使用 YUV 的 CPU 使用率
* 代碼
    ```
    gst-launch-1.0 \
    imxcompositor_g2d \
    background=0x000000FF \
    name=comp  \
    sink_0::xpos=0 sink_0::ypos=0 \
    sink_0::width=640 sink_0::height=480 \
    sink_1::xpos=640 sink_1::ypos=0\
    sink_1::width=640 sink_1::height=480 !  \
     waylandsink \
    v4l2src device=/dev/video4 !  \
    "video/x-raw,format=YUY2,width=1280,height=720,framerate=5/1"  ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
    comp.sink_0 \
    v4l2src device=/dev/video6 !  \
    "video/x-raw,format=YUY2,width=320,height=240"    ! \
    imxvideoconvert_g2d ! video/x-raw, width=640, height=480! \
     comp.sink_1
    ```
* 結果
    ![](https://hackmd.io/_uploads/H1ey95OGa.png)



</br>
</br>
</br>

---

## 實驗 3  : 了解 USB / UVC Camera Information

---

### Info

```
Bus 001 Device 007: ID 1124:2925 Jieli Technology USB PHY 2.0
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x1124
  idProduct          0x2925
  bcdDevice            1.00
  iManufacturer           1 Jieli Technology
  iProduct                2 USB PHY 2.0
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0345
    bNumInterfaces          4
    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               6 USB 2.0 Camera
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      1 Video Control
      bInterfaceProtocol      0
      iInterface              6 USB 2.0 Camera
      VideoControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdUVC               1.00
        wTotalLength       0x0067
        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           0x00000000
      VideoControl Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      5 (PROCESSING_UNIT)
      Warning: Descriptor too short
        bUnitID                 2
        bSourceID               1
        wMaxMultiplier          0
        bControlSize            2
        bmControls     0x00000040
          White Balance Temperature
        iProcessing             0
        bmVideoStandards     0x1a
          NTSC - 525/60
          SECAM - 625/50
          NTSC - 625/50
      VideoControl Interface Descriptor:
        bLength                26
        bDescriptorType        36
        bDescriptorSubtype      6 (EXTENSION_UNIT)
        bUnitID                 3
        guidExtensionCode         {28f03370-6311-4a2e-ba2c-6890eb334016}
        bNumControls            8
        bNrInPins               1
        baSourceID( 0)          2
        bControlSize            1
        bmControls( 0)       0x00
        iExtension              0
      VideoControl Interface Descriptor:
        bLength                26
        bDescriptorType        36
        bDescriptorSubtype      6 (EXTENSION_UNIT)
        bUnitID                 4
        guidExtensionCode         {dddf7394-973e-4727-bed9-04ed6426dc67}
        bNumControls            8
        bNrInPins               1
        baSourceID( 0)          3
        bControlSize            1
        bmControls( 0)       0x00
        iExtension              0
      VideoControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             5
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID               4
        iTerminal               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               4
    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                            15
        bDescriptorType                    36
        bDescriptorSubtype                  1 (INPUT_HEADER)
        bNumFormats                         2
        wTotalLength                   0x01b3
        bEndpointAddress                 0x84  EP 4 IN
        bmInfo                              0
        bTerminalLink                       5
        bStillCaptureMethod                 2
        bTriggerSupport                     1
        bTriggerUsage                       0
        bControlSize                        1
        bmaControls( 0)                     0
        bmaControls( 1)                     0
      VideoStreaming Interface Descriptor:
        bLength                            11
        bDescriptorType                    36
        bDescriptorSubtype                  6 (FORMAT_MJPEG)
        bFormatIndex                        1
        bNumFrameDescriptors                6
        bFlags                              0
          Fixed-size samples: No
        bDefaultFrameIndex                  1
        bAspectRatioX                       0
        bAspectRatioY                       0
        bmInterlaceFlags                 0x00
          Interlaced stream or variable: No
          Fields per frame: 1 fields
          Field 1 first: No
          Field pattern: Field 1 only
        bCopyProtect                        0
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         1
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                           1920
        wHeight                          1080
        dwMinBitRate                497664000
        dwMaxBitRate                995328000
        dwMaxVideoFrameBufferSize     4147200
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         2
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                           1280
        wHeight                           720
        dwMinBitRate                221184000
        dwMaxBitRate                442368000
        dwMaxVideoFrameBufferSize     1843200
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         3
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            640
        wHeight                           480
        dwMinBitRate                 73728000
        dwMaxBitRate                147456000
        dwMaxVideoFrameBufferSize      614400
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         4
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            640
        wHeight                           360
        dwMinBitRate                 55296000
        dwMaxBitRate                110592000
        dwMaxVideoFrameBufferSize      460800
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         5
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            352
        wHeight                           288
        dwMinBitRate                 24330240
        dwMaxBitRate                 48660480
        dwMaxVideoFrameBufferSize      202752
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  7 (FRAME_MJPEG)
        bFrameIndex                         6
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            320
        wHeight                           240
        dwMinBitRate                 18432000
        dwMaxBitRate                 36864000
        dwMaxVideoFrameBufferSize      153600
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            22
        bDescriptorType                    36
        bDescriptorSubtype                  3 (STILL_IMAGE_FRAME)
        bEndpointAddress                 0x00  EP 0 OUT
        bNumImageSizePatterns               3
        wWidth( 0)                       1280
        wHeight( 0)                       720
        wWidth( 1)                        640
        wHeight( 1)                       480
        wWidth( 2)                        320
        wHeight( 2)                       240
        bNumCompressionPatterns             4
        bCompression( 0)                    1
        bCompression( 1)                    5
        bCompression( 2)                   10
        bCompression( 3)                   20
      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))
      VideoStreaming Interface Descriptor:
        bLength                            27
        bDescriptorType                    36
        bDescriptorSubtype                  4 (FORMAT_UNCOMPRESSED)
        bFormatIndex                        2
        bNumFrameDescriptors                5
        guidFormat                            {32595559-0000-0010-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                           1280
        wHeight                           720
        dwMinBitRate                221184000
        dwMaxBitRate                442368000
        dwMaxVideoFrameBufferSize     1843200
        dwDefaultFrameInterval        2000000
        bFrameIntervalType                  1
        dwFrameInterval( 0)           2000000
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         2
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            640
        wHeight                           480
        dwMinBitRate                 73728000
        dwMaxBitRate                147456000
        dwMaxVideoFrameBufferSize      614400
        dwDefaultFrameInterval         400000
        bFrameIntervalType                  1
        dwFrameInterval( 0)            400000
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         3
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            640
        wHeight                           360
        dwMinBitRate                 55296000
        dwMaxBitRate                110592000
        dwMaxVideoFrameBufferSize      460800
        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                            352
        wHeight                           288
        dwMinBitRate                 24330240
        dwMaxBitRate                 48660480
        dwMaxVideoFrameBufferSize      202752
        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                            320
        wHeight                           240
        dwMinBitRate                 18432000
        dwMaxBitRate                 36864000
        dwMaxVideoFrameBufferSize      153600
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            18
        bDescriptorType                    36
        bDescriptorSubtype                  3 (STILL_IMAGE_FRAME)
        bEndpointAddress                 0x00  EP 0 OUT
        bNumImageSizePatterns               3
        wWidth( 0)                       1280
        wHeight( 0)                       720
        wWidth( 1)                        640
        wHeight( 1)                       480
        wWidth( 2)                        320
        wHeight( 2)                       240
        bNumCompressionPatterns             0
      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     0x84  EP 4 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x1400  3x 1024 bytes
        bInterval               1
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         2
      bInterfaceCount         2
      bFunctionClass          1 Audio
      bFunctionSubClass       2 Streaming
      bFunctionProtocol       0
      iFunction               5 USB Microphone
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0
      iInterface              5 USB Microphone
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength       0x0026
        bInCollection           1
        baInterfaceNr(0)        3
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0201 Microphone
        bAssocTerminal          0
        bNrChannels             1
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0
        iTerminal               0
      AudioControl Interface Descriptor:
        bLength                 8
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                 3
        bSourceID               1
        bControlSize            1
        bmaControls(0)       0x03
          Mute Control
          Volume Control
        iFeature                0
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             2
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID               3
        iTerminal               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0
      iInterface              5 USB Microphone
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0
      iInterface              5 USB Microphone
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           2
        bDelay                  1 frames
        wFormatTag         0x0001 PCM
      AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             1
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            1 Discrete
        tSamFreq[ 0]         8000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0060  1x 96 bytes
        bInterval               4
        bRefresh                0
        bSynchAddress           0
        AudioStreaming Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         0 Undefined
          wLockDelay         0x0000
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0
      iInterface              5 USB Microphone
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           2
        bDelay                  1 frames
        wFormatTag         0x0001 PCM
      AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             1
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            1 Discrete
        tSamFreq[ 0]        16000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0060  1x 96 bytes
        bInterval               4
        bRefresh                0
        bSynchAddress           0
        AudioStreaming Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         0 Undefined
          wLockDelay         0x0000
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       3
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0
      iInterface              5 USB Microphone
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           2
        bDelay                  1 frames
        wFormatTag         0x0001 PCM
      AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             1
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            1 Discrete
        tSamFreq[ 0]        44100
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0060  1x 96 bytes
        bInterval               4
        bRefresh                0
        bSynchAddress           0
        AudioStreaming Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         0 Undefined
          wLockDelay         0x0000
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       4
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0
      iInterface              5 USB Microphone
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           2
        bDelay                  1 frames
        wFormatTag         0x0001 PCM
      AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             1
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            1 Discrete
        tSamFreq[ 0]        48000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0060  1x 96 bytes
        bInterval               4
        bRefresh                0
        bSynchAddress           0
        AudioStreaming Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         0 Undefined
          wLockDelay         0x0000
Device Status:     0x0001
  Self Powered
root@opkiller:~# ^C
root@opkiller:~# lsusb -d 214b:7250 -v

Bus 001 Device 002: ID 214b:7250 Huasheng Electronics USB2.0 HUB
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0
  bDeviceProtocol         1 Single TT
  bMaxPacketSize0        64
  idVendor           0x214b Huasheng Electronics
  idProduct          0x7250
  bcdDevice            1.00
  iManufacturer           0
  iProduct                1 USB2.0 HUB
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0019
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0
      bInterfaceProtocol      0 Full speed (or root) hub
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0001  1x 1 bytes
        bInterval              12
Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             4
  wHubCharacteristic 0x00e0
    Ganged power switching
    Ganged overcurrent protection
    TT think time 32 FS bits
    Port indicators
  bPwrOn2PwrGood       50 * 2 milli seconds
  bHubContrCurrent    100 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0xff
 Hub Port Status:
   Port 1: 0000.0100 power
   Port 2: 0000.0100 power
   Port 3: 0000.0507 highspeed power suspend enable connect
   Port 4: 0000.0507 highspeed power suspend enable connect
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0
  bDeviceProtocol         0 Full speed (or root) hub
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0001
  Self Powered

```

### Bandwidth 

* (1) lsusb
    ```
    root@op-kiler-kivy:~/nnstreamer# lsusb -t
    /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
        |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 1: Dev 10, If 0, Class=Video, Driver=uvcvideo, 480M
            |__ Port 1: Dev 10, If 1, Class=Video, Driver=uvcvideo, 480M
            |__ Port 2: Dev 11, If 3, Class=Audio, Driver=snd-usb-audio, 480M
            |__ Port 2: Dev 11, If 1, Class=Video, Driver=uvcvideo, 480M
            |__ Port 2: Dev 11, If 2, Class=Audio, Driver=snd-usb-audio, 480M
            |__ Port 2: Dev 11, If 0, Class=Video, Driver=uvcvideo, 480M

    ```
* (2) usb-devices 
    * single camera
        ```c++
        root@op-kiler-kivy:~/nnstreamer# usb-devices

        T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 1
        D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
        P:  Vendor=1d6b ProdID=0002 Rev=05.15
        S:  Manufacturer=Linux 5.15.52+g36363d8623ba xhci-hcd
        S:  Product=xHCI Host Controller
        S:  SerialNumber=xhci-hcd.1.auto
        C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
        I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
        E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

        T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 12 Spd=480 MxCh= 0
        D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
        P:  Vendor=1871 ProdID=01f0 Rev=00.08
        S:  Manufacturer=AVEO Technology Corp.
        S:  Product=USB2.0 Camera
        C:  #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=500mA
        I:  If#= 0 Alt= 0 #EPs= 1 Cls=0e(video) Sub=01 Prot=00 Driver=uvcvideo
        E:  Ad=85(I) Atr=03(Int.) MxPS=   8 Ivl=8ms
        I:  If#= 1 Alt= 0 #EPs= 0 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo

        T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=5000 MxCh= 1
        D:  Ver= 3.00 Cls=09(hub  ) Sub=00 Prot=03 MxPS= 9 #Cfgs=  1
        P:  Vendor=1d6b ProdID=0003 Rev=05.15
        S:  Manufacturer=Linux 5.15.52+g36363d8623ba xhci-hcd
        S:  Product=xHCI Host Controller
        S:  SerialNumber=xhci-hcd.1.auto
        C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
        I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
        E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

        ```
    * dual camera
        ```c++
        root@op-kiler-kivy:~/nnstreamer# usb-devices

        T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 1
        D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
        P:  Vendor=1d6b ProdID=0002 Rev=05.15
        S:  Manufacturer=Linux 5.15.52+g36363d8623ba xhci-hcd
        S:  Product=xHCI Host Controller
        S:  SerialNumber=xhci-hcd.1.auto
        C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
        I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
        E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

        T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 13 Spd=480 MxCh= 4
        D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
        P:  Vendor=214b ProdID=7250 Rev=01.00
        S:  Product=USB2.0 HUB
        C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
        I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
        E:  Ad=81(I) Atr=03(Int.) MxPS=   1 Ivl=256ms

        T:  Bus=01 Lev=02 Prnt=13 Port=02 Cnt=01 Dev#= 14 Spd=480 MxCh= 0
        D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
        P:  Vendor=1871 ProdID=01f0 Rev=00.08
        S:  Manufacturer=AVEO Technology Corp.
        S:  Product=USB2.0 Camera
        C:  #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=500mA
        I:  If#= 0 Alt= 0 #EPs= 1 Cls=0e(video) Sub=01 Prot=00 Driver=uvcvideo
        E:  Ad=85(I) Atr=03(Int.) MxPS=   8 Ivl=8ms
        I:  If#= 1 Alt= 0 #EPs= 0 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo

        T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=5000 MxCh= 1
        D:  Ver= 3.00 Cls=09(hub  ) Sub=00 Prot=03 MxPS= 9 #Cfgs=  1
        P:  Vendor=1d6b ProdID=0003 Rev=05.15
        S:  Manufacturer=Linux 5.15.52+g36363d8623ba xhci-hcd
        S:  Product=xHCI Host Controller
        S:  SerialNumber=xhci-hcd.1.auto
        C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
        I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
        E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

        ```