v4l2uvcuvcvideo

v4l2-ctl won't respond if device disconnect


I can capture video

v4l2-ctl -d 0 --set-fmt-video=width=1280,height=720,pixelformat=MJPG --stream-mmap --set-parm 25 --stream-to=video.yuvj422p --stream-count=1000

While capturing I disconnect camera from PC. In my Ubuntu v4l2-ctl process do won't respond forever (I am waiting about 10 minutes). But in Buildroot (kernel 4.19.269) v4l2-ctl stops with message

VIDIOC_DQBUF: failed: No such device

Why in case of Ubuntu v4l2-ctl won't respond? I am waiting message from v4l2-ctl-streaming.cpp.

Ubuntu version linux 6.2.0-26-generic #26~22.04.1-Ubuntu

v4l2-ctl in both computers has the same version.

v4l2-ctl --version
v4l2-ctl 1.22.1

Solution

  • If I add --stream-poll option then in Ubuntu v4l2-ctl finish if camera will disconnect. Should I always use --stream-poll option?

    This is my cmd and output in Ubuntu:

    v4l2-ctl -d 0 --set-fmt-video=width=1280,height=720,pixelformat=MJPG --stream-mmap --set-parm 25 --stream-to=video.yuvj422p --stream-count=1000 --stream-poll
    Frame rate set to 25.000 fps
    <<<<< 3.91 fps
    <<<<<<VIDIOC_DQBUF: failed: No such device