Libcamera-still --list-cameras command hangs indefinitely

  1. Where did you get the camera module(s)?
    https://www.amazon.com/gp/product/B09STL7S88/ref=ppx_yo_dt_b_asin_title_o00_s00

  2. Model number of the product(s).
    Arducam 16MP Autofocus Raspberry Pi Camera Module with ABS Case, IMX519

  3. What hardware/platform were you working on?
    Raspberry Pi 4B, Raspberry Pi OS Bullseye Lite with XFCE for desktop

  4. Instructions you have followed. (link/manual/etc.)
    Playing with code found on ArduCAM/Arducam-Pivariety-V4L2-Driver github repo, in the focus folder, as well as libcamera-vid commands called from subshells in python.

  5. Problems you were having.
    I am using libcamera-still --list-cameras in a POST (power on self test) to ensure that on startup we can always know whether the cameras are still being detected or not through the software. The issue is - this command is unreliable, it mostly works fine and returns “no cameras” or it lists the camera I have plugged in. But sometimes it just hangs indefinitely and only outputs:

Available cameras
-----------------

I should add, this makes no sense because I know for a fact that the camera is there and working. I can start and stop it successfully using for example:

[email protected]:~/ $ DISPLAY=:0 libcamera-vid -t 0 --segment 1 --codec mjpeg -o /run/shm/test%06d.jpg --width 640 --height 480
WARNING: consider inline headers with 'pause'/split/segment/circular
Made X/EGL preview window
[1:07:46.588548508] [46033]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3729-5f595cca
[1:07:46.591558761] [46039] ERROR V4L2 v4l2_device.cpp:349 'imx519 10-001a': Unable to set controls: Device or resource busy
[1:07:46.592515370] [46039]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'imx519'
[1:07:46.592572981] [46039]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[1:07:46.611757275] [46039]  WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[1:07:46.612365255] [46039] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[1:07:46.612554643] [46039]  INFO RPI raspberrypi.cpp:1398 Registered camera /base/soc/i2c0mux/[email protected]/[email protected] to Unicam device /dev/media3 and ISP device /dev/media0

Which shows me the camera stream window just fine, despite the many errors in the output (the last line seems to be most pertinent that it registers /dev/media3 and /dev/media0

  1. The dmesg log from your hardware.
[email protected]:~/ $ dmesg | grep -E 'vc4|bcm|imx'
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1  smsc95xx.macaddr=E4:5F:01:9E:DC:9F vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  console=ttyAMA0,115200 console=tty3 root=PARTUUID=a4f6aa6f-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait logo.nologo consoleblank=0 loglevel=3 quiet plymouth.enable=0 plymouth.ignore-serial-consoles plymouth.enable=0 splash
[    0.088886] bcm2835-mbox fe00b880.mailbox: mailbox enabled
[    0.171938] bcm2835-dma fe007000.dma: DMA legacy API manager, dmachans=0x1
[    1.222754] gpiomem-bcm2835 fe200000.gpiomem: Initialised: Registers at 0xfe200000
[    1.251139] bcmgenet fd580000.ethernet: GENET 5.0 EPHY: 0x0000
[    1.413181] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    1.413645] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[    1.414831] mmc-bcm2835 fe300000.mmcnr: mmc_debug:0 mmc_debug2:0
[    1.414850] mmc-bcm2835 fe300000.mmcnr: DMA channel allocated
[    4.610194] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[    5.062200] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    5.069821] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    5.152315] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[    5.178832] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[    5.197057] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[    5.206193] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[    5.206783] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[    5.207292] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[    5.207720] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[    5.207759] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    5.207782] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    5.207800] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    5.207817] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    5.215570] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video20
[    5.216237] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video21
[    5.216776] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video22
[    5.217196] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video23
[    5.217236] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    5.217258] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    5.217277] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    5.217293] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    5.217518] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[    5.241961] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[    5.242025] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[    5.263812] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[    5.263872] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[    5.276755] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[    5.276827] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[    5.286479] bcm2835-codec bcm2835-codec: Device registered as /dev/video18
[    5.286568] bcm2835-codec bcm2835-codec: Loaded V4L2 image_fx
[    5.294736] bcm2835-codec bcm2835-codec: Device registered as /dev/video31
[    5.294815] bcm2835-codec bcm2835-codec: Loaded V4L2 encode_image
[    6.722617] bcmgenet fd580000.ethernet: configuring instance for external RGMII (RX delay)
[    6.725460] bcmgenet fd580000.ethernet eth0: Link is Down
[    7.228329] imx519: loading out-of-tree module taints kernel.
[    7.254722] imx519 10-001a: Device found is imx519
[    7.257283] imx519 10-001a: Consider updating driver imx519 to match on endpoints
[    7.311769] vc4-drm gpu: bound fe400000.hvs (ops vc4_hvs_ops [vc4])
[    7.324123] rc rc0: vc4 as /devices/platform/soc/fef00700.hdmi/rc/rc0
[    7.324216] input: vc4 as /devices/platform/soc/fef00700.hdmi/rc/rc0/input0
[    7.324567] vc4_hdmi fef00700.hdmi: 'dmas' DT property is missing or empty, no HDMI audio
[    7.324616] vc4-drm gpu: bound fef00700.hdmi (ops vc4_hdmi_ops [vc4])
[    7.332283] rc rc1: vc4 as /devices/platform/soc/fef05700.hdmi/rc/rc1
[    7.332365] input: vc4 as /devices/platform/soc/fef05700.hdmi/rc/rc1/input1
[    7.334826] vc4_hdmi fef05700.hdmi: 'dmas' DT property is missing or empty, no HDMI audio
[    7.334870] vc4-drm gpu: bound fef05700.hdmi (ops vc4_hdmi_ops [vc4])
[    7.335500] vc4-drm gpu: bound fe700000.dsi (ops vc4_dsi_ops [vc4])
[    7.335903] vc4-drm gpu: bound fe004000.txp (ops vc4_txp_ops [vc4])
[    7.336081] vc4-drm gpu: bound fe206000.pixelvalve (ops vc4_crtc_ops [vc4])
[    7.336205] vc4-drm gpu: bound fe207000.pixelvalve (ops vc4_crtc_ops [vc4])
[    7.336326] vc4-drm gpu: bound fe20a000.pixelvalve (ops vc4_crtc_ops [vc4])
[    7.336421] vc4-drm gpu: bound fe216000.pixelvalve (ops vc4_crtc_ops [vc4])
[    7.336552] vc4-drm gpu: bound fec12000.pixelvalve (ops vc4_crtc_ops [vc4])
[    7.349761] [drm] Initialized vc4 0.0.0 20140616 for gpu on minor 1
[    7.871876] vc4-drm gpu: [drm] fb0: vc4drmfb frame buffer device
[  395.848468] imx519 10-001a: Failed to write reg 0x561f. error = -5
[  395.848477] imx519 10-001a: imx519_start_streaming failed to set common settings
[  706.851425] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[  713.027467] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[  717.415451] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[  728.135509] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[  730.179482] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
  1. Troubleshooting attempts you’ve made
    I’m going to work around this by wrapping my unit test function with a timeout decorator. For the sake of digging deeper and finding the actual underlying issue - I don’t know where to start (so I am posting here now for help).

  2. What help do you need?
    Reassurance that this is not normal behavior? Anyone else getting this issue? If yes, what causes it? Is it not perhaps the responsibility of the tool itself to implement a timeout if this a known problem for more than just one user? Maybe something from my dmesg logs will help indicate why this is happening? What value for the timeout is reasonable, 1s, 5s?

Hi,
It seems to be caused by the hardware. Hence, if you have faced the similar error, plz contact [email protected]