depthai: [BUG] UVC demo app does not work with OAK-D-Lite

Describe the bug Running python3 demo_script.py --app uvc with OAK-D-Lite creates /dev/video* device(s) only for a few seconds, the camera then disconnects and reconnects again as a non-uvc device, the /dev/video* devices disappear.

To Reproduce (interlaced with console and dmesg outputs)

  1. Connect OAK-D-Lite

dmesg:

[ 3283.174698] usb 1-1: new high-speed USB device number 36 using xhci_hcd
[ 3283.315643] usb 1-1: New USB device found, idVendor=03e7, idProduct=2485, bcdDevice= 0.01
[ 3283.315665] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3283.315674] usb 1-1: Product: Movidius MyriadX
[ 3283.315681] usb 1-1: Manufacturer: Movidius Ltd.
[ 3283.315687] usb 1-1: SerialNumber: 03e72485

v4l2-ctl --list-device:

v4l2loopback (platform:v4l2loopback-000):
	/dev/video9

HD WebCam: HD WebCam (usb-0000:00:14.0-7):
	/dev/video0
	/dev/video1
	/dev/media0
  1. Run python3 depthai_demo.py --app uvc

python3 depthai_demo.py --app uvc console:

Existing venv found.
Installing requirements...
Requirement already satisfied: pip in ./venv/lib/python3.10/site-packages (21.3.1)
Looking in indexes: https://pypi.org/simple, https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/
Requirement already satisfied: depthai==2.13.3.0.dev+f513b0f27b4f07a9940cd9dfe65d7fd6deeaf29d in ./venv/lib/python3.10/site-packages (from -r /home/zegkljan/tmp/depthai/apps/uvc/requirements.txt (line 2)) (2.13.3.0.dev0+f513b0f27b4f07a9940cd9dfe65d7fd6deeaf29d)
[18443010312C7C0F00] [89.076] [system] [info] PRINT:LeonCss: bss_init took 42.307 ms
BootloaderConfig.options1 checksum doesn't match. Is: 0x10304418 should be: 0x7018171A
BootloaderConfig.options2 checksum doesn't match. Is: 0x00214442 should be: 0x11FD80E1
GPIO boot mode 0x16, interface USBD
Setting aons(0..4) back to boot from flash (offset = 0)
====ENABLE WATCHDOG====1
--> brdInit ...
initial keepalive, countdown: 10
PLL0: 700000 AUX_IO0: 24000 AUX_IO1: 24000 MCFG: 24000 MECFG: 24000
Board init ret 3
brdInitAuxDevices: Error: SC = 27: io_initialize expander_cam_gpios_1 [OK]

spi_N25Q_init: Flash JEDEC ID: ff ff ff
eeprom_read_status 0!
Reading VERSION 6 --- ->
Closing EEPROm!
Is booted from flash by bootloader: 0
Networking not available...
Called by: LOS, controller: LOS
Enumerating on socket: Cam_A / RGB / Center
Probe failed I2C1 0x10 reg 300a: expected 9281, read 0000
Probe failed I2C1 0x10 reg 300a: expected 9281, read 0000
Probe failed I2C1 0x10 reg 300a: expected 9281, read 0000
Probe failed I2C1 0x10 reg 300a: expected 9281, read 0000
Probe failed I2C1 0x10 reg 300a: expected 9281, read 0000
Probe failed I2C1 0x10 reg 300a: expected 9281, read 0000
Probe failed I2C1 0x10 reg 300a: expected 9281, read 0000
Probe failed I2C1 0x10 reg 300a: expected 7750, read 0000
Probe failed I2C1 0x10 reg 300a: expected 7750, read 0000
Probe failed I2C1 0x10 reg 300a: expected 7750, read 0000
Probe failed I2C1 0x10 reg 300a: expected 7750, read 0000
  >> Registered camera IMX214R0 (imx214) as /dev/Camera_0
Enumerating on socket: Cam_B / Left
Probe failed I2C2 0x60 reg 300a: expected 9281, read 7750
Probe failed I2C2 0x60 reg 300a: expected 9281, read 7750
Probe failed I2C2 0x60 reg 300a: expected 9281, read 7750
Probe failed I2C2 0x60 reg 300a: expected 9281, read 7750
Probe failed I2C2 0x60 reg 300a: expected 9281, read 7750
Probe failed I2C2 0x60 reg 300a: expected 9281, read 7750
  >> Registered camera MV200 (ov7750) as /dev/Camera_1
Enumerating on socket: Cam_C / Right
Probe failed I2C2 0x62 reg 300a: expected 9281, read 7750
Probe failed I2C2 0x60 reg 300a: expected 9281, read 7750
Probe failed I2C2 0x60 reg 300a: expected 9281, read 7750
Probe failed I2C2 0x60 reg 300a: expected 9281, read 7750
Probe failed I2C2 0x60 reg 300a: expected 9281, read 7750
Probe failed I2C2 0x60 reg 300a: expected 9281, read 7750
Probe failed I2C2 0x60 reg 300a: expected 9281, read 7750
  >> Registered camera MV200 (ov7750) as /dev/Camera_2
Enumerating on socket: CAM_D
initial keepalive, countdown: 9
Initializing XLink...
UsbPumpVscAppI_Event: 5 VSC2_EVENT_ATTACH
UsbPumpVscAppI_Event: 2 VSC2_EVENT_SUSPEND
UsbPumpVscAppI_Event: 3 VSC2_EVENT_RESUME
UsbPumpVscAppI_Event: 4 VSC2_EVENT_RESET
initial keepalive, countdown: 8
UsbPumpVscAppI_Event: 4 VSC2_EVENT_RESET
UsbPumpVscAppI_Event: 4 VSC2_EVENT_RESET
UsbPumpVscAppI_Event: 4 VSC2_EVENT_RESET
UsbPumpVscAppI_Event: 2 VSC2_EVENT_SUSPEND
UsbPumpVscAppI_Event: 3 VSC2_EVENT_RESUME
UsbPumpVscAppI_Event: 0 VSC2_EVENT_INTERFACE_UP
UsbPumpVscAppI_Event: 2 VSC2_EVENT_SUSPEND
UsbPumpVscAppI_Event: 3 VSC2_EVENT_RESUME
UsbPumpVscAppI_Event: 2 VSC2_EVENT_SUSPEND
UsbPumpVscAppI_Event: 3 VSC2_EVENT_RESUME
Done!
Usb connection speed: High - USB 2.0
I: [Timesync] [   1797428] [main] startSync:116     Timesync | Callback not set
Temperature: Driver registered.
Temperature: Initialized driver.
Temperature: Sensor opened: CSS.
Temperature: Sensor opened: MSS.
Temperature: Sensor opened: UPA.
Temperature: Sensor opened: DSS.
[18443010312C7C0F00] [89.076] [system] [info] PRINT:LeonMss: Called by: LRT, controller: LOS

Device started, please keep this process running
and open an UVC viewer. Example on Linux:
    guvcview -d /dev/video0

To close: Ctrl+C

dmesg:

[ 3390.764840] usb 1-1: Found UVC 1.00 device Luxonis Device (03e7:f63b)
[ 3390.765830] usb 1-1: Failed to query (GET_INFO) UVC control 9 on unit 1: -32 (exp. 1).
[ 3393.705249] usb 1-1: USB disconnect, device number 37
[ 3394.011224] usb 1-1: new high-speed USB device number 38 using xhci_hcd
[ 3394.151918] usb 1-1: New USB device found, idVendor=03e7, idProduct=2485, bcdDevice= 0.01
[ 3394.151922] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3394.151924] usb 1-1: Product: Movidius MyriadX
[ 3394.151926] usb 1-1: Manufacturer: Movidius Ltd.
[ 3394.151927] usb 1-1: SerialNumber: 03e72485
  1. There are no new /dev/video* devices. Also, the app uses 100 % of one CPU core. v4l2-ctl --list-device:
v4l2loopback (platform:v4l2loopback-000):
	/dev/video9

HD WebCam: HD WebCam (usb-0000:00:14.0-7):
	/dev/video0
	/dev/video1
	/dev/media0

Sometimes, however it takes some time (on the order of seconds, or lower 10s of secods) during which the /dev/video* devices are present:

v4l2loopback (platform:v4l2loopback-000):
	/dev/video9

Luxonis Device: UVC Video Contr (usb-0000:00:14.0-1):
	/dev/video2
	/dev/video3
	/dev/media1

HD WebCam: HD WebCam (usb-0000:00:14.0-7):
	/dev/video0
	/dev/video1
	/dev/media0

Sometimes I also get the following segfault from depthai_demo.py (and in that case it does not use up 100 % of CPU, but does not exit either, I still have to Ctrl-C it):

...
Device started, please keep this process running
and open an UVC viewer. Example on Linux:
    guvcview -d /dev/video0

To close: Ctrl+C
Stack trace (most recent call last) in thread 11826:
#2    Object "[", at 0, in nil
#1    Object "/usr/lib/libc.so.6", at 0x7f420ec0ed9f, in 
#0    Object "/home/zegkljan/tmp/depthai/apps/uvc/venv/lib/python3.10/site-packages/depthai.cpython-310-x86_64-linux-gnu.so", at 0x7f420d6fb785, in backward::SignalHandling::sig_handler(int, siginfo_t*, void*)
Segmentation fault (Address not mapped to object [(nil)])

The two “sometimes” alternatives happen seemingly at random, I have not noticed any pattern.

Expected behavior The UVC app should work, i.e. provide a working UVC device(s).

System log

{
    "architecture": "64bit ELF",
    "machine": "x86_64",
    "platform": "Linux-5.16.1-arch1-1-x86_64-with-glibc2.33",
    "processor": "",
    "python_build": "main Dec 18 2021 23:53:45",
    "python_compiler": "GCC 11.1.0",
    "python_implementation": "CPython",
    "python_version": "3.10.1",
    "release": "5.16.1-arch1-1",
    "system": "Linux",
    "version": "#1 SMP PREEMPT Sun, 16 Jan 2022 11:39:23 +0000",
    "win32_ver": "",
    "packages": [
        "appdirs==1.4.4",
        "Brlapi==0.8.3",
        "btrfsutil==5.16",
        "CacheControl==0.12.6",
        "cffi==1.15.0",
        "chardet==4.0.0",
        "chrome-gnome-shell==0.0.0",
        "colorama==0.4.4",
        "contextlib2==0.6.0.post1",
        "cryptography==36.0.1",
        "depthai==2.14.1.0",
        "distlib==0.3.4",
        "distro==1.6.0",
        "dnspython==2.1.0",
        "filelock==3.4.0",
        "guake==3.8.1",
        "html5lib==1.1",
        "idna==3.3",
        "importlib-metadata==4.8.1",
        "lensfun==0.3.95",
        "libfdt==1.6.1",
        "louis==3.20.0",
        "Markdown==3.3.6",
        "more-itertools==8.10.0",
        "msgpack==1.0.3",
        "netsnmp-python==1.0a1",
        "numpy==1.21.5",
        "opencv-contrib-python==4.5.5.62",
        "opencv-python==4.5.5.62",
        "ordered-set==4.0.2",
        "packaging==20.9",
        "pbr==5.8.0",
        "pep517==0.12.0",
        "pip==20.3.4",
        "platformdirs==2.4.1",
        "ply==3.11",
        "progress==1.6",
        "pwquality==1.4.4",
        "pybind11==2.9.0",
        "pycairo==1.20.1",
        "pycparser==2.21",
        "PyGObject==3.42.0",
        "pyOpenSSL==21.0.0",
        "pyparsing==2.4.7",
        "pyvirtualcam==0.9.0",
        "pyxdg==0.27",
        "requests==2.26.0",
        "resolvelib==0.5.5",
        "retrying==1.3.3",
        "setuptools==59.1.1",
        "six==1.16.0",
        "TBB==0.2",
        "team==1.0",
        "toml==0.10.2",
        "tomli==1.2.3",
        "urllib3==1.26.7",
        "virtualenv==20.11.0",
        "webencodings==0.5.1",
        "zipp==3.6.0"
    ],
    "usb": [
        "NoLib"
    ],
    "uname": [
        "Linux eddie 5.16.1-arch1-1 #1 SMP PREEMPT Sun, 16 Jan 2022 11:39:23 +0000 x86_64"
    ]
}

Additional context The OAK-D-Lite is connected via USB-C to USB-A cable, sadly only an USB 2 cable. I’m getting an USB 3.1 cable very soon.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 23 (9 by maintainers)

Most upvoted comments

@arafattehsin replacing the cable with USB3 one should resolve this issue

Hi @arafattehsin, As it’s a Windows machine, may be a little more complicated to check the USB speed in the system, but our demo should print it. Do you see UsbSpeed.HIGH (equivalent to USB2) as below when the demo runs in standard mode?

Using depthai module from:  C:\Users\user\AppData\Local\Programs\DepthAI\venv\lib\site-packages\depthai.cp39-win_amd64.pyd
Depthai version installed:  2.14.1.0.dev+27fa4519f289498e84768ab5229a1a45efb7e4df
Setting up demo...
Available devices:
[0] 18443010915E1DF500 [X_LINK_UNBOOTED]
USB Connection speed: UsbSpeed.HIGH
Enabling low-bandwidth mode due to low USB speed... (speed: UsbSpeed.HIGH)

If that’s the case, what type-C cable are you using, are both ends type-C, or it’s type-A to type-C? With the latter, there’s a possibility the device could be enumerated in USB2 mode if type-A is plugged first (so it’s powered) and then the type-C end is plugged into the device and it’s done “slowly” (first the power pins inside the type-C making contact, then data pins). A power-cycle (cable reconnection) is needed to recover from this.

The console logs are fine for the first part, I’m observing the same on Windows, it doesn’t advance to printing the status unless an UVC consumer (e.g. Camera app) is started.

Thanks @zegkljan for testing and happy it’s resolved on your side. With #618 merged, the UVC app will exit gracefully with a message suggesting USB3 cable usage and informing that we’re working on solving the issue, as you suggested - best what we can do until it’s resolved

I just want to quickly confirm that with a proper USB3 cable UVC works flawlessly. I don’t think UVC not working over USB2 is necessarily a problem, it just should be advertised, or the UVC app should refuse to run with just USB2 (and explain why). But UVC over USB2 would certainly be nice.

Thanks for the thorough details and sorry about the trouble here!

I just reproduced the problem using a USB2 cable on an M1 Max Macbook Pro with my OAK-D-Lite. And then using a USB3 cable it actually worked fine: image

So this is something to do with using a USB2 cable and the device acting as a webcam (UVC).

So the USB3(.1) cable you are getting should resolve this. I will need @alex-luxonis insight on UVC over USB2. I tried with python3 depthai_demo.py -usbs usb2 -app uvc but this had no impact, which I think makes sense as I don’t think the usbs flag would have any bearing on UVC, as it’s a setting for the actual DepthAI communication, not UVC communication.

Thanks and sorry again about the trouble.

yes, running python3 depthai_demo.py --app uvc we get:

“This app is temporarily disabled on AARCH64 systems due to an issue with stream preview. We are working on resolving this issue”

On Tue, Jan 31, 2023 at 5:14 AM Erol444 @.***> wrote:

Hi @hg111 https://github.com/hg111 , Have ran the UVC pipeline? Docs here https://docs.luxonis.com/en/latest/pages/oak_webcam/.

— Reply to this email directly, view it on GitHub https://github.com/luxonis/depthai/issues/616#issuecomment-1410328297, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZE7VXYJSHLIYHGKF7UOMDWVEF4JANCNFSM5MKFVWKQ . You are receiving this because you were mentioned.Message ID: @.***>

@alex-luxonis - Please take your time but an option to choose the resolution (or launching it with the specific resolution option) will always be great, considering its 4K capabilities. 🙂

We’ll also fix the USB2 issue (hopefully within 1…2 weeks), but the performance with USB3 will be better for uncompressed streaming.

At the moment, the UVC configuration is 1920×1080 NV12 (1.5 bytes/pixel). (the camera is actually configured at THE_4_K resolution with 2x downscale - this gives sharper images than THE_1080_P with scaling/binning on-sensor)

The bandwidth required for 30fps is: 1920 * 1080 * 1.5 * 30 = around 94 MB/s. USB2 can’t sustain this, so we’ll probably lower the resolution to 720p with USB2. And further will look at enabling JPEG or H.264/H.265 (AVC/HEVC) encoding with UVC.

Unrelated to the above, adding a general note for the differentiation between an USB2 and USB3 cable, as many type-C cables on the market are USB2-only. If the other end is type-A, the color usually should be blue, or it can be checked if a row of 5 extra pins exists deep inside the connector: image (image source)

Odd. So the system thinks it is connected to USB2 only here. To debug, when running the demo app gui could you do lsusb and share the output here?