Skip to content

Commit ea6ab64

Browse files
authored
[Automated] Merged develop into target master
2 parents e96cd46 + 7f85366 commit ea6ab64

File tree

6 files changed

+63
-25
lines changed

6 files changed

+63
-25
lines changed

bin/build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ CLONE_FLAGS=(--depth=1 --single-branch)
3232
# Ustreamer repo
3333
USTREAMER_PATH="ustreamer"
3434
if [[ -z "${CROWSNEST_USTREAMER_REPO_SHIP}" ]]; then
35-
CROWSNEST_USTREAMER_REPO_SHIP="https://github.com/mryel00/ustreamer.git"
35+
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.10"
3939
fi
4040

4141
# Camera-streamer repo

libs/core.sh

+5-8
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,15 @@ function check_dep {
8282

8383
function check_apps {
8484
local cstreamer ustreamer
85-
ustreamer_base="bin/ustreamer"
86-
ustreamer="$(find "${BASE_CN_PATH}"/"${ustreamer_base}" \
87-
-iname 'ustreamer.bin' 2> /dev/null | sed '1q')"
85+
ustreamer="bin/ustreamer/src/ustreamer.bin"
8886
cstreamer="bin/camera-streamer/camera-streamer"
89-
90-
if [[ -x "${ustreamer}" ]]; then
91-
log_msg "Dependency: '${ustreamer##*/}' found in ${ustreamer_base}/${ustreamer##*/}."
92-
UST_BIN="${ustreamer}"
87+
if [[ -x "${BASE_CN_PATH}/${ustreamer}" ]]; then
88+
log_msg "Dependency: 'ustreamer' found in ${ustreamer}."
89+
UST_BIN="${BASE_CN_PATH}/${ustreamer}"
9390
# shellcheck disable=SC2034
9491
declare -r UST_BIN
9592
else
96-
log_msg "Dependency: '${ustreamer##*/}' not found. Exiting!"
93+
log_msg "Dependency: 'ustreamer' not found. Exiting!"
9794
exit 1
9895
fi
9996

libs/hwhandler.sh

+47-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")"
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 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' | \
105+
sed 's/type=1/ (bool/g;s/type=3/ (int/g;s/type=5/ (float/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 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

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

tools/configure.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ CN_CONFIG_CONFIGPATH="${CN_CONFIG_ROOTPATH}/config"
2626
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"
29-
CN_USTREAMER_REPO="https://github.com/mryel00/ustreamer.git"
30-
CN_USTREAMER_BRANCH="master"
29+
CN_USTREAMER_REPO="https://github.com/pikvm/ustreamer.git"
30+
CN_USTREAMER_BRANCH="v6.10"
3131
CN_CAMERA_STREAMER_REPO="https://github.com/ayufan/camera-streamer.git"
3232
CN_CAMERA_STREAMER_BRANCH="master"
3333

tools/libs/config.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ import_config() {
3535
[[ -n "${CROWSNEST_CONFIG_PATH}" ]] || CROWSNEST_CONFIG_PATH="/home/${BASE_USER}/printer_data/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"
38-
[[ -n "${CROWSNEST_USTREAMER_REPO_SHIP}" ]] || CROWSNEST_USTREAMER_REPO_SHIP="https://github.com/mryel00/ustreamer.git"
39-
[[ -n "${CROWSNEST_USTREAMER_REPO_BRANCH}" ]] || CROWSNEST_USTREAMER_REPO_BRANCH="master"
38+
[[ -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="v6.10"
4040
[[ -n "${CROWSNEST_CAMERA_STREAMER_REPO_SHIP}" ]] || CROWSNEST_CAMERA_STREAMER_REPO_SHIP="https://github.com/ayufan/camera-streamer.git"
4141
[[ -n "${CROWSNEST_CAMERA_STREAMER_REPO_BRANCH}" ]] || CROWSNEST_CAMERA_STREAMER_REPO_BRANCH="master"
4242
status_msg "Using default configuration ..." "0"

0 commit comments

Comments
 (0)