Support for camera auto run

This commit is contained in:
AGG2017 2024-02-18 21:45:14 -05:00
parent 116fbfc1d3
commit efe8e5db84
3 changed files with 24 additions and 6 deletions

View file

@ -13,6 +13,12 @@ fi
project_root="$1"
webcam_package="$2"
auto_start="N"
if [ "$webcam_package" == "default.run" ]; then
webcam_package="default"
auto_start="Y"
fi
# check the required tools
app_version_tool=$(which app_version.sh)
app_model_tool=$(which app_model.sh)
@ -43,14 +49,14 @@ if [ ! -d "$project_root" ]; then
fi
# check the webcam package folder
webcam_package_folder="${project_root}/RESOURCES/OPTIONS/webcam/${webcam_package}"
webcam_package_folder="${project_root}/RESOURCES/OPTIONS/camera/${webcam_package}"
if [ ! -d "$webcam_package_folder" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$webcam_package_folder' ${NC}"
exit 4
fi
# check the webcam package file
webcam_package_file="${webcam_package_folder}/webcam.zip"
webcam_package_file="${webcam_package_folder}/camera.zip"
if [ ! -f "$webcam_package_file" ]; then
echo -e "${RED}ERROR: Cannot find the file '$webcam_package_file' ${NC}"
exit 5
@ -69,6 +75,11 @@ cd "$target_folder" || exit 7
unzip -o "$webcam_package_file"
cd "$current_folder" || exit 8
if [ "$auto_start" == "N" ]; then
# auto start not requested, remove the auto start
rm -f "$project_root/unpacked/squashfs-root/opt/etc/init.d/S55camera"
fi
# try to find out the app version (like app_ver="309")
def_target="$project_root/unpacked/squashfs-root/app/app"
app_ver=$("$app_version_tool" "$def_target")
@ -87,6 +98,7 @@ fi
# patch the app based on the model and the version
if [ "$app_ver" == "3.0.9" ]; then
# stop the app for looking for inserted webcam
sed -i 's/video4linux/videoXlinux/g' "$def_target"
if [ "$app_model" == "K2Pro" ]; then

View file

@ -43,14 +43,20 @@ python="3.11"
# Webcam cli tool for taking pictures from a connected USB web camera
fswebcam="default"
# Enable custom web camera support. Use the 'default' package.
# Enable custom web camera support. Use the 'default' or 'default.run' package.
# Support for firmware ver 3.0.9+ only
#
# Use "default" for install the package but not run the process
# When you need remote video monitoring from the ssh shell execute
# 'camera.py' to start the webserver
# It requires a compatible USB camera to be inserted in any of the USB slots
# From your browser navigate to: http://your_printer_address:8000
# Use CTRL-C or close the ssh shell to stop the webserver
webcam="default" [python] [fswebcam]
#
# Use "default.run" for install the package and auto run the process at startup
#
# From your browser navigate to: http://your_printer_address:8000
#
# It requires a compatible USB camera to be inserted in any of the USB slots
camera="default.run" [python] [fswebcam]
# Enable the web interface Kobra Unleashed
# More information: https://github.com/anjomro/kobra-unleashed