Unable to use Arducam B0205 with VOXL (not VOXL2) - USB Camera
-
Description of Problem:
I have a ModalAI M500 with an Arducam B0205 (link) connected to it. Although the camera shows up with
lsusb
, I cannot use it inside my docker container. Other USB cameras work fine. This Arducam camera works fine on my laptop, which runs Linux Mint.I commonly get the error message that the camera is in use, but
lsof
shows it is not used by the container nor any process inside Yocto.Output of
uname -a
andls /dev | grep video
:voxl:~$ uname -a Linux apq8096 3.18.71-perf #1 SMP PREEMPT Sun Jun 6 19:41:01 UTC 2021 aarch64 GNU/Linux voxl:~$ ls /dev | grep video video0 video1 video2 video3 video32 video33 video4
The camera is confirmed to be
/dev/video2
.Output of
lsof
,lsusb
,ffmpeg
, and related debugging commands:Commands run on Yocto:
voxl:~$ ./lsof | grep /dev/video2 voxl:~$ lsusb Bus 001 Device 030: ID 0c45:6369 Microdia Bus 001 Device 006: ID 1f94:3002 Bus 001 Device 004: ID 0424:7500 Standard Microsystems Corp. LAN7500 Ethernet 10/100/1000 Adapter Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub voxl:~$ ffmpeg -i /dev/video2 ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 4.9.3 (GCC) configuration: --arch=arm --prefix=/builds/voxl-public/voxl-ffmpeg/ipk/data/usr/local --enable-omx libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 [video4linux2,v4l2 @ 0x1761120] Cannot open video device /dev/video2: Device or resource busy /dev/video2: Device or resource busy voxl:~$
Yes, I have verified that my
lsof
binary works. The camera is the0c45:6369 Microdia
device listed inlsusb
. Strangely, even though the camera is not in use,ffmpeg
reports "/dev/video2: Device or resource busy
".Commands run inside my roskinetic container:
roskinetic:~$ v4l2-ctl --device=/dev/video2 -D --list-formats Failed to open /dev/video2: Device or resource busy roskinetic:~$ python3 Python 3.9.0 (default, Sep 2 2022, 14:09:47) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> cam = cap.open('/dev/video2', cv2.CAP_ANY) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'cap' is not defined >>> cap = cv2.VideoCapture('/dev/video2', cv2.CAP_ANY) [ WARN:0@27.752] global /io/opencv/modules/imgcodecs/src/loadsave.cpp (239) findDecoder imread_('/dev/video2'): can't open/read file: check file path/integrity >>> exit()
roskinetic:~$ ls -al /dev | grep video2 crw-rw----. 1 root video 81, 20 Jan 1 1970 video2 roskinetic:~$ lsof COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME bash 1 root cwd DIR 0,31 4096 31256 /root bash 1 root rtd DIR 0,31 4096 29395 / bash 1 root txt REG 179,1 925744 6305171 /bin/bash bash 1 root mem REG 179,1 39272 1197209 /lib/aarch64-linux-gnu/libnss_files-2.23.so bash 1 root mem REG 179,1 39312 1197211 /lib/aarch64-linux-gnu/libnss_nis-2.23.so bash 1 root mem REG 179,1 76632 1197206 /lib/aarch64-linux-gnu/libnsl-2.23.so bash 1 root mem REG 179,1 31408 1197207 /lib/aarch64-linux-gnu/libnss_compat-2.23.so bash 1 root mem REG 179,1 1261896 1197197 /lib/aarch64-linux-gnu/libc-2.23.so bash 1 root mem REG 179,1 10400 1197201 /lib/aarch64-linux-gnu/libdl-2.23.so bash 1 root mem REG 179,1 154784 6292046 /lib/aarch64-linux-gnu/libtinfo.so.5.9 bash 1 root mem REG 179,1 125776 1197193 /lib/aarch64-linux-gnu/ld-2.23.so bash 1 root 0u CHR 136,0 0t0 3 /0 bash 1 root 1u CHR 136,0 0t0 3 /0 bash 1 root 2u CHR 136,0 0t0 3 /0 bash 1 root 255u CHR 136,0 0t0 3 /0 lsof 7819 root cwd DIR 0,31 4096 31256 /root lsof 7819 root rtd DIR 0,31 4096 29395 / lsof 7819 root txt REG 179,1 171304 7235192 /usr/bin/lsof lsof 7819 root mem REG 179,1 139560 1197214 /lib/aarch64-linux-gnu/libpthread-2.23.so lsof 7819 root mem REG 179,1 10400 1197201 /lib/aarch64-linux-gnu/libdl-2.23.so lsof 7819 root mem REG 179,1 395104 6292022 /lib/aarch64-linux-gnu/libpcre.so.3.13.2 lsof 7819 root mem REG 179,1 1261896 1197197 /lib/aarch64-linux-gnu/libc-2.23.so lsof 7819 root mem REG 179,1 109656 6292035 /lib/aarch64-linux-gnu/libselinux.so.1 lsof 7819 root mem REG 179,1 125776 1197193 /lib/aarch64-linux-gnu/ld-2.23.so lsof 7819 root 0u CHR 136,0 0t0 3 /0 lsof 7819 root 1u CHR 136,0 0t0 3 /0 lsof 7819 root 2u CHR 136,0 0t0 3 /0 lsof 7819 root 3r DIR 0,34 0 1 /proc lsof 7819 root 4r DIR 0,34 0 770582 /proc/7819/fd lsof 7819 root 5w FIFO 0,9 0t0 770586 pipe lsof 7819 root 6r FIFO 0,9 0t0 770587 pipe lsof 7820 root cwd DIR 0,31 4096 31256 /root lsof 7820 root rtd DIR 0,31 4096 29395 / lsof 7820 root txt REG 179,1 171304 7235192 /usr/bin/lsof lsof 7820 root mem REG 179,1 139560 1197214 /lib/aarch64-linux-gnu/libpthread-2.23.so lsof 7820 root mem REG 179,1 10400 1197201 /lib/aarch64-linux-gnu/libdl-2.23.so lsof 7820 root mem REG 179,1 395104 6292022 /lib/aarch64-linux-gnu/libpcre.so.3.13.2 lsof 7820 root mem REG 179,1 1261896 1197197 /lib/aarch64-linux-gnu/libc-2.23.so lsof 7820 root mem REG 179,1 109656 6292035 /lib/aarch64-linux-gnu/libselinux.so.1 lsof 7820 root mem REG 179,1 125776 1197193 /lib/aarch64-linux-gnu/ld-2.23.so lsof 7820 root 4r FIFO 0,9 0t0 770586 pipe lsof 7820 root 7w FIFO 0,9 0t0 770587 pipe roskinetic:~$ ffmpeg -f v4l2 -video_size 720x480 -i /dev/video2 -q:v 16 -r:v 5 -y test.mjpg ffmpeg version 2.8.17-0ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 5.4.0 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.12) 20160609 configuration: --prefix=/usr --extra-version=0ubuntu0.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 [video4linux2,v4l2 @ 0x47df00] Cannot open video device /dev/video2: Device or resource busy /dev/video2: Device or resource busy roskinetic:~$
Essentially, information inside the container mirrors what I see in Yocto. OpenCV also cannot open the camera. Keep in mind that I can open another (cheaper) USB camera just fine.
Anyone have ideas on why this might be failing?
My application/implementation
I have software set up to analyze the images. This is written in Python, and it is set up to use OpenCV to open
/dev/video2
. It worked decently with the previous camera, but I needed a higher quality camera with a better FoV. This camera works great when I test the software on my laptop, but there is some issue with it on the VOXL.Here is uname from my laptop, if anyone is curious:
Linux forcyte-xenon 5.15.0-71-generic #78~20.04.1-Ubuntu SMP Wed Apr 19 11:26:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
I've spent most of today trying to figure this out, I've found some resources online but none of them have really helped. If anyone has ideas on this, it would be greatly appreciated.
-
@dbrophy What output do you get if you run this script: https://gitlab.com/voxl-public/voxl-sdk/services/voxl-uvc-server/-/blob/master/scripts/show-video-device-info.sh?
-
Thanks. Here's the output of your command (I ran it both inside and outside container):
voxl:~$ ./show-video-device-info.sh /dev/video2: USB 2.0 Camera 0c45:6369 voxl:~$ docker attach ff roskinetic:~$ cd yoctohome/ roskinetic:yoctohome$ ./show-video-device-info.sh /dev/video2: USB 2.0 Camera 0c45:6369
-
@dbrophy Have you tried using it outside of the Docker? Perhaps with
voxl-uvc-server
? -
@Eric-Katzfey Yes, I've tried both inside and outside Docker. The command outputs are detailed in my original post, except for voxl-uvc-server. I tried that too, but I forget what went wrong, I will try again and put the output in the next paragraph of this post.
The terminal output of
voxl-uvc-server -l
is extremely long (hundreds if not a few thousand lines). I have cut most of it out, as the same lines repeated over and over:voxl:~$ voxl-uvc-server -l loading config file *** START DEVICE LIST *** Found device 0 Got device descriptor for 0c45:6369 (null) Found device 0c45:6369 uvc_open failed, Return code: No such device (-4) Found device 0 Got device descriptor for 0c45:6369 (null) uvc_find_device failed, Return code: No such device (-4) Found device 0 [... snipped repeating text ...] Got device descriptor for 0c45:6369 (null) uvc_find_device failed, Return code: No such device (-4) Found device 0 Got device descriptor for 0c45:6369 (null) uvc_find_device failed, Return code: No such device (-4) Found device 0 Got device descriptor for 0c45:6369 (null) uvc_find_device failed, Return code: No such device (-4) Found device 0 Got device descriptor for 0c45:6369 (null) uvc_find_device failed, Return code: No such device (-4) Found device 0 Got device descriptor for 0c45:6369 (null) Found device 0c45:6369 DEVICE CONFIGURATION (0c45:6369/[none]) --- Status: idle VideoControl: bcdUVC: 0x0100 VideoStreaming(1): bEndpointAddress: 129 Formats: MJPEGFormat(1) bits per pixel: 0 GUID: 4d4a5047000000000000000000000000 (MJPG) default frame: 1 aspect ratio: 0x0 interlace flags: 00 copy protect: 00 FrameDescriptor(1) capabilities: 00 size: 1920x1080 bit rate: 995469360-995469360 max frame size: 4147789 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(2) capabilities: 00 size: 640x480 bit rate: 147597360-147597360 max frame size: 614989 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(3) capabilities: 00 size: 1280x720 bit rate: 442509360-442509360 max frame size: 1843789 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(4) capabilities: 00 size: 640x360 bit rate: 110733360-110733360 max frame size: 461389 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(5) capabilities: 00 size: 320x240 bit rate: 37005360-37005360 max frame size: 154189 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(6) capabilities: 00 size: 800x600 bit rate: 230541360-230541360 max frame size: 960589 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(7) capabilities: 00 size: 960x720 bit rate: 331917360-331917360 max frame size: 1382989 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(8) capabilities: 00 size: 352x288 bit rate: 48801840-48801840 max frame size: 203341 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(9) capabilities: 00 size: 432x240 bit rate: 49907760-49907760 max frame size: 207949 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(10) capabilities: 00 size: 320x184 bit rate: 28403760-28403760 max frame size: 118349 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(11) capabilities: 00 size: 176x144 bit rate: 12306480-12306480 max frame size: 51277 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(12) capabilities: 00 size: 1280x960 bit rate: 589965360-589965360 max frame size: 2458189 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(13) capabilities: 00 size: 1280x1024 bit rate: 629286960-629286960 max frame size: 2622029 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(14) capabilities: 00 size: 1024x768 bit rate: 377628720-377628720 max frame size: 1573453 default interval: 1/30 interval[0]: 1/30 UncompressedFormat(2) bits per pixel: 16 GUID: 5955593200001000800000aa00389b71 (YUY2) default frame: 1 aspect ratio: 0x0 interlace flags: 00 copy protect: 00 FrameDescriptor(1) capabilities: 00 size: 1920x1080 bit rate: 165888000-165888000 max frame size: 4147200 default interval: 1/5 interval[0]: 1/5 FrameDescriptor(2) capabilities: 00 size: 640x480 bit rate: 147456000-147456000 max frame size: 614400 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(3) capabilities: 00 size: 1280x720 bit rate: 147456000-147456000 max frame size: 1843200 default interval: 1/10 interval[0]: 1/10 FrameDescriptor(4) capabilities: 00 size: 432x240 bit rate: 49766400-49766400 max frame size: 207360 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(5) capabilities: 00 size: 1024x768 bit rate: 125829120-125829120 max frame size: 1572864 default interval: 1/10 interval[0]: 1/10 FrameDescriptor(6) capabilities: 00 size: 352x288 bit rate: 48660480-48660480 max frame size: 202752 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(7) capabilities: 00 size: 320x240 bit rate: 36864000-36864000 max frame size: 153600 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(8) capabilities: 00 size: 176x144 bit rate: 12165120-12165120 max frame size: 50688 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(9) capabilities: 00 size: 160x120 bit rate: 9216000-9216000 max frame size: 38400 default interval: 1/30 interval[0]: 1/30 FrameDescriptor(10) capabilities: 00 size: 800x600 bit rate: 153600000-153600000 max frame size: 960000 default interval: 1/20 interval[0]: 1/20 FrameDescriptor(11) capabilities: 00 size: 1280x720 bit rate: 73728000-147456000 max frame size: 1843200 default interval: 1/10 interval[0]: 1/10 interval[1]: 1/5 FrameDescriptor(12) capabilities: 00 size: 960x720 bit rate: 165888000-165888000 max frame size: 1382400 default interval: 1/15 interval[0]: 1/15 FrameDescriptor(13) capabilities: 00 size: 1280x960 bit rate: 98304000-98304000 max frame size: 2457600 default interval: 1/5 interval[0]: 1/5 FrameDescriptor(14) capabilities: 00 size: 1280x1024 bit rate: 104857600-104857600 max frame size: 2621440 default interval: 1/5 interval[0]: 1/5 END DEVICE CONFIGURATION *** END DEVICE LIST *** voxl:~$
Here I try to open the camera with voxl-uvc-server:
voxl:~$ voxl-uvc-server -v 0c45 -d loading config file Enabling debug messages ================================================================= width: 640 height: 480 fps: 30 pipe_name: uvc ================================================================= voxl-uvc-server starting Image resolution 640x480, 30 fps chosen Vendor ID 0x0c45 chosen UVC initialized Device 0c45:0000 found uvc_open failed UVC exited voxl-uvc-server ending voxl:~$
I've also tried the camera on BeagleBone black, it works fine out-of-the-box. It seems this is just a problem with VOXL. My hypothesis is that the kernel on the Yocto side is too far out of date, or at least that updating it would fix it. See my original post for the output of
uname -a
. Do you think this my be correct? -
@dbrophy It's hard to say. Most cameras I have tried on VOXL with UVC didn't immediately work. I had to debug and make some tweaks to get it to work. That's why we list the specific cameras we have tested with in our voxl-uvc-server documentation.
-
Yes, I saw one camera you mentioned on there, but the SKU was wrong, so it is impossible for me to know which camera you are referring to. To quote the documentation:
You can find the Arducam Specs and Selection guide by going here.
The Arducam B0229 is an excellent choice.The B0229 is not an Arducam camera. It is a camera cable for Raspberry Pi. I would use some webcam listed on your UVC page, but I need a wide viewing angle and preferably IR support. Refresh rates less than 24Hz aren't really acceptable. They just don't really fit the bill.
Maybe you know of a camera that would work? I'd prefer to get what I bought working, but I can get something different if necessary.