From 20ed6a8b585a92e8a0e7d8333e81b6e8ca7044e1 Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Fri, 24 Feb 2023 17:47:58 +0100 Subject: [PATCH] chore: add error message if v4l2-ctl errors out Signed-off-by: Stephan Wendel --- libs/v4l2_control.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/v4l2_control.sh b/libs/v4l2_control.sh index ab09d1b9..b5e9cd87 100755 --- a/libs/v4l2_control.sh +++ b/libs/v4l2_control.sh @@ -44,10 +44,11 @@ function v4l2_control { valueless="$(echo "${param}" | cut -d "=" -f1)" opt_avail="$(v4l2-ctl -d "${device}" -L | \ grep -c "${valueless}" || true)" - if [ "${opt_avail}" -eq "0" ]; then - log_msg "Parameter '${param}' not available for '${device}'. Skipped." + if [[ "${opt_avail}" -eq "0" ]]; then + v4c_log_msg "Parameter '${param}' not available for '${device}'. Skipped." else - v4l2-ctl -d "${device}" -c "${param}" 2> /dev/null + v4l2-ctl -d "${device}" -c "${param}" 2> /dev/null || + v4c_log_msg "Failed to set parameter: '${param}' ..." fi done if [[ "${CROWSNEST_LOG_LEVEL}" == "debug" ]]; then