Skip to content

Commit 7029650

Browse files
committed
Fix webcam to work with /boot/firmware/octopi.txt path #823 guysoft/CustomPiOS#220
1 parent 5809c96 commit 7029650

File tree

5 files changed

+44
-18
lines changed

5 files changed

+44
-18
lines changed

src/modules/octopi/filesystem/home/root/bin/streamer_select

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
# Exit on any error.
44
set -e
55

6+
CONFIG_FILE=/boot/firmware/octopi.txt
7+
# Fallback for older images
8+
if [ ! -f "${CONFIG_FILE}" ] && [ -f "/boot/octopi.txt" ]; then
69
CONFIG_FILE=/boot/octopi.txt
10+
fi
711
MJPEG_TYPE=mjpeg
812
HLS_TYPE=hls
913
MJPEG_SERVICE=webcamd.service
@@ -29,4 +33,4 @@ elif [ "${camera_streamer}" = "${HLS_TYPE}" ]; then
2933
else
3034
echo "Streamer type '${camera_streamer}' is not supported."
3135
exit 1
32-
fi
36+
fi

src/modules/octopi/filesystem/home/root/bin/webcamd

+20-14
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
11
#!/bin/bash
22

3-
########################################################################
4-
### DO NOT EDIT THIS FILE TO CHANGE THE CONFIG!!! ###
5-
### ---------------------------------------------------------------- ###
6-
### There is no need to edit this file for changing resolution, ###
7-
### frame rates or any other mjpg-streamer parameters. Please edit ###
8-
### /boot/octopi.txt instead - that's what it's there for! You can ###
9-
### even do this with your Pi powered down by directly accessing the ###
10-
### file when using the SD card as thumb drive in your regular ###
11-
### computer. ###
12-
########################################################################
3+
###############################################################################
4+
### DO NOT EDIT THIS FILE TO CHANGE THE CONFIG!!! ###
5+
### ----------------------------------------------------------------------- ###
6+
### There is no need to edit this file for changing resolution, ###
7+
### frame rates or any other mjpg-streamer parameters. Please edit ###
8+
### /boot/firmware/octopi.txt instead - that's what it's there for! You can ###
9+
### even do this with your Pi powered down by directly accessing the ###
10+
### file when using the SD card as thumb drive in your regular ###
11+
### computer. ###
12+
###############################################################################
1313

1414
MJPGSTREAMER_HOME=/opt/mjpg-streamer
1515
MJPGSTREAMER_INPUT_USB="input_uvc.so"
1616
MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so"
1717

18+
CONFIG_FILE=/boot/firmware/octopi.txt
19+
# Fallback for older images
20+
if [ ! -f "${CONFIG_FILE}" ] && [ -f "/boot/octopi.txt" ]; then
21+
CONFIG_FILE=/boot/octopi.txt
22+
fi
23+
1824
brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "0458:6006" "1e4e:0102" "0471:0311" "038f:6001" "046d:0804" "046d:0994" "0ac8:3450")
1925

20-
config_dir="/boot/octopi.conf.d"
26+
config_dir="${CONFIG_FILE}/octopi.conf.d"
2127

2228
echo "Starting up webcamDaemon..."
2329
echo ""
2430

2531
cfg_files=()
26-
cfg_files+=/boot/octopi.txt
32+
cfg_files+="${CONFIG_FILE}"
2733
if [[ -d ${config_dir} ]]; then
2834
cfg_files+=( `ls ${config_dir}/*.txt` )
2935
fi
@@ -41,7 +47,7 @@ array_assigned_device=()
4147

4248
echo "--- Configuration: ----------------------------"
4349
for cfg_file in ${cfg_files[@]}; do
44-
# init configuration - DO NOT EDIT, USE /boot/octopi.conf.d/*.txt INSTEAD!
50+
# init configuration - DO NOT EDIT, USE /boot/firmware/octopi.conf.d/*.txt INSTEAD!
4551
camera="auto"
4652
camera_usb_options="-r 640x480 -f 10"
4753
camera_raspi_options="-fps 10"
@@ -54,7 +60,7 @@ for cfg_file in ${cfg_files[@]}; do
5460
fi
5561
usb_options="$camera_usb_options"
5662

57-
# if webcam device is explicitly given in /boot/octopi.txt, save the path of the device
63+
# if webcam device is explicitly given in /boot/firmware/octopi.txt, save the path of the device
5864
# to a variable and remove its parameter from usb_options
5965
extracted_device=`echo $usb_options | sed 's@.*-d \(/dev/\(video[0-9]\+\|v4l/[^ ]*\)\).*@\1@'`
6066
if [ "$extracted_device" != "$usb_options" ]

src/modules/octopi/filesystem/root/etc/init.d/change_hostname

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@
1111

1212
. /lib/lsb/init-functions
1313

14+
BOOT_FOLDER=/boot/firmware
15+
# Fallback for older images
16+
if [ ! -f "${CONFIG_FILE}" ] && [ -f "/boot/octopi.txt" ]; then
17+
BOOT_FOLDER=/boot
18+
fi
19+
1420
do_start () {
15-
text_file="/boot/octopi-hostname.txt"
21+
text_file="${BOOT_FOLDER}/octopi-hostname.txt"
1622
if [ ! -f "$text_file" ]
1723
then
1824
exit 0

src/modules/octopi/filesystem/root/etc/init.d/change_password

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@
1111

1212
. /lib/lsb/init-functions
1313

14+
BOOT_FOLDER=/boot/firmware
15+
# Fallback for older images
16+
if [ ! -f "${CONFIG_FILE}" ] && [ -f "/boot/octopi.txt" ]; then
17+
BOOT_FOLDER=/boot
18+
fi
19+
1420
do_start () {
15-
text_file="/boot/octopi-password.txt"
21+
text_file="${BOOT_FOLDER}/octopi-password.txt"
1622
if [ ! -f "$text_file" ]
1723
then
1824
exit 0

src/modules/octopi/filesystem/root/usr/local/bin/networkcheck

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/bin/bash
2+
CONFIG_FILE=/boot/firmware/octopi.txt
3+
# Fallback for older images
4+
if [ ! -f "${CONFIG_FILE}" ] && [ -f "/boot/octopi.txt" ]; then
5+
CONFIG_FILE=/boot/octopi.txt
26

3-
source /boot/octopi.txt
7+
source "${CONFIG_FILE}"
48

59
if [ $enable_network_monitor == 1 ] && [ "$destination_host" != "" ]; then
610

0 commit comments

Comments
 (0)