From c9bc30414e10e0fadf20e379b614b28869783c22 Mon Sep 17 00:00:00 2001 From: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> Date: Fri, 1 Sep 2023 21:07:09 +0200 Subject: [PATCH 1/3] fix(hwhandler.sh): fix error in device logging (#169) (#170) * fix(hwhandler.sh): fix error in device logging If device is a Raspberry Pi and does not have libcamera-hello, it does not log devices Error occurs in Line 93 of logging.sh * fix: remove unnecessary double function calls --------- Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> --- libs/hwhandler.sh | 3 +-- libs/logging.sh | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/hwhandler.sh b/libs/hwhandler.sh index 16026d2..63b6710 100755 --- a/libs/hwhandler.sh +++ b/libs/hwhandler.sh @@ -69,8 +69,7 @@ detect_libcamera() { else echo "0" fi - fi - if [[ "$(is_raspberry_pi)" = "0" ]]; then + else echo "0" fi } diff --git a/libs/logging.sh b/libs/logging.sh index 828cd7c..167ee39 100755 --- a/libs/logging.sh +++ b/libs/logging.sh @@ -90,17 +90,19 @@ function print_cfg { function print_cams { local total v4l v4l="$(find /dev/v4l/by-id/ -iname "*index0" 2> /dev/null | wc -l)" - total="$((v4l+($(detect_libcamera))+($(detect_legacy))))" + libcamera="$(detect_libcamera)" + legacy="$(detect_legacy)" + total="$((v4l+libcamera+legacy))" if [ "${total}" -eq 0 ]; then log_msg "ERROR: No usable Devices Found. Stopping $(basename "${0}")." exit 1 else log_msg "INFO: Found ${total} total available Device(s)" fi - if [[ "$(detect_libcamera)" -ne 0 ]]; then + if [[ "${libcamera}" -ne 0 ]]; then log_msg "Detected 'libcamera' device -> $(get_libcamera_path)" fi - if [[ "$(detect_legacy)" -ne 0 ]]; then + if [[ "${legacy}" -ne 0 ]]; then raspicam="$(v4l2-ctl --list-devices | grep -A1 -e 'mmal' | \ awk 'NR==2 {print $1}')" log_msg "Detected 'Raspicam' Device -> ${raspicam}" From e9f36c9c2603931d1a35dcb33fb034543f1089a0 Mon Sep 17 00:00:00 2001 From: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:59:44 +0200 Subject: [PATCH 2/3] fix: fix wrong gpumem calculation (#176) Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> --- tools/libs/set_gpumem.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/libs/set_gpumem.sh b/tools/libs/set_gpumem.sh index e732db1..aec7433 100755 --- a/tools/libs/set_gpumem.sh +++ b/tools/libs/set_gpumem.sh @@ -29,11 +29,9 @@ set_gpu_mem() { ## Determine Ramsize and export MAKEFLAG if [[ "$(get_avail_mem)" -le 524288 ]]; then mem_split=128 - fi - if [[ "$(get_avail_mem)" -le 1048576 ]]; then + elif [[ "$(get_avail_mem)" -le 1048576 ]]; then mem_split=160 - fi - if [[ "$(get_avail_mem)" -gt 1048576 ]]; then + else [[ "$(get_avail_mem)" -gt 1048576 ]]; then mem_split=256 fi if [[ "$(is_raspbian)" = "1" ]] && [[ -n "$(command -v raspi-config)" ]]; then From dacc0d9d3a97454101a4d553ac229731446666fe Mon Sep 17 00:00:00 2001 From: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> Date: Tue, 12 Sep 2023 20:23:19 +0200 Subject: [PATCH 3/3] fix: fix wrong syntax in gpumem (#177) Fix syntax error made in #176 Fixes #175 --- tools/libs/set_gpumem.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libs/set_gpumem.sh b/tools/libs/set_gpumem.sh index aec7433..ab183e0 100755 --- a/tools/libs/set_gpumem.sh +++ b/tools/libs/set_gpumem.sh @@ -31,7 +31,7 @@ set_gpu_mem() { mem_split=128 elif [[ "$(get_avail_mem)" -le 1048576 ]]; then mem_split=160 - else [[ "$(get_avail_mem)" -gt 1048576 ]]; then + else mem_split=256 fi if [[ "$(is_raspbian)" = "1" ]] && [[ -n "$(command -v raspi-config)" ]]; then