/dev/video0 camera
This commit is contained in:
@@ -26,10 +26,10 @@ These files provide a bash script for quickly deploying multiple octoprint insta
|
||||
* To add more printers at a later date, just run the script again!
|
||||
* General Linux (Ubuntu/Mint/RPiOS/Debian/Fedora/Arch/etc.)
|
||||
* __You do not need to install OctoPrint using any Wiki instructions, snap, etc. The script will do it for you.__
|
||||
* octoprint_deploy uses systemd services, so avoid distros that do not use systemd by default (MX Linux)
|
||||
* octoprint_deploy uses systemd services, so avoid distros that do not use systemd by default (MX Linux or chroot based systems like Chrome+crouton)
|
||||
* Basic guide video here: https://youtu.be/1YINWQ5fNn0
|
||||
* All commands assume you are operating out of your home directory.
|
||||
* Install Ubuntu 18-22.X, Mint 20.3+, Debian, DietPi, RPiOS, Armbian, Fedora35+, or ArchLinux on your system (make sure your user is admin for sudo).
|
||||
* Install Ubuntu 20+, Mint 20.3+, Debian, DietPi, RPiOS, Armbian, Fedora35+, or ArchLinux on your system (make sure your user is admin for sudo).
|
||||
* Install git if it isn't already: `sudo apt install git` or `sudo dnf install git` or `sudo pacman -S git`.
|
||||
* run the command `git clone https://github.com/paukstelis/octoprint_deploy.git`.
|
||||
* run the command `sudo octoprint_deploy/octoprint_deploy.sh`.
|
||||
|
||||
@@ -364,7 +364,7 @@ write_camera() {
|
||||
}
|
||||
|
||||
add_camera() {
|
||||
|
||||
PI=$1
|
||||
if [ $SUDO_USER ]; then user=$SUDO_USER; fi
|
||||
echo 'Adding camera' | log
|
||||
if [ -z "$INSTANCE" ]; then
|
||||
@@ -386,36 +386,33 @@ add_camera() {
|
||||
done
|
||||
fi
|
||||
|
||||
dmesg -C
|
||||
echo "Plug your camera in via USB now (detection time-out in 1 min)"
|
||||
counter=0
|
||||
while [[ -z "$CAM" ]] && [[ $counter -lt 60 ]]; do
|
||||
CAM=$(dmesg | sed -n -e 's/^.*SerialNumber: //p')
|
||||
TEMPUSBCAM=$(dmesg | sed -n -e 's|^.*input:.*/\(.*\)/input/input.*|\1|p')
|
||||
counter=$(( $counter + 1 ))
|
||||
if [[ -n "$TEMPUSBCAM" ]] && [[ -z "$CAM" ]]; then
|
||||
break
|
||||
if [ -z "$PI" ]; then
|
||||
detect_camera
|
||||
|
||||
#Failed state. Nothing detected
|
||||
if [ -z "$CAM" ] && [ -z "$TEMPUSBCAM" ] ; then
|
||||
echo
|
||||
echo -e "\033[0;31mNo camera was detected during the detection period.\033[0m"
|
||||
echo
|
||||
return
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
dmesg -C
|
||||
#Failed state. Nothing detected
|
||||
if [ -z "$CAM" ] && [ -z "$TEMPUSBCAM" ] ; then
|
||||
echo
|
||||
echo -e "\033[0;31mNo camera was detected during the detection period.\033[0m"
|
||||
echo
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$CAM" ]; then
|
||||
echo "Camera Serial Number not detected" | log
|
||||
echo -e "Camera will be setup with physical USB address of \033[0;34m $TEMPUSBCAM.\033[0m" | log
|
||||
echo "The camera will have to stay plugged into this location." | log
|
||||
USBCAM=$TEMPUSBCAM
|
||||
|
||||
if [ -z "$CAM" ]; then
|
||||
echo "Camera Serial Number not detected" | log
|
||||
echo -e "Camera will be setup with physical USB address of \033[0;34m $TEMPUSBCAM.\033[0m" | log
|
||||
echo "The camera will have to stay plugged into this location." | log
|
||||
USBCAM=$TEMPUSBCAM
|
||||
else
|
||||
echo -e "Camera detected with serial number: \033[0;34m $CAM \033[0m" | log
|
||||
check_sn "$CAM"
|
||||
fi
|
||||
|
||||
else
|
||||
echo -e "Camera detected with serial number: \033[0;34m $CAM \033[0m" | log
|
||||
check_sn "$CAM"
|
||||
echo "Setting up a Pi camera service for /dev/video0"
|
||||
echo "Please note that doing this with USB cameras may lead to issues."
|
||||
echo "Don't expect extensive support for trying to fix these issues."
|
||||
fi
|
||||
|
||||
echo "Camera Port (ENTER will increment last value in /etc/camera_ports):"
|
||||
read CAMPORT
|
||||
if [ -z "$CAMPORT" ]; then
|
||||
@@ -454,6 +451,10 @@ add_camera() {
|
||||
#Need to check if this is a one-off install
|
||||
if [ -n "$camopt" ]; then
|
||||
write_camera
|
||||
#Pi Cam setup, replace cam_INSTANCE with /dev/video0
|
||||
if [ -n "$PI" ]; then
|
||||
sed -i "s/cam_$INSTANCE/video0/" /etc/systemd/system/cam_$INSTANCE.service
|
||||
fi
|
||||
systemctl start cam_$INSTANCE.service
|
||||
systemctl enable cam_$INSTANCE.service
|
||||
udevadm control --reload-rules
|
||||
@@ -480,6 +481,22 @@ detect_printer() {
|
||||
dmesg -C
|
||||
}
|
||||
|
||||
detect_camera() {
|
||||
dmesg -C
|
||||
echo "Plug your camera in via USB now (detection time-out in 1 min)"
|
||||
counter=0
|
||||
while [[ -z "$CAM" ]] && [[ $counter -lt 60 ]]; do
|
||||
CAM=$(dmesg | sed -n -e 's/^.*SerialNumber: //p')
|
||||
TEMPUSBCAM=$(dmesg | sed -n -e 's|^.*input:.*/\(.*\)/input/input.*|\1|p')
|
||||
counter=$(( $counter + 1 ))
|
||||
if [[ -n "$TEMPUSBCAM" ]] && [[ -z "$CAM" ]]; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
dmesg -C
|
||||
}
|
||||
|
||||
remove_instance() {
|
||||
echo
|
||||
echo
|
||||
@@ -1133,7 +1150,7 @@ share_uploads() {
|
||||
main_menu
|
||||
break
|
||||
fi
|
||||
|
||||
|
||||
if [ "$opt" == "Custom" ]; then
|
||||
echo "Enter full path (should start /home/$user/):"
|
||||
read ULPATH
|
||||
@@ -1150,9 +1167,9 @@ share_uploads() {
|
||||
sudo -u $user mkdir $ULPATH
|
||||
opt=$ULPATH
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
opt=/home/$user/.$opt/uploads
|
||||
opt=/home/$user/.$opt/uploads
|
||||
fi
|
||||
echo $opt
|
||||
echo
|
||||
@@ -1371,4 +1388,8 @@ fi
|
||||
if [ "$1" == replace ]; then
|
||||
replace_id
|
||||
fi
|
||||
|
||||
if [ "$1" == picam ]; then
|
||||
add_camera true
|
||||
fi
|
||||
main_menu
|
||||
|
||||
Reference in New Issue
Block a user