fix: add pi5 support (#225)

Signed-off-by: Patrick Gehrsitz <mryel00.github@gmail.com>
This commit is contained in:
Patrick Gehrsitz 2024-01-07 17:57:56 +01:00 committed by GitHub
parent 0b4cf6f0a1
commit aa97f12a5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 58 additions and 4 deletions

View File

@ -90,6 +90,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)!
The Raspberry Pi 5 has only [ustreamer](https://github.com/pikvm/ustreamer) support! This is due to the missing JPEG and H264 Hardware encoders.
---

View File

@ -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}'
@ -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

View File

@ -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

View File

@ -131,6 +131,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

View File

@ -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!"

View File

@ -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 " ")"

View File

@ -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
@ -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"