Skip to content

Commit e38a5e8

Browse files
authored
Merge branch 'develop' into pynest
2 parents 9d28aa0 + 07aaf8c commit e38a5e8

15 files changed

+179
-43
lines changed

CHANGELOG.md

+56
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,62 @@
22
# Changelog
33
All notable changes to Crowsnest will be documented in this file.
44

5+
## [4.1.12](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.12) - 2025-02-27
6+
### Bug Fixes and Improvements
7+
8+
- Fix ustreamer dependencies ([#294](https://github.com/mainsail-crew/crowsnest/pull/294))
9+
10+
## [4.1.11](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.11) - 2025-02-19
11+
### Bug Fixes and Improvements
12+
13+
- Cs cannot be built on Armbian, so let's not depend on it ([#288](https://github.com/mainsail-crew/crowsnest/pull/288))
14+
15+
### Documentation
16+
17+
- Improve grammar and style, including capitalization and phrasing ([#285](https://github.com/mainsail-crew/crowsnest/pull/285))
18+
19+
### Other
20+
21+
- Update ustreamer to v6.31 ([#292](https://github.com/mainsail-crew/crowsnest/pull/292))
22+
23+
## [4.1.10](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.10) - 2024-12-07
24+
### Bug Fixes and Improvements
25+
26+
- Change cs branch temporarily to fix compiling error ([#280](https://github.com/mainsail-crew/crowsnest/pull/280))
27+
28+
## [4.1.9](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.9) - 2024-04-26
29+
### Bug Fixes and Improvements
30+
31+
- Fix libcamera resolution and controls logging ([#260](https://github.com/mainsail-crew/crowsnest/pull/260))
32+
33+
## [4.1.8](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.8) - 2024-04-02
34+
### Bug Fixes and Improvements
35+
36+
- Fix crash of detect_libcamera without CSI cam ([#256](https://github.com/mainsail-crew/crowsnest/pull/256))
37+
38+
## [4.1.7](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.7) - 2024-04-02
39+
### Features
40+
41+
- Log libamera device resolutions and controls ([#240](https://github.com/mainsail-crew/crowsnest/pull/240))
42+
43+
### Bug Fixes and Improvements
44+
45+
- Fix empty string if ustreamer not found ([#253](https://github.com/mainsail-crew/crowsnest/pull/253))
46+
47+
### Other
48+
49+
- Revert #249 and update ustreamer version to v6.9 ([#254](https://github.com/mainsail-crew/crowsnest/pull/254))
50+
51+
## [4.1.6](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.6) - 2024-03-03
52+
### Bug Fixes and Improvements
53+
54+
- Change ustreamer repo to own fork as workaround for #247 ([#249](https://github.com/mainsail-crew/crowsnest/pull/249))
55+
56+
## [4.1.5](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.5) - 2024-02-28
57+
### Bug Fixes and Improvements
58+
59+
- Fix ustreamer binary path for v5.52 changes ([#245](https://github.com/mainsail-crew/crowsnest/pull/245))
60+
561
## [4.1.4](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.4) - 2024-02-17
662
### Bug Fixes and Improvements
763

bin/build.sh

+12-3
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ if [[ -z "${CROWSNEST_USTREAMER_REPO_SHIP}" ]]; then
3535
CROWSNEST_USTREAMER_REPO_SHIP="https://github.com/pikvm/ustreamer.git"
3636
fi
3737
if [[ -z "${CROWSNEST_USTREAMER_REPO_BRANCH}" ]]; then
38-
CROWSNEST_USTREAMER_REPO_BRANCH="master"
38+
CROWSNEST_USTREAMER_REPO_BRANCH="v6.31"
3939
fi
4040

4141
# Camera-streamer repo
4242
CSTREAMER_PATH="camera-streamer"
4343
if [[ -z "${CROWSNEST_CAMERA_STREAMER_REPO_SHIP}" ]]; then
44-
CROWSNEST_CAMERA_STREAMER_REPO_SHIP="https://github.com/ayufan/camera-streamer.git"
44+
CROWSNEST_CAMERA_STREAMER_REPO_SHIP="https://github.com/mryel00/camera-streamer.git"
4545
fi
4646
if [[ -z "${CROWSNEST_CAMERA_STREAMER_REPO_BRANCH}" ]]; then
4747
CROWSNEST_CAMERA_STREAMER_REPO_BRANCH="master"
@@ -99,6 +99,14 @@ is_ubuntu_arm() {
9999
fi
100100
}
101101

102+
is_armbian() {
103+
if grep -q "Armbian" /etc/os-release; then
104+
echo "1"
105+
else
106+
echo "0"
107+
fi
108+
}
109+
102110
### Get avail mem
103111
get_avail_mem() {
104112
grep "MemTotal" /proc/meminfo | awk '{print $2}'
@@ -136,7 +144,8 @@ clone_cstreamer() {
136144
[[ -n "${CROWSNEST_UNATTENDED}" ]] || CROWSNEST_UNATTENDED="0"
137145
if { [[ "$(is_raspberry_pi)" = "0" ]] ||
138146
[[ "$(is_pi5)" = "1" ]] ||
139-
[[ "$(is_ubuntu_arm)" = "1" ]]; } &&
147+
[[ "$(is_ubuntu_arm)" = "1" ]] ||
148+
[[ "$(is_armbian)" = "1" ]]; } &&
140149
[[ "${CROWSNEST_UNATTENDED}" = "0" ]]; then
141150
printf "Device is not supported! Cloning camera-streamer ... [SKIPPED]\n"
142151
return

custompios/crowsnest/config

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
[[ -n "$CROWSNEST_USTREAMER_REPO_BRANCH" ]] || CROWSNEST_USTREAMER_REPO_BRANCH="master"
2828

2929
# camera-streamer
30-
[[ -n "$CROWSNEST_CAMERA_STREAMER_REPO_SHIP" ]] || CROWSNEST_CAMERA_STREAMER_REPO_SHIP="https://github.com/ayufan/camera-streamer.git"
30+
[[ -n "$CROWSNEST_CAMERA_STREAMER_REPO_SHIP" ]] || CROWSNEST_CAMERA_STREAMER_REPO_SHIP="https://github.com/mryel00/camera-streamer.git"
3131
[[ -n "$CROWSNEST_CAMERA_STREAMER_REPO_BRANCH" ]] || CROWSNEST_CAMERA_STREAMER_REPO_BRANCH="master"
3232

3333
###########################################################################

libs/core.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,22 @@ function check_dep {
8282

8383
function check_apps {
8484
local cstreamer ustreamer
85-
ustreamer="bin/ustreamer/ustreamer"
85+
ustreamer="bin/ustreamer/src/ustreamer.bin"
8686
cstreamer="bin/camera-streamer/camera-streamer"
87-
8887
if [[ -x "${BASE_CN_PATH}/${ustreamer}" ]]; then
89-
log_msg "Dependency: '${ustreamer##*/}' found in ${ustreamer}."
88+
log_msg "Dependency: 'ustreamer' found in ${ustreamer}."
89+
UST_BIN="${BASE_CN_PATH}/${ustreamer}"
90+
# shellcheck disable=SC2034
91+
declare -r UST_BIN
9092
else
91-
log_msg "Dependency: '${ustreamer##*/}' not found. Exiting!"
93+
log_msg "Dependency: 'ustreamer' not found. Exiting!"
9294
exit 1
9395
fi
9496

9597
## Avoid dependency check if non rpi sbc
9698
if [[ "$(is_raspberry_pi)" = "1" ]] &&
9799
[[ "$(is_ubuntu_arm)" = "0" ]] &&
100+
[[ "$(is_armbian)" = "0" ]] &&
98101
[[ "$(is_pi5)" = "0" ]]; then
99102
if [[ -x "${BASE_CN_PATH}/${cstreamer}" ]]; then
100103
log_msg "Dependency: '${cstreamer##*/}' found in ${cstreamer}."

libs/hwhandler.sh

+55-10
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ detect_avail_cams() {
2121
local avail realpath
2222
avail="$(find /dev/v4l/by-id/ -iname "*index0" 2> /dev/null)"
2323
count="$(echo "${avail}" | wc -l)"
24-
if [[ -d "/dev/v4l/by-id/" ]] &&
25-
[[ -n "${avail}" ]]; then
24+
if [[ -d "/dev/v4l/by-id/" ]] && [[ -n "${avail}" ]]; then
2625
log_msg "INFO: Found ${count} available v4l2 (UVC) camera(s)"
2726
echo "${avail}" | while read -r v4l; do
2827
realpath=$(readlink -e "${v4l}")
@@ -63,8 +62,8 @@ detect_libcamera() {
6362
local avail
6463
if [[ "$(is_raspberry_pi)" = "1" ]] &&
6564
[[ -x "$(command -v libcamera-hello)" ]]; then
66-
avail="$(libcamera-hello --list-cameras | sed '/^\[.*\].*/d' | awk 'NR==1 {print $1}')"
67-
if [[ "${avail}" = "Available" ]]; then
65+
avail="$(libcamera-hello --list-cameras | grep -c "Available" || echo "0")"
66+
if [[ "${avail}" = "1" ]]; then
6867
get_libcamera_path | wc -l
6968
else
7069
echo "0"
@@ -83,23 +82,61 @@ get_libcamera_path() {
8382
fi
8483
}
8584

85+
# print libcamera resolutions
86+
list_picam_resolution() {
87+
local prefix
88+
prefix="$(date +'[%D %T]') crowsnest:"
89+
log_msg "'libcamera' device(s) resolution(s) :"
90+
while IFS= read -r i; do
91+
printf "%s\t\t%s\n" "${prefix}" "${i}" >> "${CROWSNEST_LOG_PATH}"
92+
done < <(libcamera-hello --list-cameras | sed '1,2d;s/Modes:/Colorspace:/')
93+
}
94+
95+
get_libcamera_controls() {
96+
local ust_bin flags
97+
flags=( --camera-type=libcamera --camera-list_options )
98+
ust_bin="${BASE_CN_PATH}/bin/camera-streamer/camera-streamer"
99+
if [[ -x "${ust_bin}" ]]; then
100+
"${ust_bin}" "${flags[@]}" --camera-path="$(get_libcamera_path)" 2> /dev/null | \
101+
sed 's/device//g;/^SNAPSHOT/q' | sed '/^SNAPSHOT/d' | \
102+
sed '/^CAMERA/d;/- property/d' | sed '/camera-streamer Version:/d' | \
103+
sed 's/- available option: //g' | sed '/^$/d;' | \
104+
sed 's/([0-9]*[a-z,0-9]\, /(/g' | sed '/type=7/d;/type=4/d;/type=Rectangle/d' | \
105+
sed 's/type=1/bool/g;s/type=3/int/g;s/type=5/float/g' | sed 's/type=//g;' | \
106+
sed 's/\[/min=/g;s/\.\./ max=/g;s/\]$//g'
107+
else
108+
log_msg "WARN: 'libcamera' device option can not be displayed, because"
109+
log_msg "WARN: camera-streamer is not installed"
110+
fi
111+
}
112+
113+
list_picam_controls() {
114+
local prefix
115+
prefix="$(date +'[%D %T]') crowsnest:"
116+
log_msg "'libcamera' device controls :"
117+
while IFS= read -r i; do
118+
if [[ ! "${i}" =~ "INFO" ]]; then
119+
printf "%s\t\t%s\n" "${prefix}" "${i}" >>"${CROWSNEST_LOG_PATH}"
120+
fi
121+
done < <(get_libcamera_controls)
122+
# blank line workaround
123+
log_msg ""
124+
}
125+
86126
# Determine connected "legacy" device
87127
function detect_legacy {
88128
local avail
89129
if [[ "$(is_raspberry_pi)" = "1" ]] &&
90130
command -v vcgencmd &> /dev/null; then
91-
if vcgencmd get_camera &> /dev/null ; then
92-
avail="$(vcgencmd get_camera \
93-
| awk -F '=' '{ print $3 }' \
94-
| cut -d',' -f1 \
95-
)"
131+
if vcgencmd get_camera &> /dev/null; then
132+
avail="$( vcgencmd get_camera | awk -F '=' '{ print $3 }' | cut -d',' -f1)"
96133
fi
97134
fi
98135
echo "${avail:-0}"
99136
}
100137

101138
function dev_is_legacy {
102-
v4l2-ctl --list-devices | grep -A1 -e 'mmal' | \
139+
v4l2-ctl --list-devices | grep -A1 -e 'mmal' | \
103140
awk 'NR==2 {print $1}'
104141
}
105142

@@ -148,3 +185,11 @@ is_ubuntu_arm() {
148185
echo "0"
149186
fi
150187
}
188+
189+
is_armbian() {
190+
if grep -q "Armbian" /etc/os-release; then
191+
echo "1"
192+
else
193+
echo "0"
194+
fi
195+
}

libs/init_stream.sh

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function construct_streamer {
2929
[mM]ulti | camera-streamer)
3030
if [[ "$(is_raspberry_pi)" = "1" ]] &&
3131
[[ "$(is_ubuntu_arm)" = "0" ]] &&
32+
[[ "$(is_armbian)" = "0" ]] &&
3233
[[ "$(is_pi5)" = "0" ]]; then
3334
MULTI_INSTANCES+=( "${cams}" )
3435
else

libs/logging.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,13 @@ function print_cams {
108108
for device in $(get_libcamera_path); do
109109
log_msg "Detected 'libcamera' device -> ${device}"
110110
done
111+
if [[ "$(is_pi5)" = "0" ]]; then
112+
list_picam_resolution
113+
list_picam_controls
114+
fi
111115
fi
112116
if [[ "${legacy}" -ne 0 ]]; then
113-
raspicam="$(v4l2-ctl --list-devices | grep -A1 -e 'mmal' | \
117+
raspicam="$(v4l2-ctl --list-devices | grep -A1 -e 'mmal' | \
114118
awk 'NR==2 {print $1}')"
115119
log_msg "Detected 'Raspicam' Device -> ${raspicam}"
116120
if [[ ! "${CROWSNEST_LOG_LEVEL}" = "quiet" ]]; then

libs/ustreamer.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ run_mjpg() {
3131
run_ustreamer() {
3232
local cam_sec ust_bin dev pt res fps cstm start_param
3333
cam_sec="${1}"
34-
ust_bin="${BASE_CN_PATH}/bin/ustreamer/ustreamer"
34+
# shellcheck disable=SC2153
35+
ust_bin="${UST_BIN}"
3536
dev="$(get_param "cam ${cam_sec}" device)"
3637
pt="$(get_param "cam ${cam_sec}" port)"
3738
res="$(get_param "cam ${cam_sec}" resolution)"

libs/versioncontrol.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ versioncontrol() {
2828
local cur_ver avail_ver
2929
pushd "${BASE_CN_PATH}"/bin/ustreamer &> /dev/null || exit 1
3030
avail_ver="$(git describe --tags --always)"
31-
cur_ver="v$("${PWD}"/ustreamer -v)"
31+
cur_ver="v$(${UST_BIN} -v)"
3232
if [[ "${cur_ver}" == "${avail_ver}" ]]; then
3333
vc_log_msg "ustreamer is up to date. (${cur_ver})"
3434
fi
@@ -44,6 +44,7 @@ versioncontrol() {
4444
local cur_ver avail_ver
4545
if [[ "$(is_raspberry_pi)" = "1" ]] &&
4646
[[ "$(is_ubuntu_arm)" = "0" ]] &&
47+
[[ "$(is_armbian)" = "0" ]] &&
4748
[[ "$(is_pi5)" = "0" ]]; then
4849
pushd "${BASE_CN_PATH}"/bin/camera-streamer &> /dev/null || exit 1
4950
avail_ver="($(git describe --tags --always))"

resources/crowsnest.conf

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#### crowsnest.conf
2-
#### This is a typical default config.
3-
#### Also used as default in mainsail / MainsailOS
4-
#### See:
2+
#### This is the default config after installation.
3+
#### It is also used as the default config in MainsailOS.
4+
#### For details on how to configure this to your needs, see:
55
#### https://github.com/mainsail-crew/crowsnest/blob/master/README.md
6-
#### for details to configure to your needs.
76

87

98
#####################################################################
@@ -18,8 +17,9 @@
1817
#### Port 8083 equals /webcam4/?action=[stream/snapshot] #####
1918
#### #####
2019
#### Note: These ports are default for most Mainsail #####
21-
#### installations. To use any other port would involve #####
22-
#### changing the proxy configuration or using directly #####
20+
#### installations. Using any other port would involve #####
21+
#### changing the proxy configuration or using URLs #####
22+
#### with the specific port like #####
2323
#### http://<ip>:<port>/?action=[stream/snapshot] #####
2424
#### #####
2525
#####################################################################
@@ -32,16 +32,16 @@
3232
log_path: %LOGPATH%
3333
log_level: verbose # Valid Options are quiet/verbose/debug
3434
delete_log: false # Deletes log on every restart, if set to true
35-
no_proxy: false
35+
no_proxy: false # If set to true, no reverse proxy is required. Only change this, if you know what you are doing.
3636

3737
[cam 1]
38-
mode: ustreamer # ustreamer - Provides mjpg and snapshots. (All devices)
39-
# camera-streamer - Provides webrtc, mjpg and snapshots. (rpi + Raspi OS based only)
40-
enable_rtsp: false # If camera-streamer is used, this enables also usage of an rtsp server
38+
mode: ustreamer # ustreamer - Provides MJPG and snapshots. (All devices)
39+
# camera-streamer - Provides WebRTC, MJPG and snapshots. (only RPiOS + RPi 0/1/2/3/4)
40+
enable_rtsp: false # If camera-streamer is used, this also enables usage of an RTSP server
4141
rtsp_port: 8554 # Set different ports for each device!
42-
port: 8080 # HTTP/MJPG Stream/Snapshot Port
43-
device: /dev/video0 # See Log for available ...
44-
resolution: 640x480 # widthxheight format
45-
max_fps: 15 # If Hardware Supports this it will be forced, otherwise ignored/coerced.
46-
#custom_flags: # You can run the Stream Services with custom flags.
47-
#v4l2ctl: # Add v4l2-ctl parameters to setup your camera, see Log what your cam is capable of.
42+
port: 8080 # HTTP/MJPG stream/snapshot port
43+
device: /dev/video0 # See log for available devices
44+
resolution: 640x480 # <width>x<height> format
45+
max_fps: 15 # If hardware supports it, it will be forced, otherwise ignored/coerced.
46+
#custom_flags: # You can run the stream services with custom flags.
47+
#v4l2ctl: # Add v4l2-ctl parameters to setup your camera, see log for your camera capabilities.

tools/configure.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ CN_CONFIG_LOGPATH="${CN_CONFIG_ROOTPATH}/logs"
2727
CN_CONFIG_ENVPATH="${CN_CONFIG_ROOTPATH}/systemd"
2828
CN_MOONRAKER_CONFIG_PATH="${CN_CONFIG_CONFIGPATH}/moonraker.conf"
2929
CN_USTREAMER_REPO="https://github.com/pikvm/ustreamer.git"
30-
CN_USTREAMER_BRANCH="master"
31-
CN_CAMERA_STREAMER_REPO="https://github.com/ayufan/camera-streamer.git"
30+
CN_USTREAMER_BRANCH="v6.10"
31+
CN_CAMERA_STREAMER_REPO="https://github.com/mryel00/camera-streamer.git"
3232
CN_CAMERA_STREAMER_BRANCH="master"
3333

3434
### Messages

tools/libs/config.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ import_config() {
3636
[[ -n "${CROWSNEST_LOG_PATH}" ]] || CROWSNEST_LOG_PATH="/home/${BASE_USER}/printer_data/logs"
3737
[[ -n "${CROWSNEST_ENV_PATH}" ]] || CROWSNEST_ENV_PATH="/home/${BASE_USER}/printer_data/systemd"
3838
[[ -n "${CROWSNEST_USTREAMER_REPO_SHIP}" ]] || CROWSNEST_USTREAMER_REPO_SHIP="https://github.com/pikvm/ustreamer.git"
39-
[[ -n "${CROWSNEST_USTREAMER_REPO_BRANCH}" ]] || CROWSNEST_USTREAMER_REPO_BRANCH="master"
40-
[[ -n "${CROWSNEST_CAMERA_STREAMER_REPO_SHIP}" ]] || CROWSNEST_CAMERA_STREAMER_REPO_SHIP="https://github.com/ayufan/camera-streamer.git"
39+
[[ -n "${CROWSNEST_USTREAMER_REPO_BRANCH}" ]] || CROWSNEST_USTREAMER_REPO_BRANCH="v6.31"
40+
[[ -n "${CROWSNEST_CAMERA_STREAMER_REPO_SHIP}" ]] || CROWSNEST_CAMERA_STREAMER_REPO_SHIP="https://github.com/mryel00/camera-streamer.git"
4141
[[ -n "${CROWSNEST_CAMERA_STREAMER_REPO_BRANCH}" ]] || CROWSNEST_CAMERA_STREAMER_REPO_BRANCH="master"
4242
status_msg "Using default configuration ..." "0"
4343
fi

tools/libs/core.sh

+16
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ is_ubuntu_arm() {
8585
fi
8686
}
8787

88+
is_armbian() {
89+
if grep -q "Armbian" /etc/os-release; then
90+
echo "1"
91+
else
92+
echo "0"
93+
fi
94+
}
95+
8896
is_speederpad() {
8997
if grep -q "Ubuntu 20.04." /etc/os-release &&
9098
[[ "$(uname -rm)" = "4.9.191 aarch64" ]]; then
@@ -129,6 +137,14 @@ shallow_cs_dependencies_check() {
129137
fi
130138
status_msg "Checking if device is not running Ubuntu ..." "0"
131139

140+
msg "Checking if device is not running Armbian ...\n"
141+
if [[ "$(is_armbian)" = "1" ]]; then
142+
status_msg "Checking if device is not running Armbian ..." "3"
143+
msg "This device is running Armbian therefore camera-streeamer cannot be installed ..."
144+
return 1
145+
fi
146+
status_msg "Checking if device is not running Armbian ..." "0"
147+
132148
msg "Checking for required kernel module ...\n"
133149
SHALLOW_CHECK_MODULESLIST="bcm2835_codec"
134150
if [[ "$(test_load_module ${SHALLOW_CHECK_MODULESLIST})" = "0" ]]; then

0 commit comments

Comments
 (0)