antmicro / pyvidctrl

A simple TUI util to control V4L2 camera parameters
Apache License 2.0
29 stars 5 forks source link

curses v4l2 python - still multiple issues during setup Ubuntu 20.04 #11

Open ZalgoSoft opened 2 years ago

ZalgoSoft commented 2 years ago

such an amasing idea and such silly bugs. I advice temporary solution for people, who cares, until you make it work out of the box. Have 2 instances Focal Fossa with stock environment


Bug - unable to install and use this tool. Multile issues on stock box, dump traces, cannot run tool due to odd requirenments for terminal protocol. And not fully control list (see bottom screens and compare to v4l2-ctrl output)


Steps to reproduce: follow recommended install procedure get pip install git+https://github.com/antmicro/pyvidctrl get git clone and install https://github.com/antmicro/python3-v4l2.git


Expecred behavior: product installed and works on lastest updated environment

Actial behaviour: unintended fatal errors and python script exceptions, possible not full support of V4L2 controls format and ranges, ( See dumps )


Proposed workaround: 1 Apply proposed workaround during install

  1. Get use LINUX term supported SSH client, set some of these settings

изображение изображение изображение

  1. run like TERM=linux pyvidctrl

As far I insestigated bug -


Proposed workaround (not final solution)

pip install git+https://github.com/antmicro/pyvidctrl
pip install v4l2 
sed "s/range(1\, 9)/list(range(1\, 9))/"  -i /usr/local/lib/python3.8/dist-packages/v4l2.py
sed "s/range(0\, 4)/list(range(0\, 4))/"  -i /usr/local/lib/python3.8/dist-packages/v4l2.py

git clone https://github.com/antmicro/python3-v4l2.git
cd python3-v4l2/
python3 ./setup.py build

--- ./ctrl_widgets.py   2022-05-02 05:21:00.994031552 +0800
+++ /usr/local/lib/python3.8/dist-packages/pyvidctrl/ctrl_widgets.py    2022-05-02 05:26:31.035203163 +0800
@@ -232,7 +232,14 @@
             try:
                 ioctl(device, VIDIOC_QUERYMENU, querymenu)
                 options[i] = querymenu.name.decode("ascii")
-            except OSError:
+            except:
+                try:
+                    ioctl(device, VIDIOC_QUERYMENU, querymenu)
+                    options[i] = querymenu.name.decode("utf8")
+                except:
+                # querymenu can fail for given index, but there can
+                # still be more valid indexes
+                    pass
                 # querymenu can fail for given index, but there can
                 # still be more valid indexes
                 pass
root@rpilan:~#

--- ./__main__.py       2022-05-02 05:28:57.016294678 +0800
+++ /usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py        2022-05-02 05:31:46.112421752 +0800
@@ -153,8 +153,11 @@
         curses.init_pair(1, curses.COLOR_BLUE, curses.COLOR_BLACK)
         curses.init_pair(2, curses.COLOR_RED, curses.COLOR_BLACK)
         curses.init_pair(3, curses.COLOR_YELLOW, curses.COLOR_BLACK)
-        curses.init_pair(7, curses.COLOR_WHITE, 236)
-        curses.init_pair(8, curses.COLOR_YELLOW, 236)
+        try:
+            curses.init_pair(7, curses.COLOR_WHITE, 236)
+            curses.init_pair(8, curses.COLOR_YELLOW, 236)
+        except:
+            pass

     def getch(self):
         return self.win.getch()

TERM=linux pyvidctrl

dumps and system info reports

root@rpilan:~# python3 -V
Python 3.8.10
root@rpilan:~# pip3 -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

root@rpilan:~# pip install git+https://github.com/antmicro/pyvidctrl
Collecting git+https://github.com/antmicro/pyvidctrl
  Cloning https://github.com/antmicro/pyvidctrl to /tmp/pip-req-build-d4el1_od
  Running command git clone -q https://github.com/antmicro/pyvidctrl /tmp/pip-req-build-d4el1_od
Requirement already satisfied (use --upgrade to upgrade): pyvidctrl==1.0 from git+https://github.com/antmicro/pyvidctrl in /usr/local/lib/python3.8/dist-packages/pyvidctrl-1.0-py3.8.egg
Requirement already satisfied: v4l2@ git+https://github.com/antmicro/python3-v4l2 from git+https://github.com/antmicro/python3-v4l2 in /usr/local/lib/python3.8/dist-packages (from pyvidctrl==1.0) (0.2)
Building wheels for collected packages: pyvidctrl
  Building wheel for pyvidctrl (setup.py) ... done
  Created wheel for pyvidctrl: filename=pyvidctrl-1.0-py3-none-any.whl size=17747 sha256=1759ee8186cb4fae9b9f2ce14d13836e5bc7ae79e711831537fcf2caa785337b
  Stored in directory: /tmp/pip-ephem-wheel-cache-tuil0r9p/wheels/08/a6/7e/53e46f5203ee2cfb1d4f80769fb998fd71e4c41924abfc3325
Successfully built pyvidctrl
root@rpilan:~# pip install git+https://github.com/antmicro/pyvidctrl --upgrade
Collecting git+https://github.com/antmicro/pyvidctrl
  Cloning https://github.com/antmicro/pyvidctrl to /tmp/pip-req-build-34519u3u
  Running command git clone -q https://github.com/antmicro/pyvidctrl /tmp/pip-req-build-34519u3u
Requirement already satisfied, skipping upgrade: v4l2@ git+https://github.com/antmicro/python3-v4l2 from git+https://github.com/antmicro/python3-v4l2 in /usr/local/lib/python3.8/dist-packages (from pyvidctrl==1.0) (0.2)
Building wheels for collected packages: pyvidctrl
  Building wheel for pyvidctrl (setup.py) ... done
  Created wheel for pyvidctrl: filename=pyvidctrl-1.0-py3-none-any.whl size=17747 sha256=3ae3f88cf9276a90757e98ad14e8ed03f9e9e8ff28c9caa4098efd1d7160e1ba
  Stored in directory: /tmp/pip-ephem-wheel-cache-wwlm0v8z/wheels/08/a6/7e/53e46f5203ee2cfb1d4f80769fb998fd71e4c41924abfc3325
Successfully built pyvidctrl
Installing collected packages: pyvidctrl
  Attempting uninstall: pyvidctrl
    Found existing installation: pyvidctrl 1.0
    Uninstalling pyvidctrl-1.0:
      Successfully uninstalled pyvidctrl-1.0
Successfully installed pyvidctrl-1.0
root@rpilan:~# TERM=linux pyvidctrl
Traceback (most recent call last):
  File "/usr/local/bin/pyvidctrl", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 564, in main
    app = App(device)
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 134, in __init__
    ctrl_widgets.append(CtrlWidget.create(device, ctrl))
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/ctrl_widgets.py", line 42, in create
    return {
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/ctrl_widgets.py", line 656, in __init__
    super().__init__(device, ctrl)
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/ctrl_widgets.py", line 234, in __init__
    options[i] = querymenu.name.decode("ascii")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 1: ordinal not in range(128)
root@rpilan:~#

root@rpilan:/usr/local/lib/python3.8/dist-packages# pip install v4l2 --force-reinstall -I
Processing /root/.cache/pip/wheels/ba/0f/80/8680e821f2b4c3ce81c281e00d0d8e5b1922318b6d57090928/v4l2-0.2-py3-none-any.whl
Installing collected packages: v4l2
Successfully installed v4l2-0.2
root@rpilan:/usr/local/lib/python3.8/dist-packages# cd  /usr/local/lib/python3.8/dist-packages/
root@rpilan:~# TERM=linux pyvidctrl
Traceback (most recent call last):
  File "/usr/local/bin/pyvidctrl", line 5, in <module>
    from pyvidctrl.__main__ import main
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 3, in <module>
    from v4l2 import *
  File "/usr/local/lib/python3.8/dist-packages/v4l2.py", line 197, in <module>
    ) = range(1, 9) + [0x80]
TypeError: unsupported operand type(s) for +: 'range' and 'list'

root@rpilan:~# pip3 install v4l2
Requirement already satisfied: v4l2 in /usr/local/lib/python3.8/dist-packages (0.2)
root@rpilan:~# TERM=linux pyvidctrl
Traceback (most recent call last):
  File "/usr/local/bin/pyvidctrl", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 564, in main
    app = App(device)
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 123, in __init__
    self.ctrls = query_ctrls(device)
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 102, in query_ctrls
    ctrls_v4l2 = query_v4l2_ctrls(dev)
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 52, in query_v4l2_ctrls
    ctrl = v4l2_query_ext_ctrl()
NameError: name 'v4l2_query_ext_ctrl' is not defined

root@rpilan:~/222# git clone https://github.com/antmicro/python3-v4l2.git
Cloning into 'python3-v4l2'...
remote: Enumerating objects: 29, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 29 (delta 2), reused 3 (delta 1), pack-reused 22
Unpacking objects: 100% (29/29), 40.26 KiB | 388.00 KiB/s, done.
root@rpilan:~/222# cd python3-v4l2/
root@rpilan:~/222/python3-v4l2# python3 ./setup.py build
Warning: 'classifiers' should be a list, got type 'tuple'
running build
running build_py
creating build
creating build/lib
copying v4l2.py -> build/lib
root@rpilan:~/222/python3-v4l2# python3 ./setup.py install
Warning: 'classifiers' should be a list, got type 'tuple'
running install
running build
running build_py
running install_lib
copying build/lib/v4l2.py -> /usr/local/lib/python3.8/dist-packages
byte-compiling /usr/local/lib/python3.8/dist-packages/v4l2.py to v4l2.cpython-38.pyc
running install_egg_info
Removing /usr/local/lib/python3.8/dist-packages/v4l2-0.2.egg-info
Writing /usr/local/lib/python3.8/dist-packages/v4l2-0.2.egg-info
root@rpilan:~/222/python3-v4l2#
root@rpilan:~/222/python3-v4l2#
root@rpilan:~/222/python3-v4l2# pyvidctrl
Traceback (most recent call last):
  File "/usr/local/bin/pyvidctrl", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 564, in main
    app = App(device)
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 134, in __init__
    ctrl_widgets.append(CtrlWidget.create(device, ctrl))
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/ctrl_widgets.py", line 42, in create
    return {
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/ctrl_widgets.py", line 656, in __init__
    super().__init__(device, ctrl)
  File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/ctrl_widgets.py", line 234, in __init__
    options[i] = querymenu.name.decode("ascii")
Traceback (most recent call last):can't decode byte 0xf0 in position 1: ordinal not in range(128)

root@rpilan:~/222/python3-v4l2# py  File "/usr/local/bin/pyvidctrl", line 8, in <module>
(failed reverse-i-search)`TER': expor ^CRM=linux  sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 577, in mainn3.8/dist-packages#
root@rpilan:/usr/local/lib/pytho    app.start_tui() cd
File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 156, in start_tui
Traceback (most recent call last):  curses.init_pair(7, curses.COLOR_WHITE, 236)ctrl", line 8, in <module>
    sys.exit(main())        _curses.error: init_pair() returned ERR
--------------
Traceback (most recent call last):
File "/usr/local/bin/pyvidctrl", line 8, in <module>   sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 577, in main       app.start_tui()
File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 156, in start_tui curses.init_pair(7, curses.COLOR_WHITE, 236)
_curses.error: init_pair() returned ERR

-------------
Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-104-generic armv7l)
root@michelangelo:~# uname -a ; cat /etc/*rele* ;cat /proc/cpuinfo  |egrep "ode|war"
Linux michelangelo.lan 5.4.0-104-generic #118-Ubuntu SMP Wed Mar 2 19:04:47 UTC 2022 armv7l armv7l armv7l GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
model name      : ARMv7 Processor rev 0 (v7l)
model name      : ARMv7 Processor rev 0 (v7l)
Hardware        : NVIDIA Tegra SoC (Flattened Device Tree)
root@michelangelo:~# v4l2-ctl --verbose --all
VIDIOC_QUERYCAP: ok
Driver Info:
        Driver name      : uvcvideo
        Card type        : Video Capture 3
        Bus info         : usb-c5008000.usb-1.2
        Driver version   : 5.4.166
        Capabilities     : 0x84a00001
                Video Capture
                Metadata Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : uvcvideo
        Model            : USB Camera: USB Camera
        Serial           : 200901010001
        Bus info         : usb-c5008000.usb-1.2
        Media version    : 5.4.166
        Hardware revision: 0x00000925 (2341)
        Driver version   : 5.4.166
Interface Info:
        ID               : 0x03000002
        Type             : V4L Video
Entity Info:
        ID               : 0x00000001 (1)
        Name             : Video Capture 3
        Function         : V4L2 I/O
        Flags         : default
        Pad 0x01000007   : 0: Sink
          Link 0x02000010: from remote pad 0x100000a of entity 'Processing 2': Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
        Width/Height      : 640/480
        Pixel Format      : 'YUYV' (YUYV 4:2:2)
        Field             : None
        Bytes per Line    : 1280
        Size Image        : 614400
        Colorspace        : sRGB
        Transfer Function : Default (maps to sRGB)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Limited Range)
        Flags             :
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 640, Height 480
        Default     : Left 0, Top 0, Width 640, Height 480
        Pixel Aspect: 1/1
Selection Video Capture: crop_default, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Capture: crop_bounds, Left 0, Top 0, Width 640, Height 480, Flags:
Streaming Parameters Video Capture:
        Capabilities     : timeperframe
        Frames per second: 30.000 (30/1)
        Read buffers     : 0
                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=128
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=128 value=128
                     saturation 0x00980902 (int)    : min=0 max=255 step=1 default=128 value=128
                            hue 0x00980903 (int)    : min=0 max=255 step=1 default=128 value=128
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                          gamma 0x00980910 (int)    : min=100 max=500 step=1 default=220 value=220
                           gain 0x00980913 (int)    : min=0 max=100 step=1 default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=1 value=1
                                0: Disabled
                                1: 50 Hz
                                2: 60 Hz
      white_balance_temperature 0x0098091a (int)    : min=2800 max=6500 step=10 default=4650 value=4650 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=4 step=1 default=1 value=1
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=0 value=0
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=3
                                1: Manual Mode
                                3: Aperture Priority Mode
              exposure_absolute 0x009a0902 (int)    : min=50 max=10000 step=1 default=166 value=10000 flags=inactive
         exposure_auto_priority 0x009a0903 (bool)   : default=0 value=0
root@michelangelo:~#

root@michelangelo:~# uvcdynctrl -c
Listing available controls for device video0:
  Brightness
  Contrast
  Saturation
  Hue
  White Balance Temperature, Auto
  Gamma
  Gain
  Power Line Frequency
  White Balance Temperature
  Sharpness
  Backlight Compensation
  Exposure, Auto
  Exposure (Absolute)
  Exposure, Auto Priority
root@michelangelo:~#
root@michelangelo:~# locale
LANG=ru_RU.UTF-8
LANGUAGE=ru_RU:ru
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=

------------
Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-1059-raspi aarch64)
root@rpilan:~# uname -a ; cat /etc/*rele* ;cat /proc/cpuinfo  |egrep "ode|war"
Linux rpilan 5.4.0-1059-raspi #67-Ubuntu SMP PREEMPT Mon Apr 11 14:16:01 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
Hardware        : BCM2835
Model           : Raspberry Pi 4 Model B Rev 1.1
root@rpilan:~# v4l2-ctl --verbose --all
VIDIOC_QUERYCAP: ok
Driver Info:
        Driver name      : bm2835 mmal
        Card type        : mmal service 16.1
        Bus info         : platform:bcm2835-v4l2
        Driver version   : 5.4.178
        Capabilities     : 0x85200005
                Video Capture
                Video Overlay
                Read/Write
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x05200005
                Video Capture
                Video Overlay
                Read/Write
                Streaming
                Extended Pix Format
Priority: 2
Video input : 0 (Camera 0: ok)
Format Video Capture:
        Width/Height      : 640/480
        Pixel Format      : 'YU12' (Planar YUV 4:2:0)
        Field             : None
        Bytes per Line    : 640
        Size Image        : 460800
        Colorspace        : SMPTE 170M
        Transfer Function : Default (maps to Rec. 709)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Limited Range)
        Flags             :
Format Video Overlay:
        Left/Top    : 150/50
        Width/Height: 1024/768
        Field       : None
        Chroma Key  : 0x00000000
        Global Alpha: 0xff
        Clip Count  : 0
        Clip Bitmap : No
Framebuffer Format:
        Capability    : Extern Overlay
                        Global Alpha
        Flags         : Overlay Matches Capture/Output Size
        Width         : 640
        Height        : 480
        Pixel Format  : 'YU12'
Streaming Parameters Video Capture:
        Capabilities     : timeperframe
        Frames per second: 30.000 (30000/1000)
        Read buffers     : 1

User Controls

                     brightness 0x00980900 (int)    : min=0 max=100 step=1 default=50 value=50 flags=slider
                       contrast 0x00980901 (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider
                     saturation 0x00980902 (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider
                    red_balance 0x0098090e (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
                   blue_balance 0x0098090f (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
                horizontal_flip 0x00980914 (bool)   : default=0 value=0
                  vertical_flip 0x00980915 (bool)   : default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=3 default=1 value=1
                                0: Disabled
                                1: 50 Hz
                                2: 60 Hz
                                3: Auto
                      sharpness 0x0098091b (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider
                  color_effects 0x0098091f (menu)   : min=0 max=15 default=0 value=0
                                0: None
                                1: Black & White
                                2: Sepia
                                3: Negative
                                4: Emboss
                                5: Sketch
                                6: Sky Blue
                                7: Grass Green
                                8: Skin Whiten
                                9: Vivid
                                10: Aqua
                                11: Art Freeze
                                12: Silhouette
                                13: Solarization
                                14: Antique
                                15: Set Cb/Cr
                         rotate 0x00980922 (int)    : min=0 max=360 step=90 default=0 value=0 flags=modify-layout
             color_effects_cbcr 0x0098092a (int)    : min=0 max=65535 step=1 default=32896 value=32896

Codec Controls

             video_bitrate_mode 0x009909ce (menu)   : min=0 max=1 default=0 value=1 flags=update
                                0: Variable Bitrate
                                1: Constant Bitrate
                  video_bitrate 0x009909cf (int)    : min=25000 max=25000000 step=25000 default=10000000 value=20000000
         repeat_sequence_header 0x009909e2 (bool)   : default=0 value=0
            h264_i_frame_period 0x00990a66 (int)    : min=0 max=2147483647 step=1 default=60 value=5
                     h264_level 0x00990a67 (menu)   : min=0 max=11 default=11 value=11
                                0: 1
                                1: 1b
                                2: 1.1
                                3: 1.2
                                4: 1.3
                                5: 2
                                6: 2.1
                                7: 2.2
                                8: 3
                                9: 3.1
                                10: 3.2
                                11: 4
                   h264_profile 0x00990a6b (menu)   : min=0 max=4 default=4 value=0
                                0: Baseline
                                1: Constrained Baseline
                                2: Main
                                4: High

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=0 value=0
                                0: Auto Mode
                                1: Manual Mode
         exposure_time_absolute 0x009a0902 (int)    : min=1 max=10000 step=1 default=1000 value=1000
     exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=1
             auto_exposure_bias 0x009a0913 (intmenu): min=0 max=24 default=12 value=12
                                0: -4000 (0xfffffffffffff060)
                                1: -3667 (0xfffffffffffff1ad)
                                2: -3333 (0xfffffffffffff2fb)
                                3: -3000 (0xfffffffffffff448)
                                4: -2667 (0xfffffffffffff595)
                                5: -2333 (0xfffffffffffff6e3)
                                6: -2000 (0xfffffffffffff830)
                                7: -1667 (0xfffffffffffff97d)
                                8: -1333 (0xfffffffffffffacb)
                                9: -1000 (0xfffffffffffffc18)
                                10: -667 (0xfffffffffffffd65)
                                11: -333 (0xfffffffffffffeb3)
                                12: 0 (0x0)
                                13: 333 (0x14d)
                                14: 667 (0x29b)
                                15: 1000 (0x3e8)
                                16: 1333 (0x535)
                                17: 1667 (0x683)
                                18: 2000 (0x7d0)
                                19: 2333 (0x91d)
                                20: 2667 (0xa6b)
                                21: 3000 (0xbb8)
                                22: 3333 (0xd05)
                                23: 3667 (0xe53)
                                24: 4000 (0xfa0)
      white_balance_auto_preset 0x009a0914 (menu)   : min=0 max=10 default=1 value=1
                                0: Manual
                                1: Auto
                                2: Incandescent
                                3: Fluorescent
                                4: Fluorescent H
                                5: Horizon
                                6: Daylight
                                7: Flash
                                8: Cloudy
                                9: Shade
                                10: Greyworld
            image_stabilization 0x009a0916 (bool)   : default=0 value=0
                iso_sensitivity 0x009a0917 (intmenu): min=0 max=4 default=0 value=0
                                0: 0 (0x0)
                                1: 100000 (0x186a0)
                                2: 200000 (0x30d40)
                                3: 400000 (0x61a80)
                                4: 800000 (0xc3500)
           iso_sensitivity_auto 0x009a0918 (menu)   : min=0 max=1 default=1 value=1
                                0: Manual
                                1: Auto
         exposure_metering_mode 0x009a0919 (menu)   : min=0 max=2 default=0 value=0
                                0: Average
                                1: Center Weighted
                                2: Spot
                     scene_mode 0x009a091a (menu)   : min=0 max=13 default=0 value=8
                                0: None
                                8: Night
                                11: Sports

JPEG Compression Controls

            compression_quality 0x009d0903 (int)    : min=1 max=100 step=1 default=30 value=95
root@rpilan:~#

root@rpilan:~# uvcdynctrl -c
Listing available controls for device video0:
  Brightness
  Contrast
  Saturation
  Red Balance
  Blue Balance
  Horizontal Flip
  Vertical Flip
  Power Line Frequency
  Sharpness
  Color Effects
  Rotate
  Color Effects, CbCr
  Video Bitrate Mode
  Video Bitrate
  Repeat Sequence Header
  H264 I-Frame Period
  H264 Level
  H264 Profile
  Auto Exposure
  Exposure Time, Absolute
  Exposure, Dynamic Framerate
  White Balance, Auto & Preset
  Image Stabilization
  ISO Sensitivity, Auto
  Exposure, Metering Mode
  Scene Mode
root@rpilan:~#
root@rpilan:~# locale
LANG=C.UTF-8
LANGUAGE=
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=
root@rpilan:~#

изображение изображение

tgorochowik commented 2 years ago

Thank you for creating this very detailed issue! We'll see which of your changes can be incorporated to the codebase and if there's something we can do about the other things you report.

tgorochowik commented 2 years ago

See #12 and #13 - these are some fixes similar to what you propose. One fixes the decoding issue - apparently your camera reports something in a non-ascii encoding - using utf-8 seems like a valid choice. The other one makes the color setup optional.

One remark regarding the way you run it: if your terminal does not support some colors/characters out of the box it's possible that you don't have proper TERMCAPs installed. This is often the case when you ssh into a remote machine and the terminal you're using locally is not installed on the remote machine (i.e. the termcaps for it are not there).

One simple workaround that usually works is runnig it like TERM=xterm <app> - xterms termcaps are usually installed everywhere so it's same to assume it will work like this.

And not fully control list (see bottom screens and compare to v4l2-ctrl output)

Could you please point out directly what is missing? That's true that we might not yet support all v4l2 control types (each requires explicit support), but it's hard to say what's exactly missing from your screenshots as some of the properties are probably below (maybe adding some kind of a scrollbar/indicator might make sense)

ZalgoSoft commented 2 years ago
VERIFIED FIXED on untouched unspoiled system with same hardware and env
Got run out of box with no shamanic rites with packages and pythons. You are a skillful noble sir.
Will use this tool on permanent manner for my cluster.
( Another suggestion - could you make an output mode that generates html/json and somehow fix it to cgi httpd )

root@dale:~/pyvidctrl# cat /etc/*rele*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"
root@dale:~/pyvidctrl# pip -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
root@dale:~/pyvidctrl# uname -a
Linux dale.lan 5.4.0-104-generic #118-Ubuntu SMP Wed Mar 2 19:04:47 UTC 2022 armv7l armv7l armv7l GNU/Linux

root@dale:~/pyvidctrl# pip install git+https://github.com/antmicro/pyvidctrl
Collecting git+https://github.com/antmicro/pyvidctrl
  Cloning https://github.com/antmicro/pyvidctrl to /tmp/pip-req-build-3_po6l2h
  Running command git clone -q https://github.com/antmicro/pyvidctrl /tmp/pip-req-build-3_po6l2h
Collecting v4l2@ git+https://github.com/antmicro/python3-v4l2
  Cloning https://github.com/antmicro/python3-v4l2 to /tmp/pip-install-_f4dynzw/v4l2
  Running command git clone -q https://github.com/antmicro/python3-v4l2 /tmp/pip-install-_f4dynzw/v4l2
Building wheels for collected packages: pyvidctrl, v4l2
  Building wheel for pyvidctrl (setup.py) ... done
  Created wheel for pyvidctrl: filename=pyvidctrl-1.0-py3-none-any.whl size=17781 sha256=920f507010797a3a2dbcaf4945e8146111117418c4d0ff598ddb4c1d34914197
  Stored in directory: /tmp/pip-ephem-wheel-cache-s7tyy58q/wheels/08/a6/7e/53e46f5203ee2cfb1d4f80769fb998fd71e4c41924abfc3325
  Building wheel for v4l2 (setup.py) ... done
  Created wheel for v4l2: filename=v4l2-0.2-py3-none-any.whl size=19985 sha256=5b7e838c9218bec5da3e6d5b23b4e23a53886df1175f0d71763e602461bce52e
  Stored in directory: /tmp/pip-ephem-wheel-cache-s7tyy58q/wheels/63/aa/5c/ea0d113744766bdd120c92f21caf4348189457793806687187
Successfully built pyvidctrl v4l2
Installing collected packages: v4l2, pyvidctrl
Successfully installed pyvidctrl-1.0 v4l2-0.2
root@dale:~/pyvidctrl# pyvidctrl
Traceback (most recent call last):
File "/usr/local/bin/pyvidctrl", line 8, in <module> sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 581, in main app.start_tui()
File "/usr/local/lib/python3.8/dist-packages/pyvidctrl/__main__.py", line 149, in start_tui curses.curs_set(False) _curses.error: curs_set() returned ERR
root@dale:~/pyvidctrl#

root@dale:~/pyvidctrl# LANG=ru_RU.UTF-8 TERM=linux pyvidctrl

pyVidController - press ? for help

                                 User Controls

   Brightness                                              192
..........................etc
WORKS.

изображение

root@dale:~/pyvidctrl# v4l2-ctl --all
Driver Info:
        Driver name      : uvcvideo
        Card type        : Video Capture 3
        Bus info         : usb-c5008000.usb-1.2
        Driver version   : 5.4.166
        Capabilities     : 0x84a00001
                Video Capture
                Metadata Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : uvcvideo
        Model            : USB Camera: USB Camera
        Serial           : 200901010001
        Bus info         : usb-c5008000.usb-1.2
        Media version    : 5.4.166
        Hardware revision: 0x00000925 (2341)
        Driver version   : 5.4.166
Interface Info:
        ID               : 0x03000002
        Type             : V4L Video
Entity Info:
        ID               : 0x00000001 (1)
        Name             : Video Capture 3
        Function         : V4L2 I/O
        Flags         : default
        Pad 0x01000007   : 0: Sink
          Link 0x02000010: from remote pad 0x100000a of entity 'Processing 2': Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
        Width/Height      : 640/480
        Pixel Format      : 'YUYV' (YUYV 4:2:2)
        Field             : None
        Bytes per Line    : 1280
        Size Image        : 614400
        Colorspace        : sRGB
        Transfer Function : Default (maps to sRGB)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Limited Range)
        Flags             :
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 640, Height 480
        Default     : Left 0, Top 0, Width 640, Height 480
        Pixel Aspect: 1/1
Selection Video Capture: crop_default, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Capture: crop_bounds, Left 0, Top 0, Width 640, Height 480, Flags:
Streaming Parameters Video Capture:
        Capabilities     : timeperframe
        Frames per second: 30.000 (30/1)
        Read buffers     : 0
                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=192
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=128 value=128
                     saturation 0x00980902 (int)    : min=0 max=255 step=1 default=128 value=128
                            hue 0x00980903 (int)    : min=0 max=255 step=1 default=128 value=128
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                          gamma 0x00980910 (int)    : min=100 max=500 step=1 default=220 value=220
                           gain 0x00980913 (int)    : min=0 max=100 step=1 default=0 value=100
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=1 value=1
                                0: Disabled
                                1: 50 Hz
                                2: 60 Hz
      white_balance_temperature 0x0098091a (int)    : min=2800 max=6500 step=10 default=4650 value=4650 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=4 step=1 default=1 value=1
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=0 value=1
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=1
                                1: Manual Mode
                                3: Aperture Priority Mode
              exposure_absolute 0x009a0902 (int)    : min=50 max=10000 step=1 default=166 value=2000
         exposure_auto_priority 0x009a0903 (bool)   : default=0 value=0
root@dale:~/pyvidctrl#

root@dale:~/pyvidctrl# lsusb -d 0bda:58f2 -v

Bus 002 Device 006: ID 0bda:58f2 Realtek Semiconductor Corp.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x0bda Realtek Semiconductor Corp.
  idProduct          0x58f2
  bcdDevice            9.25
  iManufacturer           3 Generic
  iProduct                1 USB Camera
  iSerial                 2 200901010001
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x03af
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          4 USB Camera
    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               5 USB Camera
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      1 Video Control
      bInterfaceProtocol      0
      iInterface              5 USB Camera
      VideoControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdUVC               1.00
        wTotalLength       0x004e
        dwClockFrequency       15.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           0x0000000e
          Auto-Exposure Mode
          Auto-Exposure Priority
          Exposure Time (Absolute)
      VideoControl Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      5 (PROCESSING_UNIT)
      Warning: Descriptor too short
        bUnitID                 2
        bSourceID               1
        wMaxMultiplier          0
        bControlSize            2
        bmControls     0x0000177f
          Brightness
          Contrast
          Hue
          Saturation
          Sharpness
          Gamma
          White Balance Temperature
          Backlight Compensation
          Gain
          Power Line Frequency
          White Balance Temperature, Auto
        iProcessing             0
        bmVideoStandards     0x09
          None
          SECAM - 625/50
      VideoControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             3
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID               2
        iTerminal               0
      VideoControl Interface Descriptor:
        bLength                27
        bDescriptorType        36
        bDescriptorSubtype      6 (EXTENSION_UNIT)
        bUnitID                 4
        guidExtensionCode         {1229a78c-47b4-4094-b0ce-db07386fb938}
        bNumControl             2
        bNrPins                 1
        baSourceID( 0)          1
        bControlSize            2
        bmControls( 0)       0x00
        bmControls( 1)       0x06
        iExtension              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               6
    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                   0x02c2
        bEndPointAddress                  129
        bmInfo                              0
        bTerminalLink                       3
        bStillCaptureMethod                 2
        bTriggerSupport                     1
        bTriggerUsage                       0
        bControlSize                        1
        bmaControls( 0)                     0
        bmaControls( 1)                     0
      VideoStreaming Interface Descriptor:
        bLength                            27
        bDescriptorType                    36
        bDescriptorSubtype                  4 (FORMAT_UNCOMPRESSED)
        bFormatIndex                        1
        bNumFrameDescriptors                7
        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                            38
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         1
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            640
        wHeight                           480
        dwMinBitRate                 49152000
        dwMaxBitRate                147456000
        dwMaxVideoFrameBufferSize      614400
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  3
        dwFrameInterval( 0)            333333
        dwFrameInterval( 1)            500000
        dwFrameInterval( 2)           1000000
      VideoStreaming Interface Descriptor:
        bLength                            38
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         2
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            160
        wHeight                           120
        dwMinBitRate                  3072000
        dwMaxBitRate                  9216000
        dwMaxVideoFrameBufferSize       38400
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  3
        dwFrameInterval( 0)            333333
        dwFrameInterval( 1)            500000
        dwFrameInterval( 2)           1000000
      VideoStreaming Interface Descriptor:
        bLength                            38
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         3
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            176
        wHeight                           144
        dwMinBitRate                  4055040
        dwMaxBitRate                 12165120
        dwMaxVideoFrameBufferSize       50688
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  3
        dwFrameInterval( 0)            333333
        dwFrameInterval( 1)            500000
        dwFrameInterval( 2)           1000000
      VideoStreaming Interface Descriptor:
        bLength                            38
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         4
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            320
        wHeight                           240
        dwMinBitRate                 12288000
        dwMaxBitRate                 36864000
        dwMaxVideoFrameBufferSize      153600
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  3
        dwFrameInterval( 0)            333333
        dwFrameInterval( 1)            500000
        dwFrameInterval( 2)           1000000
      VideoStreaming Interface Descriptor:
        bLength                            38
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         5
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            352
        wHeight                           288
        dwMinBitRate                 16220160
        dwMaxBitRate                 48660480
        dwMaxVideoFrameBufferSize      202752
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  3
        dwFrameInterval( 0)            333333
        dwFrameInterval( 1)            500000
        dwFrameInterval( 2)           1000000
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         6
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                           1280
        wHeight                           800
        dwMinBitRate                131072000
        dwMaxBitRate                131072000
        dwMaxVideoFrameBufferSize     2048000
        dwDefaultFrameInterval        1250000
        bFrameIntervalType                  1
        dwFrameInterval( 0)           1250000
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         7
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                           1280
        wHeight                          1024
        dwMinBitRate                167772160
        dwMaxBitRate                167772160
        dwMaxVideoFrameBufferSize     2621440
        dwDefaultFrameInterval        1250000
        bFrameIntervalType                  1
        dwFrameInterval( 0)           1250000
      VideoStreaming Interface Descriptor:
        bLength                            34
        bDescriptorType                    36
        bDescriptorSubtype                  3 (STILL_IMAGE_FRAME)
        bEndpointAddress                    0
        bNumImageSizePatterns               7
        wWidth( 0)                       1280
        wHeight( 0)                      1024
        wWidth( 1)                        160
        wHeight( 1)                       120
        wWidth( 2)                        176
        wHeight( 2)                       144
        wWidth( 3)                        320
        wHeight( 3)                       240
        wWidth( 4)                        352
        wHeight( 4)                       288
        wWidth( 5)                        640
        wHeight( 5)                       480
        wWidth( 6)                       1280
        wHeight( 6)                       800
        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))
      VideoStreaming Interface Descriptor:
        bLength                            56
        bDescriptorType                    36
        bDescriptorSubtype                 14         Invalid desc subtype: 02 07 30 32 34 59 00 00 10 00 80 00 00 aa 00 38 9b 71 32 56 55 59 00 00 10 00 80 00 00 aa 00 38 9b 71 33 56 55 59 00 00 10 00 80 00 00 aa 00 38 9b 71 00 01 00
      VideoStreaming Interface Descriptor:
        bLength                            42
        bDescriptorType                    36
        bDescriptorSubtype                 15         Invalid desc subtype: 01 00 80 02 e0 01 00 00 65 04 00 00 ca 08 00 60 09 00 15 16 05 00 04 15 16 05 00 80 1a 06 00 20 a1 07 00 2a 2c 0a 00
      VideoStreaming Interface Descriptor:
        bLength                            42
        bDescriptorType                    36
        bDescriptorSubtype                 15         Invalid desc subtype: 02 00 a0 00 78 00 00 50 46 00 00 a0 8c 00 00 96 00 00 15 16 05 00 04 15 16 05 00 80 1a 06 00 20 a1 07 00 2a 2c 0a 00
      VideoStreaming Interface Descriptor:
        bLength                            42
        bDescriptorType                    36
        bDescriptorSubtype                 15         Invalid desc subtype: 03 00 b0 00 90 00 00 d0 5c 00 00 a0 b9 00 00 c6 00 00 15 16 05 00 04 15 16 05 00 80 1a 06 00 20 a1 07 00 2a 2c 0a 00
      VideoStreaming Interface Descriptor:
        bLength                            42
        bDescriptorType                    36
        bDescriptorSubtype                 15         Invalid desc subtype: 04 00 40 01 f0 00 00 40 19 01 00 80 32 02 00 58 02 00 15 16 05 00 04 15 16 05 00 80 1a 06 00 20 a1 07 00 2a 2c 0a 00
      VideoStreaming Interface Descriptor:
        bLength                            42
        bDescriptorType                    36
        bDescriptorSubtype                 15         Invalid desc subtype: 05 00 60 01 20 01 00 40 73 01 00 80 e6 02 00 18 03 00 15 16 05 00 04 15 16 05 00 80 1a 06 00 20 a1 07 00 2a 2c 0a 00
      VideoStreaming Interface Descriptor:
        bLength                            34
        bDescriptorType                    36
        bDescriptorSubtype                 15         Invalid desc subtype: 06 00 00 05 20 03 00 00 e2 04 00 00 be 0a 00 40 1f 00 22 df 0d 00 02 22 df 0d 00 80 84 1e 00
      VideoStreaming Interface Descriptor:
        bLength                            34
        bDescriptorType                    36
        bDescriptorSubtype                 15         Invalid desc subtype: 07 00 00 05 00 04 00 00 40 06 00 00 c0 0d 00 00 28 00 22 df 0d 00 02 22 df 0d 00 80 84 1e 00
      VideoStreaming Interface Descriptor:
        bLength                            34
        bDescriptorType                    36
        bDescriptorSubtype                  3 (STILL_IMAGE_FRAME)
        bEndpointAddress                    0
        bNumImageSizePatterns               7
        wWidth( 0)                       1280
        wHeight( 0)                      1024
        wWidth( 1)                        160
        wHeight( 1)                       120
        wWidth( 2)                        176
        wHeight( 2)                       144
        wWidth( 3)                        320
        wHeight( 3)                       240
        wWidth( 4)                        352
        wHeight( 4)                       288
        wWidth( 5)                        640
        wHeight( 5)                       480
        wWidth( 6)                       1280
        wHeight( 6)                       800
        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     0x81  EP 1 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0080  1x 128 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     0x0200  1x 512 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     0x0400  1x 1024 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     0x0b00  2x 768 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       5
      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     0x0c00  2x 1024 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       6
      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     0x1380  3x 896 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       7
      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
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
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0000
  (Bus Powered)
root@dale:~/pyvidctrl#