Skip to content

Commit

Permalink
fix(hwhandler.sh): fix error in device logging (#169) (#170)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
mryel00 authored Sep 1, 2023
1 parent f6e2156 commit c9bc304
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions libs/hwhandler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ detect_libcamera() {
else
echo "0"
fi
fi
if [[ "$(is_raspberry_pi)" = "0" ]]; then
else
echo "0"
fi
}
Expand Down
8 changes: 5 additions & 3 deletions libs/logging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit c9bc304

Please sign in to comment.