Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add pi5 support #225

Merged
merged 7 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ See the [README.md](https://github.com/mainsail-crew/crowsnest/tree/legacy/v3) o

#### Hint Bookworm

Raspberry Pi OS images that are based on Debian 12 (codename 'bookworm') currently use a different branch of [camera-streamer](https://github.com/ayufan/camera-streamer)!
Raspberry Pi OS images that are based on Debian 12 (codename 'bookworm') currently use a different branch of [camera-streamer](https://github.com/ayufan/camera-streamer)! The Pi 5 has only [ustreamer](https://github.com/pikvm/ustreamer) support!
mryel00 marked this conversation as resolved.
Show resolved Hide resolved

---

Expand Down
23 changes: 22 additions & 1 deletion bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,24 @@ is_bookworm() {
fi
}

is_pi5() {
if [[ -f /proc/device-tree/model ]] &&
grep -q "Raspberry Pi 5" /proc/device-tree/model; then
echo "1"
else
echo "0"
fi
}

is_ubuntu_arm() {
if [[ "$(is_raspberry_pi)" = "1" ]] &&
grep -q "ubuntu" /etc/os-release; then
echo "1"
else
echo "0"
fi
}

### Get avail mem
get_avail_mem() {
grep "MemTotal" /proc/meminfo | awk '{print $2}'
Expand Down Expand Up @@ -114,7 +132,10 @@ clone_ustreamer() {
clone_cstreamer() {
## Special handling because only supported on Raspberry Pi
[[ -n "${CROWSNEST_UNATTENDED}" ]] || CROWSNEST_UNATTENDED="0"
if [[ "$(is_raspberry_pi)" = "0" ]] && [[ "${CROWSNEST_UNATTENDED}" = "0" ]]; then
if { [[ "$(is_raspberry_pi)" = "0" ]] ||
[[ "$(is_pi5)" = "1" ]] ||
[[ "$(is_ubuntu_arm)" = "1" ]]; } &&
[[ "${CROWSNEST_UNATTENDED}" = "0" ]]; then
printf "WARN: Cloning camera-streamer skipped! Device is not supported!"
return
fi
Expand Down
4 changes: 3 additions & 1 deletion libs/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ function check_apps {
fi

## Avoid dependency check if non rpi sbc
if [[ "$(is_raspberry_pi)" = "1" ]] && [[ "$(is_ubuntu_arm)" = "0" ]]; then
if [[ "$(is_raspberry_pi)" = "1" ]] &&
[[ "$(is_ubuntu_arm)" = "0" ]] &&
[[ "$(is_pi5)" = "0" ]]; then
if [[ -x "${BASE_CN_PATH}/${cstreamer}" ]]; then
log_msg "Dependency: '${cstreamer##*/}' found in ${cstreamer}."
else
Expand Down
9 changes: 9 additions & 0 deletions libs/hwhandler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ is_raspberry_pi() {
fi
}

is_pi5() {
if [[ -f /proc/device-tree/model ]] &&
grep -q "Raspberry Pi 5" /proc/device-tree/model; then
echo "1"
else
echo "0"
fi
}

is_ubuntu_arm() {
if [[ "$(is_raspberry_pi)" = "1" ]] &&
grep -q "ubuntu" /etc/os-release; then
Expand Down
4 changes: 3 additions & 1 deletion libs/init_stream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ function construct_streamer {
check_section "${cams}"
case ${mode} in
[mM]ulti | camera-streamer)
if [[ "$(is_raspberry_pi)" = "1" ]] && [[ "$(is_ubuntu_arm)" = "0" ]]; then
if [[ "$(is_raspberry_pi)" = "1" ]] &&
[[ "$(is_ubuntu_arm)" = "0" ]] &&
[[ "$(is_pi5)" = "0" ]]; then
MULTI_INSTANCES+=( "${cams}" )
else
log_msg "WARN: Mode 'camera-streamer' is not supported on your device!"
Expand Down
4 changes: 3 additions & 1 deletion libs/versioncontrol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ versioncontrol() {
# Camera Streamer has no version Output yet
get_ayucamstream_version() {
local cur_ver avail_ver
if [[ "$(is_raspberry_pi)" = "1" ]] && [[ "$(is_ubuntu_arm)" = "0" ]]; then
if [[ "$(is_raspberry_pi)" = "1" ]] &&
[[ "$(is_ubuntu_arm)" = "0" ]] &&
[[ "$(is_pi5)" = "0" ]]; then
pushd "${BASE_CN_PATH}"/bin/camera-streamer &> /dev/null || exit 1
avail_ver="($(git describe --tags --always))"
cur_ver="$("${PWD}"/camera-streamer --version | tr -d " ")"
Expand Down
17 changes: 17 additions & 0 deletions tools/libs/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ is_raspberry_pi() {
fi
}

is_pi5() {
if [[ -f /proc/device-tree/model ]] &&
grep -q "Raspberry Pi 5" /proc/device-tree/model; then
echo "1"
else
echo "0"
fi
}

is_ubuntu_arm() {
if [[ "$(is_raspberry_pi)" = "1" ]] &&
grep -q "ubuntu" /etc/os-release; then
Expand Down Expand Up @@ -104,6 +113,14 @@ shallow_cs_dependencies_check() {
fi
status_msg "Checking if device is a Raspberry Pi ..." "0"

msg "Checking if device is not a Raspberry Pi 5 ...\n"
if [[ "$(is_pi5)" = "1" ]]; then
status_msg "Checking if device is not a Raspberry Pi 5 ..." "3"
msg "This device is a Raspberry Pi 5 therefore camera-streeamer cannot be installed ..."
return 1
fi
status_msg "Checking if device is not a Raspberry Pi 5 ..." "0"

msg "Checking if device is not running Ubuntu ...\n"
if [[ "$(is_ubuntu_arm)" = "1" ]]; then
status_msg "Checking if device is not running Ubuntu ..." "3"
Expand Down
Loading