From 2a4fbd9c77459c408c0ce2fe0eb06a3c11058779 Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Sat, 15 Apr 2023 14:20:28 +0200 Subject: [PATCH] fix: fix raspicam detection if `start_x=1` is not set, it messes up output of `vcgencmd get_camera`. Which leads to not detected libcamera csi cams, even if they are detected correctly Therefor using libcamera-hello to determine if available Signed-off-by: Stephan Wendel --- libs/hwhandler.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/hwhandler.sh b/libs/hwhandler.sh index 7d74a6b..17a0850 100755 --- a/libs/hwhandler.sh +++ b/libs/hwhandler.sh @@ -60,9 +60,9 @@ list_cam_v4l2ctrls() { ## Determine connected libcamera (CSI) device detect_libcamera() { - local avail - if [[ "$(is_raspberry_pi)" = "1" ]]; then - vcgencmd get_camera | grep -c "libcamera interfaces=1" || true + if [[ "$(is_raspberry_pi)" = "1" ]] && + [[ -x "$(command -v libcamera-hello)" ]]; then + libcamera-hello --list-cameras | awk 'NR==1 {print $1}' | grep -c "Available" fi }