Skip to content

Commit

Permalink
fix: fixes error in detect_legacy (#217)
Browse files Browse the repository at this point in the history
This will fix issue on Raspberry Pi5, which doesnt generate cam list,
because 'vcgencmd get_camera' exits with an error.

If all conditions fail it will always return '0'

Signed-off-by: Stephan Wendel <[email protected]>
  • Loading branch information
KwadFan authored Dec 14, 2023
1 parent 43a1ee3 commit 61421f5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions libs/hwhandler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,16 @@ get_libcamera_path() {
# Determine connected "legacy" device
function detect_legacy {
local avail
if [[ -f /proc/device-tree/model ]] &&
grep -q "Raspberry" /proc/device-tree/model; then
avail="$(vcgencmd get_camera | awk -F '=' '{ print $3 }' | cut -d',' -f1)"
else
avail="0"
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 \
)"
fi
fi
echo "${avail}"
echo "${avail:-0}"
}

function dev_is_legacy {
Expand Down

0 comments on commit 61421f5

Please sign in to comment.