From 5fa8d1ec7dd28f25fc9976ad056a7a8ba7081df0 Mon Sep 17 00:00:00 2001 From: Patrick Gehrsitz Date: Fri, 26 Apr 2024 23:38:37 +0200 Subject: [PATCH] fix: fix libcamera resolution and controls logging (#260) Signed-off-by: Patrick Gehrsitz --- libs/hwhandler.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/hwhandler.sh b/libs/hwhandler.sh index 32ad9448..f19cfb82 100755 --- a/libs/hwhandler.sh +++ b/libs/hwhandler.sh @@ -87,7 +87,7 @@ list_picam_resolution() { local prefix prefix="$(date +'[%D %T]') crowsnest:" log_msg "'libcamera' device(s) resolution(s) :" - while read -r i; do + while IFS= read -r i; do printf "%s\t\t%s\n" "${prefix}" "${i}" >> "${CROWSNEST_LOG_PATH}" done < <(libcamera-hello --list-cameras | sed '1,2d;s/Modes:/Colorspace:/') } @@ -101,8 +101,8 @@ get_libcamera_controls() { sed 's/device//g;/^SNAPSHOT/q' | sed '/^SNAPSHOT/d' | \ sed '/^CAMERA/d;/- property/d' | sed '/camera-streamer Version:/d' | \ sed 's/- available option: //g' | sed '/^$/d;' | \ - sed 's/([0-9]*[a-z,0-9]\,//g' | sed '/type=7/d;/type=4/d' | \ - sed 's/type=1/ (bool/g;s/type=3/ (int/g;s/type=5/ (float/g' | \ + sed 's/([0-9]*[a-z,0-9]\, /(/g' | sed '/type=7/d;/type=4/d;/type=Rectangle/d' | \ + sed 's/type=1/bool/g;s/type=3/int/g;s/type=5/float/g' | sed 's/type=//g;' | \ sed 's/\[/min=/g;s/\.\./ max=/g;s/\]$//g' else log_msg "WARN: 'libcamera' device option can not be displayed, because" @@ -114,7 +114,7 @@ list_picam_controls() { local prefix prefix="$(date +'[%D %T]') crowsnest:" log_msg "'libcamera' device controls :" - while read -r i; do + while IFS= read -r i; do if [[ ! "${i}" =~ "INFO" ]]; then printf "%s\t\t%s\n" "${prefix}" "${i}" >>"${CROWSNEST_LOG_PATH}" fi