diff --git a/libs/hwhandler.sh b/libs/hwhandler.sh index 3f5f3b51..971afe5d 100755 --- a/libs/hwhandler.sh +++ b/libs/hwhandler.sh @@ -21,8 +21,7 @@ detect_avail_cams() { local avail realpath avail="$(find /dev/v4l/by-id/ -iname "*index0" 2>/dev/null)" count="$(echo "${avail}" | wc -l)" - if [[ -d "/dev/v4l/by-id/" ]] && - [[ -n "${avail}" ]]; then + if [[ -d "/dev/v4l/by-id/" ]] && [[ -n "${avail}" ]]; then log_msg "INFO: Found ${count} available v4l2 (UVC) camera(s)" echo "${avail}" | while read -r v4l; do realpath=$(readlink -e "${v4l}") @@ -77,7 +76,7 @@ detect_libcamera() { ## Spit /base/soc path for libcamera device get_libcamera_path() { if [[ "$(is_raspberry_pi)" = "1" ]] && - [[ -x "$(command -v libcamera-hello)" ]]; then + [[ -x "$(command -v libcamera-hello)" ]]; then libcamera-hello --list-cameras | sed '1,2d' \ | grep "\(/base/*\)" | cut -d"(" -f2 | tr -d '$)' fi @@ -131,19 +130,15 @@ function detect_legacy { if [[ "$(is_raspberry_pi)" = "1" ]] && command -v vcgencmd &>/dev/null; then if vcgencmd get_camera &>/dev/null; then - avail="$( - vcgencmd get_camera \ - | awk -F '=' '{ print $3 }' \ - | cut -d',' -f1 - )" + avail="$( vcgencmd get_camera | awk -F '=' '{ print $3 }' | cut -d',' -f1)" fi fi echo "${avail:-0}" } function dev_is_legacy { - v4l2-ctl --list-devices | grep -A1 -e 'mmal' \ - | awk 'NR==2 {print $1}' + v4l2-ctl --list-devices | grep -A1 -e 'mmal' | \ + awk 'NR==2 {print $1}' } ## Determine if cam has H.264 Hardware encoder diff --git a/libs/logging.sh b/libs/logging.sh index 0bc48caa..bb40a8e8 100755 --- a/libs/logging.sh +++ b/libs/logging.sh @@ -80,16 +80,16 @@ function print_cfg { local prefix prefix="$(date +'[%D %T]') crowsnest:" log_msg "INFO: Print Configfile: '${CROWSNEST_CFG}'" - (sed '/^#.*/d;/./,$!d' | cut -d'#' -f1) <"${CROWSNEST_CFG}" | + (sed '/^#.*/d;/./,$!d' | cut -d'#' -f1) < "${CROWSNEST_CFG}" | \ while read -r line; do - printf "%s\t\t%s\n" "${prefix}" "${line}" >>"${CROWSNEST_LOG_PATH}" + printf "%s\t\t%s\n" "${prefix}" "${line}" >> "${CROWSNEST_LOG_PATH}" printf "\t\t%s\n" "${line}" done } function print_cams { local device total v4l - v4l="$(find /dev/v4l/by-id/ -iname "*index0" 2>/dev/null | wc -l)" + v4l="$(find /dev/v4l/by-id/ -iname "*index0" 2> /dev/null | wc -l)" libcamera="$(detect_libcamera)" legacy="$(detect_legacy)" total="$((v4l+libcamera+legacy))" @@ -114,8 +114,8 @@ function print_cams { fi fi if [[ "${legacy}" -ne 0 ]]; then - raspicam="$(v4l2-ctl --list-devices | grep -A1 -e 'mmal' \ - | awk 'NR==2 {print $1}')" + raspicam="$(v4l2-ctl --list-devices | grep -A1 -e 'mmal' | \ + awk 'NR==2 {print $1}')" log_msg "Detected 'Raspicam' Device -> ${raspicam}" if [[ ! "${CROWSNEST_LOG_LEVEL}" = "quiet" ]]; then list_cam_formats "${raspicam}" @@ -139,8 +139,8 @@ function print_host { ## OS Infos ## OS Version if [[ -f /etc/os-release ]]; then - log_msg "Host Info: Distribution: $(grep "PRETTY" /etc/os-release \ - | cut -d '=' -f2 | sed 's/^"//;s/"$//')" + log_msg "Host Info: Distribution: $(grep "PRETTY" /etc/os-release | \ + cut -d '=' -f2 | sed 's/^"//;s/"$//')" fi ## Release Version of MainsailOS (if file present) if [[ -f /etc/mainsailos-release ]]; then