From 4d3e65a7ee8ebf036bf48071a138a039cf697886 Mon Sep 17 00:00:00 2001 From: Stephan Wendel <43513802+KwadFan@users.noreply.github.com> Date: Sat, 13 Jan 2024 18:13:35 +0100 Subject: [PATCH] feat: add dual picam detection (#229) Signed-off-by: Stephan Wendel --- libs/hwhandler.sh | 2 +- libs/logging.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/hwhandler.sh b/libs/hwhandler.sh index 2e1fd075..ceb5bd72 100755 --- a/libs/hwhandler.sh +++ b/libs/hwhandler.sh @@ -65,7 +65,7 @@ detect_libcamera() { [[ -x "$(command -v libcamera-hello)" ]]; then avail="$(libcamera-hello --list-cameras | sed '/^\[.*\].*/d' | awk 'NR==1 {print $1}')" if [[ "${avail}" = "Available" ]]; then - echo "1" + get_libcamera_path | wc -l else echo "0" fi diff --git a/libs/logging.sh b/libs/logging.sh index 167ee392..f23be28b 100755 --- a/libs/logging.sh +++ b/libs/logging.sh @@ -88,7 +88,7 @@ function print_cfg { } function print_cams { - local total v4l + local device total v4l v4l="$(find /dev/v4l/by-id/ -iname "*index0" 2> /dev/null | wc -l)" libcamera="$(detect_libcamera)" legacy="$(detect_legacy)" @@ -100,7 +100,9 @@ function print_cams { log_msg "INFO: Found ${total} total available Device(s)" fi if [[ "${libcamera}" -ne 0 ]]; then - log_msg "Detected 'libcamera' device -> $(get_libcamera_path)" + for device in $(get_libcamera_path); do + log_msg "Detected 'libcamera' device -> ${device}" + done fi if [[ "${legacy}" -ne 0 ]]; then raspicam="$(v4l2-ctl --list-devices | grep -A1 -e 'mmal' | \