Merge branch 'master' into StartAddingSupportForBonding

This commit is contained in:
Scott Kilau 2022-06-17 09:24:47 -05:00
commit 5cd3875d25
12 changed files with 159 additions and 346 deletions

View File

@ -10,8 +10,7 @@ Using this project can potentially expose your device to the open internet depen
## Related Projects:
* wz_mini_debian: run full debian in a chroot, on the camera! (coming soon)
~~* wz_mini_utils: various statically compiled binaries for use with the camera (mipsel)~~ (deprecated, all utils now located in wz_mini/bin)
* ~~wz_mini_utils: various statically compiled binaries for use with the camera (mipsel)~~ (deprecated, all utils now located in wz_mini/bin)
## Features
@ -70,7 +69,7 @@ Using this project can potentially expose your device to the open internet depen
## Setup v3/PANv2
1. git clone the repo or download the repo zip
2. format micro-sd card as fat-32 ( this is a hard requirement, the bootloader does not support ex-fat or ext, and thus will not load wz_mini ), DOS partition map type, volume name does not matter.
2. perform a fresh format on your micro-sd card, using fat-32 ( this is a hard requirement, the bootloader does not support ex-fat or ext, and thus will not load wz_mini ), DOS partition map type, volume name does not matter.
3. copy all the files inside of SD_ROOT to your micro sd card
4. __SSH is enabled, but is secured using public key authentication for security. Edit the file ```wz_mini/etc/ssh/authorized_keys``` and enter your public key here. If you need a simple guide, [how to use public key authentication](https://averagelinuxuser.com/how-to-use-public-key-authentication/)__
@ -85,7 +84,7 @@ Using this project can potentially expose your device to the open internet depen
## Setup v2
1. git clone the repo or download the repo zip
2. format micro-sd card as fat-32 ( this is a hard requirement, the bootloader does not support ex-fat or ext, and thus will not load wz_mini ), DOS partition map type, volume name does not matter.
2. perform a fresh format on your micro-sd card, using fat-32 ( this is a hard requirement, the bootloader does not support ex-fat or ext, and thus will not load wz_mini ), DOS partition map type, volume name does not matter.
3. Run `compile_image.sh` using linux, wait for the script to finish.
4. Copy all the files inside of SD_ROOT to your micro sd card
5. Copy the generated `demo.bin` to root of your micro sd card
@ -382,7 +381,9 @@ NOTE: if you are upgrading a V2 camera from a release older than 06-16-22, you m
## Latest Updates
* 06-16-22: fix scp client bug, allow user modifications to app_init, updated initramfs script, moved upgrade-run to PATH, revised kernel module paths, added ENABLE_RTL8189FS_DRIVER option for v2/v3, updated kernels for v2/v3. ( NOTE: this is a major upgrade, file names for the init scripts have changed, if you are upgrading the V2, do not use the upgrade-run.sh script )
* 06-17-22: Fix custom hostname not being set. Note: The hostname variable has CHANGED! You will need to update your `wz_mini.conf` file.
* 06-16-22: Simplified the camera model detection method throughout wz_mini.
* 06-16-22: fix scp client bug, allow user modifications to app_init, updated initramfs script, moved upgrade-run to PATH, revised kernel module paths, added ENABLE_RTL8189FS_DRIVER option for v2/v3, updated kernels for v2/v3. ( NOTE: this is a major upgrade, file names for the init scripts have changed, if you are upgrading the V2, do not use the upgrade-run.sh script, please manually update )
* 06-14-22: Updated v4l2rtspserver, fixes to prevent rare low memory situations and RTSP server crashes, fixed intermittant failed RTSP HD stream, script logic updates.
* 06-12-22: Added additional audio variables for tuning in libcallback, various bug fixes in wz_user. Added `gather_wz_logs.sh` script for users to share debug logs.
* 06-07-22: Added support to tune IMP video and audio options in libcallback.

View File

@ -7,7 +7,7 @@ if [ "$1" == "" ]; then
echo -e "video on on1 or off off1"
echo -e "audio on on1 or off off1"
echo -e "move (movable camera only)"
echo -e "waitMotion <timeout>"
echo -e "waitMotion <timeout> (you must enable motion tagging in the app first)"
echo -e "irled on or off"
echo -e "aplay <file path> <volume 1-100>"
echo -e "curlDebug on or off"

View File

@ -13,7 +13,6 @@ else
create_dir
fi
#cat * | grep 2C | sed 's/^.*\(RTSP_PASSWORD=\).*$/\1/' | sed 's/-U[^-P]*//'
echo "copy wz_mini logs"
cp /opt/wz_mini/log/* /opt/wz_mini/tmp/log_gather/
@ -39,7 +38,7 @@ echo "gather libcallback logs"
logread | grep "\[command\]" > /opt/wz_mini/tmp/log_gather/libcallback.log
echo "gather process list"
ps -T | sed 's/-U[^-P]*//' > /opt/wz_mini/tmp/log_gather/ps.log
ps -T > /opt/wz_mini/tmp/log_gather/ps.log
echo "gather mounts"
mount > /opt/wz_mini/tmp/log_gather/mount.log
@ -62,6 +61,17 @@ if [ -f /tmp/sd_check_result.txt ]; then
cp /tmp/sd_check_result.txt /opt/wz_mini/tmp/log_gather/sd_check_result.txt
fi
if [[ "$RTSP_PASSWORD" == "" ]]; then
echo "password is blank in config"
RTSP_PASSWORD=$(cat /opt/wz_mini/tmp/wlan0_mac)
fi
cd /opt/wz_mini/tmp/log_gather
echo $RTSP_PASSWORD
sed -e s/"$RTSP_PASSWORD"//g -i *
cd /
echo "compress to /media/mmc/log_gather_$(date +"%F_T%H%M").tar.gz"
tar -czf /media/mmc/log_gather_$(date +"%F_T%H%M").tar.gz -C /opt/wz_mini/tmp log_gather/

View File

@ -1,9 +1,9 @@
#!/bin/sh
if [ -L /dev/fd ]; then
echo fd exists
echo "fd exists" > /dev/null
else
echo fd does not exist, link
echo "fd does not exist, link" > /dev/null
ln -s /proc/self/fd /dev/fd
fi
@ -28,29 +28,36 @@ echo "Verify file integrity"
cd /opt/Upgrade/wz_mini_hacks-master
md5sum -c file.chk
if [ $? -eq 0 ]
then
echo "files OK"
install_upgrade_script
if [ $? -eq 0 ]; then
echo "files OK"
install_upgrade_script
else
echo "Failure: archive has corrupted files"
echo "Delete failed upgrade dir"
rm -rf /opt/Upgrade
exit 1
echo "Failure: archive has corrupted files"
echo "Delete failed upgrade dir"
rm -rf /opt/Upgrade
exit 1
fi
}
install_upgrade_script() {
echo "Installing latest upgrade-script"
echo "Installing latest upgrade-run from repo"
cp /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/wz_mini/bin/upgrade-run.sh /opt/wz_mini/bin/upgrade-run.sh
sleep 5
/opt/wz_mini/bin/upgrade-run.sh backup_begin
echo "Launching latest upgrade-script"
/opt/wz_mini/bin/upgrade-run.sh backup_begin &
echo "Exit old script"
exit 0
}
backup_begin() {
echo "Resume upgrade-run, latest version"
sleep 5
echo "Backup user config"
cp /opt/wz_mini/wz_mini.conf /opt/Upgrade/preserve/
cp -r /opt/wz_mini/etc/configs /opt/Upgrade/preserve/
@ -71,44 +78,26 @@ export WZMINI_CFG=/opt/wz_mini/wz_mini.conf
set -x
#WCV3 AUDIO GPIO
GPIO=63
V2="false"
#Set the correct GPIO for the audio driver (T31 only)
if [ -f /opt/wz_mini/tmp/.HL_PAN2 ]; then
GPIO=7
elif [ -f /opt/wz_mini/tmp/.WYZE_CAKP2JFUS ]; then
GPIO=63
fi
#Check model, change GPIO is HL_PAN2
if [[ "$V2" == "false" ]]; then
mount -t jffs2 /dev/mtdblock6 /configs
if [[ $(cat /configs/.product_config | grep PRODUCT_MODEL) == "PRODUCT_MODEL=HL_PAN2" ]]; then
umount /configs
GPIO=7
fi
if [ -f /opt/wz_mini/tmp/.T20 ]; then
insmod /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/wz_mini/lib/modules/3.10.14/extra/audio.ko
LD_LIBRARY_PATH='/opt/wz_mini/lib' /opt/wz_mini/bin/audioplay_t20 /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/wz_mini/usr/share/audio/upgrade_mode_v2.wav $AUDIO_PROMPT_VOLUME
rmmod audio
else
echo "not HL_PAN2"
insmod /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/audio.ko spk_gpio=$GPIO alc_mode=0 mic_gain=0
/opt/wz_mini/bin/audioplay_t31 /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/wz_mini/usr/share/audio/upgrade_mode.wav $AUDIO_PROMPT_VOLUME
rmmod audio
fi
echo "UPGRADE MODE"
#test for v2
if [ -b /dev/mtdblock9 ]; then
mount -t jffs2 /dev/mtdblock9 /params
if cat /params/config/.product_config | grep WYZEC1-JZ; then
V2="true"
fi
fi
if [[ "$V2" == "true" ]]; then
insmod /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/wz_mini/lib/modules/3.10.14/extra/audio.ko
LD_LIBRARY_PATH='/opt/wz_mini/lib' /opt/wz_mini/bin/audioplay_t20 /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/wz_mini/usr/share/audio/upgrade_mode_v2.wav $AUDIO_PROMPT_VOLUME
rmmod audio
else
insmod /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/audio.ko spk_gpio=$GPIO alc_mode=0 mic_gain=0
/opt/wz_mini/bin/audioplay_t31 /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/wz_mini/usr/share/audio/upgrade_mode.wav $AUDIO_PROMPT_VOLUME
rmmod audio
fi
echo UPGRADE MODE
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
echo "Upgrading kernel"
flashcp -v /opt/Upgrade/wz_mini_hacks-master/v2_install/v2_kernel.bin /dev/mtd1
fi
@ -124,12 +113,12 @@ mv /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/factory_t31_ZMC6tiIDQN /opt/factory
diff /opt/wz_mini/wz_mini.conf /opt/Upgrade/preserve/wz_mini.conf
if [ $(cat /opt/Upgrade/preserve/wz_mini.conf | wc -l) != $(cat /opt/wz_mini/wz_mini.conf | wc -l) ]; then
echo "doesn't match, keep old config"
mv /opt/wz_mini/wz_mini.conf /opt/wz_mini/wz_mini.conf.dist
cp /opt/Upgrade/preserve/wz_mini.conf /opt/wz_mini/
echo "doesn't match, keep old config"
mv /opt/wz_mini/wz_mini.conf /opt/wz_mini/wz_mini.conf.dist
cp /opt/Upgrade/preserve/wz_mini.conf /opt/wz_mini/
else
echo "configs match"
cp /opt/Upgrade/preserve/wz_mini.conf /opt/wz_mini/
echo "configs match"
cp /opt/Upgrade/preserve/wz_mini.conf /opt/wz_mini/
fi
cp /opt/Upgrade/preserve/ssh/* /opt/wz_mini/etc/ssh/
@ -142,11 +131,11 @@ reboot
}
if [[ -e /tmp/dbgflag ]]; then
upgrade_mode_start
upgrade_mode_start
else
if [ "$1" == "backup_begin" ]; then
backup_begin
backup_begin
else
read -r -p "${1:-wz_mini, this will download the latest version from github and upgrade your system. Are you sure? [y/N]} " response

View File

@ -21,22 +21,7 @@ set -x
echo "welcome to wz_cam.sh"
echo "PID $$"
#test for v2
v2_test() {
if cat /params/config/.product_config | grep WYZEC1-JZ; then
V2="true"
fi
}
if mountpoint -q /params; then
echo "params already mounted"
v2_test
else
mount -t jffs2 /dev/mtdblock9 /params
v2_test
fi
if [ "$V2" == "false" ]; then
if [ -f /opt/wz_mini/tmp/.T31 ]; then
cp /opt/wz_mini/etc/uvc.config /opt/wz_mini/usr/bin/uvc.config

View File

@ -36,40 +36,59 @@ echo '
set -x
#WCV3 AUDIO GPIO
GPIO=63
V2="false"
#replace stock busybox
mount --bind /opt/wz_mini/bin/busybox /bin/busybox
#test for v2
echo "replace stock fstab"
mount --bind /opt/wz_mini/etc/fstab /etc/fstab
echo "mount workplace dir"
mount -t tmpfs /opt/wz_mini/tmp
echo "install busybox applets"
mkdir /opt/wz_mini/tmp/.bin
/opt/wz_mini/bin/busybox --install -s /opt/wz_mini/tmp/.bin
##DETECT CAMERA MODEL & PLATFORM TYPE
#V2=WYZEC1-JZ
#PANv1=WYZECP1_JEF
#PANv2=HL_PAN2
#V3=WYZE_CAKP2JFUS
#DB3=WYZEDB3
#mtdblock9 only exists on the T20 platform, indicating V2 or PANv1
if [ -b /dev/mtdblock9 ]; then
mount -t jffs2 /dev/mtdblock9 /params
if cat /params/config/.product_config | grep WYZEC1-JZ; then
V2="true"
fi
mkdir /opt/wz_mini/tmp/params
mount -t jffs2 /dev/mtdblock9 /opt/wz_mini/tmp/params
touch /opt/wz_mini/tmp/.$(cat /opt/wz_mini/tmp/params/config/.product_config | grep PRODUCT_MODEL | sed -e 's#.*=\(\)#\1#')
touch /opt/wz_mini/tmp/.T20
umount /opt/wz_mini/tmp/params
rm -rf /opt/wz_mini/tmp/params
elif [ -b /dev/mtdblock6 ]; then
mkdir /opt/wz_mini/tmp/configs
mount -t jffs2 /dev/mtdblock6 /opt/wz_mini/tmp/configs
touch /opt/wz_mini/tmp/.$(cat /opt/wz_mini/tmp/configs/.product_config | grep PRODUCT_MODEL | sed -e 's#.*=\(\)#\1#')
touch /opt/wz_mini/tmp/.T31
umount /opt/wz_mini/tmp/configs
rm -rf /opt/wz_mini/tmp/configs
fi
#Check model, change GPIO is HL_PAN2
if [[ "$V2" == "false" ]]; then
mount -t jffs2 /dev/mtdblock6 /configs
if [[ $(cat /configs/.product_config | grep PRODUCT_MODEL) == "PRODUCT_MODEL=HL_PAN2" ]]; then
umount /configs
GPIO=7
fi
else
echo "not HL_PAN2"
#Set the correct GPIO for the audio driver (T31 only)
if [ -f /opt/wz_mini/tmp/.HL_PAN2 ]; then
GPIO=7
elif [ -f /opt/wz_mini/tmp/.WYZE_CAKP2JFUS ]; then
GPIO=63
fi
if [[ -e /opt/wz_mini/etc/.first_boot ]]; then
if [ -e /opt/wz_mini/etc/.first_boot ]; then
echo "first boot already completed"
else
echo "first boot, initializing"
if [[ "$V2" == "true" ]]; then
insmod /opt/wz_mini/lib/modules/3.10.14/extra/audio.ko
if [ -f /opt/wz_mini/tmp/.T20 ]; then
#May need different gpio for PANv1
#We don't rmmod this module, as it is marked [permanent] by the kernel on T20
insmod /opt/wz_mini/lib/modules/3.10.14/extra/audio.ko sign_mode=0
LD_LIBRARY_PATH='/opt/wz_mini/lib' /opt/wz_mini/bin/audioplay_t20 /opt/wz_mini/usr/share/audio/init_v2.wav $AUDIO_PROMPT_VOLUME
rmmod audio
else
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/audio.ko spk_gpio=$GPIO alc_mode=0 mic_gain=0
/opt/wz_mini/bin/audioplay_t31 /opt/wz_mini/usr/share/audio/init.wav $AUDIO_PROMPT_VOLUME
@ -88,25 +107,13 @@ echo "mounting tmpfs"
mount -t tmpfs /tmp
echo "mount system to replace factorycheck with dummy, to prevent bind unmount"
if [[ ! "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T31 ]; then
mount /dev/mtdblock3 /system
mount --bind /opt/wz_mini/bin/factorycheck /system/bin/factorycheck
else
echo "v2 doesn't need factorycheck"
fi
touch /tmp/usrflag
echo "replace stock fstab"
mount --bind /opt/wz_mini/etc/fstab /etc/fstab
echo "mount workplace dir"
mount -t tmpfs /opt/wz_mini/tmp
echo "install busybox applets"
mkdir /opt/wz_mini/tmp/.bin
/opt/wz_mini/bin/busybox --install -s /opt/wz_mini/tmp/.bin
echo "create workspace directory"
mkdir /opt/wz_mini/tmp/.storage
@ -124,7 +131,7 @@ sed -i '/system\/\lib/s/$/:\/opt\/wz_mini\/lib/' /opt/wz_mini/tmp/.storage/rcS
#sed -i '/^# Run init script.*/i#Hook Library PATH here\nexport LD_LIBRARY_PATH=/tmp/test/lib:$LD_LIBRARY_PATH\n' /opt/wz_mini/tmp/.storage/rcS
#sed -i '/^# Run init script.*/i#Hook system PATH here\nexport PATH=/tmp/test/bin:$PATH\n' /opt/wz_mini/tmp/.storage/rcS
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
mount -t jffs2 /dev/mtdblock4 /system
fi
@ -147,10 +154,8 @@ mount --bind /opt/wz_mini/tmp/.storage/shadow /etc/shadow
chmod 400 /etc/shadow
if [[ -e /opt/wz_mini/swap.gz ]]; then
if [[ "$V2" == "true" ]]; then
insmod /opt/wz_mini/lib/modules/3.10.14/extra/audio.ko
if [ -f /opt/wz_mini/tmp/.T20 ]; then
LD_LIBRARY_PATH='/opt/wz_mini/lib' /opt/wz_mini/bin/audioplay_t20 /opt/wz_mini/usr/share/audio/swap_v2.wav $AUDIO_PROMPT_VOLUME
rmmod audio
else
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/audio.ko spk_gpio=$GPIO alc_mode=0 mic_gain=0
/opt/wz_mini/bin/audioplay_t31 /opt/wz_mini/usr/share/audio/swap.wav $AUDIO_PROMPT_VOLUME
@ -161,10 +166,10 @@ if [[ -e /opt/wz_mini/swap.gz ]]; then
mkswap /opt/wz_mini/swap
sync;echo 3 > /proc/sys/vm/drop_caches
else
echo "swap archive not present, not extracting"
echo "swap archive missing, not extracting"
fi
if [[ -d /opt/wz_mini/usr/share/terminfo ]]; then
if [ -d /opt/wz_mini/usr/share/terminfo ]; then
echo "terminfo already present"
else
echo "terminfo not present, extract"

View File

@ -16,7 +16,7 @@ exec 1> $LOG_NAME.log 2>&1
set -x
if [[ -e /tmp/dbgflag ]];then
if [ -e /tmp/dbgflag ];then
echo "debug mode, disabled"
exit 0
fi
@ -40,20 +40,14 @@ if [ -d /lib/modules ]; then
mount --bind /opt/wz_mini/lib/modules /lib/modules
fi
if [ -f /params/config/.product_config ]; then
if cat /params/config/.product_config | grep WYZEC1-JZ; then
V2="true"
fi
fi
## REPLACE STOCK MODULES
if [[ "$ENABLE_RTL8189FS_DRIVER" == "true" ]]; then
#V2/V3 ONLY
#V2/V3 ONLY [DB3 untested]
echo "Enable RTL8189FS"
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.WYZEC1-JZ ]; then
sed -i 's/\/driver\/rtl8189ftv.ko/\/opt\/wz_mini\/lib\/modules\/3.10.14\/extra\/8189fs.ko rtw_power_mgnt=0 rtw_enusbss=0/g' /opt/wz_mini/tmp/.storage/app_init.sh
else
elif [ -f /opt/wz_mini/tmp/.WYZE_CAKP2JFUS ]; then
sed -i 's/\/system\/driver\/rtl8189ftv.ko/\/opt\/wz_mini\/lib\/modules\/3.10.14\_\_isvp_swan_1.0\_\_\/extra\/8189fs.ko rtw_power_mgnt=0 rtw_enusbss=0/g' /opt/wz_mini/tmp/.storage/app_init.sh
fi
fi
@ -62,7 +56,7 @@ fi
if [[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] && ! [[ -e /tmp/dbgflag ]]; then
if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] && [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
echo "load video loopback driver at video6 video7"
insmod /opt/wz_mini/lib/modules/3.10.14/extra/v4l2loopback_V2.ko video_nr=6,7
else
@ -70,7 +64,7 @@ if [[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "tru
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/v4l2loopback.ko video_nr=1,2
fi
elif [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
echo "load video loopback driver at video7"
insmod /opt/wz_mini/lib/modules/3.10.14/extra/v4l2loopback_V2.ko video_nr=7
else
@ -78,7 +72,7 @@ if [[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "tru
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/v4l2loopback.ko video_nr=2
fi
elif [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
echo "load video loopback driver at video6"
insmod /opt/wz_mini/lib/modules/3.10.14/extra/v4l2loopback_V2.ko video_nr=6
else

View File

@ -29,11 +29,11 @@ export WZMINI_CFG=/opt/wz_mini/wz_mini.conf
hostname_set() {
echo "set hostname"
hostname $HOSTNAME
hostname $CUSTOM_HOSTNAME
}
first_run_check() {
if [[ -e /opt/wz_mini/tmp/.wz_user_firstrun ]]; then
if [ -e /opt/wz_mini/tmp/.wz_user_firstrun ]; then
echo "wz_user.sh already run once, exit."
exit 0
fi
@ -121,7 +121,7 @@ eth_wlan_up() {
##Run DHCP client, and bind mount our fake wpa_cli.sh to fool iCamera
ifconfig wlan0 up
pkill udhcpc
udhcpc -i wlan0 -x hostname:$HOSTNAME -p /var/run/udhcpc.pid -b
udhcpc -i wlan0 -x hostname:$CUSTOM_HOSTNAME -p /var/run/udhcpc.pid -b
# If running with Interface Bonding enabled, kill any existing
# wpa_supplicant that might be running and spawn our own instead
@ -130,7 +130,7 @@ eth_wlan_up() {
wpa_supplicant -D nl80211 -i wlanold -c /tmp/wpa_supplicant.conf -B -s
fi
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
mount -o bind /opt/wz_mini/bin/wpa_cli.sh /system/bin/wpa_cli
else
mount -o bind /opt/wz_mini/bin/wpa_cli.sh /bin/wpa_cli
@ -141,7 +141,7 @@ eth_wlan_up() {
wpa_check() {
#Check if wpa_supplicant has been created by iCamera
if [[ -e /tmp/wpa_supplicant.conf ]]; then
if [ -e /tmp/wpa_supplicant.conf ]; then
echo "wpa_supplicant.conf ready"
wlanold_check $1
else
@ -158,7 +158,7 @@ wpa_check() {
wlanold_check() {
#Have we renamed interfaces yet?
if [[ -d /sys/class/net/wlanold ]]; then
if [ -d /sys/class/net/wlanold ]; then
echo "wlanold exist"
eth_wlan_up
else
@ -182,7 +182,7 @@ netloop() {
}
swap_enable() {
if [[ -e /opt/wz_mini/swap ]]; then
if [ -e /opt/wz_mini/swap ]; then
echo "Swap file exists"
if cat /proc/swaps | grep "mini" ; then
echo "Swap is already enabled"
@ -224,12 +224,11 @@ done
first_run_check
wait_wlan
if cat /params/config/.product_config | grep WYZEC1-JZ; then
V2="true"
KMOD_PATH="/opt/wz_mini/lib/modules/3.10.14"
#Set module dir depending on platform
if [ -f /opt/wz_mini/tmp/.T20 ]; then
KMOD_PATH="/opt/wz_mini/lib/modules/3.10.14"
else
V2="false"
KMOD_PATH="/opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__"
KMOD_PATH="/opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__"
fi
swap_enable
@ -252,8 +251,8 @@ else
fi
if [[ "$ENABLE_IPTABLES" == "true" ]]; then
if [[ "$V2" == "true" ]]; then
echo "v2 has iptables built in"
if [ -f /opt/wz_mini/tmp/.T20 ]; then
echo "T20 has iptables built in"
else
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/netfilter/x_tables.ko
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/ipv4/netfilter/ip_tables.ko
@ -314,9 +313,9 @@ fi
if [[ "$ENABLE_USB_DIRECT" == "true" ]]; then
HOST_MACADDR=$(echo "$HOSTNAME"|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')
HOST_MACADDR=$(echo "$CUSTOM_HOSTNAME"|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
echo connect > /sys/devices/platform/jz-dwc2/dwc2/udc/dwc2/soft_connect
sleep 1
devmem 0x10000040 32 0x0b800096
@ -332,7 +331,7 @@ if [[ "$ENABLE_USB_DIRECT" == "true" ]]; then
insmod $KMOD_PATH/kernel/drivers/usb/gadget/libcomposite.ko
if [[ "$V2" == "false" ]]; then
if [ -f /opt/wz_mini/tmp/.T31 ]; then
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/u_ether.ko
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/usb_f_ncm.ko
fi
@ -421,7 +420,7 @@ else
fi
if [[ "$ENABLE_EXT4" == "true" ]]; then
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
insmod $KMOD_PATH/kernel/lib/crc16.ko
fi
@ -450,8 +449,8 @@ else
fi
if [[ "$ENABLE_MP4_WRITE" == "true" ]]; then
if [[ "$V2" == "true" ]]; then
echo "mp4_write is not supported on v2"
if [ -f /opt/wz_mini/tmp/.T20 ]; then
echo "mp4_write is not supported on T20"
else
/opt/wz_mini/bin/cmd mp4write on
echo "mp4_write enabled"
@ -462,7 +461,7 @@ fi
if [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
HI_VIDEO_DEV="/dev/video6"
else
HI_VIDEO_DEV="/dev/video1"
@ -487,7 +486,7 @@ if [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
fi
if [[ "$RTSP_HI_RES_ENC_PARAMETER" != "" ]]; then
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
if [[ $RTSP_HI_RES_ENC_PARAMETER =~ "^[0|1|2|4|8]$" ]]; then
watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:0:4:$RTSP_HI_RES_ENC_PARAMETER" > /dev/null 2>&1 &
sleep 5
@ -505,7 +504,7 @@ if [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
fi
if [[ "$RTSP_HI_RES_MAX_BITRATE" != "" ]]; then
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:28:4:$RTSP_HI_RES_MAX_BITRATE" > /dev/null 2>&1 &
sleep 5
else
@ -515,8 +514,8 @@ if [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
fi
if [[ "$RTSP_HI_RES_TARGET_BITRATE" != "" ]]; then
if [[ "$V2" == "true" ]]; then
echo "not supported on v2"
if [ -f /opt/wz_mini/tmp/.T20 ]; then
echo "not supported on T20"
else
watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:48:4:$RTSP_HI_RES_TARGET_BITRATE" > /dev/null 2>&1 &
sleep 5
@ -524,7 +523,7 @@ if [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
fi
if [[ "$RTSP_HI_RES_FPS" != "" ]]; then
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:8:4:$RTSP_HI_RES_FPS" > /dev/null 2>&1 &
sleep 5
else
@ -541,7 +540,7 @@ fi
if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
LOW_VIDEO_DEV="/dev/video7"
else
LOW_VIDEO_DEV="/dev/video2"
@ -566,7 +565,7 @@ if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then
fi
if [[ "$RTSP_LOW_RES_ENC_PARAMETER" != "" ]]; then
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
if [[ $RTSP_LOW_RES_ENC_PARAMETER =~ "^[0|1|2|4|8]$" ]]; then
watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:0:4:$RTSP_LOW_RES_ENC_PARAMETER" > /dev/null 2>&1 &
sleep 5
@ -583,7 +582,7 @@ if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then
fi
if [[ "$RTSP_LOW_RES_MAX_BITRATE" != "" ]]; then
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:28:4:$RTSP_LOW_RES_MAX_BITRATE" > /dev/null 2>&1 &
sleep 5
else
@ -592,15 +591,15 @@ if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then
fi
if [[ "$RTSP_LOW_RES_TARGET_BITRATE" != "" ]]; then
if [[ "$V2" == "true" ]]; then
echo "not supported on v2"
if [ -f /opt/wz_mini/tmp/.T20 ]; then
echo "not supported on T20"
else
watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:48:4:$RTSP_LOW_RES_TARGET_BITRATE" > /dev/null 2>&1 &
fi
fi
if [[ "$RTSP_LOW_RES_FPS" != "" ]]; then
if [[ "$V2" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:8:4:$RTSP_LOW_RES_FPS" > /dev/null 2>&1 &
sleep 5
else
@ -632,7 +631,7 @@ fi
hostname_set
touch /opt/wz_mini/tmp/.wz_user_firstrun
pkill -f dumpload #Kill dumpload so it won't waste cpu or ram gathering cores when something crashes
pkill -f dumpload #Kill dumpload so it won't waste cpu or ram gathering cores and uploading them when something crashes
sysctl -w kernel.core_pattern='|/bin/false'
dmesg_log
trim_logs

View File

@ -9,7 +9,7 @@ WEB_CAM_BIT_RATE="8000"
WEB_CAM_FPS_RATE="25"
#####NETWORKING#####
HOSTNAME="WCV3"
CUSTOM_HOSTNAME="WCV3"
ENABLE_USB_ETH="false"
ENABLE_USB_ETH_MODULES="asix"
@ -32,6 +32,8 @@ ENABLE_IPTABLES="false"
ENABLE_NFSv4="false"
ENABLE_RTL8189FS_DRIVER="false"
#####ACCESSORIES#####
REMOTE_SPOTLIGHT="false"
REMOTE_SPOTLIGHT_HOST="0.0.0.0"

View File

@ -1,171 +0,0 @@
#!/bin/sh
if [ -L /dev/fd ]; then
echo fd exists
else
echo fd does not exist, link
ln -s /proc/self/fd /dev/fd
fi
LOG_FILE=/opt/upgrade_wz_mini.log
exec > >(busybox tee -a ${LOG_FILE}) 2>&1
setup() {
echo "Create Upgrade directory"
mkdir /opt/Upgrade
echo "Create backup files directory"
mkdir /opt/Upgrade/preserve
echo "Download latest master"
wget --no-check-certificate https://github.com/gtxaspec/wz_mini_hacks/archive/refs/heads/master.zip -O /opt/Upgrade/wz_mini.zip; sync
echo "Extract archive"
unzip /opt/Upgrade/wz_mini.zip -d /opt/Upgrade/
echo "Verify file integrity"
cd /opt/Upgrade/wz_mini_hacks-master
md5sum -c file.chk
if [ $? -eq 0 ]
then
echo "files OK"
install_upgrade_script
else
echo "Failure: archive has corrupted files"
echo "Delete failed upgrade dir"
rm -rf /opt/Upgrade
exit 1
fi
}
install_upgrade_script() {
echo "Installing latest upgrade-script"
cp /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/wz_mini/bin/upgrade-run.sh /opt/wz_mini/bin/upgrade-run.sh
/opt/wz_mini/bin/upgrade-run.sh backup_begin
}
backup_begin() {
echo "Backup user config"
cp /opt/wz_mini/wz_mini.conf /opt/Upgrade/preserve/
cp -r /opt/wz_mini/etc/configs /opt/Upgrade/preserve/
cp -r /opt/wz_mini/etc/ssh /opt/Upgrade/preserve/
cp -r /opt/wz_mini/etc/wireguard /opt/Upgrade/preserve/
sync
echo "Rebooting into UPGRADE MODE"
reboot
}
upgrade_mode_start() {
export WZMINI_CFG=/opt/wz_mini/wz_mini.conf
[ -f $WZMINI_CFG ] && source $WZMINI_CFG
set -x
#WCV3 AUDIO GPIO
GPIO=63
V2="false"
#Check model, change GPIO is HL_PAN2
if [[ "$V2" == "false" ]]; then
mount -t jffs2 /dev/mtdblock6 /configs
if [[ $(cat /configs/.product_config | grep PRODUCT_MODEL) == "PRODUCT_MODEL=HL_PAN2" ]]; then
umount /configs
GPIO=7
fi
else
echo "not HL_PAN2"
fi
#test for v2
if [ -b /dev/mtdblock9 ]; then
mount -t jffs2 /dev/mtdblock9 /params
if cat /params/config/.product_config | grep WYZEC1-JZ; then
V2="true"
fi
fi
if [[ "$V2" == "true" ]]; then
insmod /opt/wz_mini/lib/modules/3.10.14/kernel/audio.ko
LD_LIBRARY_PATH='/opt/wz_mini/lib' /opt/wz_mini/bin/audioplay_t20 /opt/wz_mini/usr/share/audio/upgrade_mode_v2.wav $AUDIO_PROMPT_VOLUME
rmmod audio
else
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/audio.ko spk_gpio=$GPIO alc_mode=0 mic_gain=0
/opt/wz_mini/bin/audioplay_t31 /opt/wz_mini/usr/share/audio/upgrade_mode.wav $AUDIO_PROMPT_VOLUME
rmmod audio
fi
echo UPGRADE MODE
umount -l /opt/wz_mini/tmp
ls -l /opt/wz_mini/
rm -rf /opt/wz_mini/*
sync
mv /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/wz_mini/* /opt/wz_mini/
rm -f /opt/factory_t31_ZMC6tiIDQN
mv /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/factory_t31_ZMC6tiIDQN /opt/factory_t31_ZMC6tiIDQN
diff /opt/wz_mini/wz_mini.conf /opt/Upgrade/preserve/wz_mini.conf
if [ $(cat /opt/Upgrade/preserve/wz_mini.conf | wc -l) != $(cat /opt/wz_mini/wz_mini.conf | wc -l) ]; then
echo "doesn't match, keep old config"
mv /opt/wz_mini/wz_mini.conf /opt/wz_mini/wz_mini.conf.dist
cp /opt/Upgrade/preserve/wz_mini.conf /opt/wz_mini/
else
echo "configs match"
cp /opt/Upgrade/preserve/wz_mini.conf /opt/wz_mini/
fi
cp /opt/Upgrade/preserve/ssh/* /opt/wz_mini/etc/ssh/
cp /opt/Upgrade/preserve/configs/* /opt/wz_mini/etc/configs
cp -r /opt/Upgrade/preserve/wireguard /opt/wz_mini/etc/
rm -rf /opt/Upgrade
sync
reboot
}
if [[ -e /tmp/dbgflag ]]; then
upgrade_mode_start
else
if [ "$1" == "backup_begin" ]; then
backup_begin
else
read -r -p "${1:-wz_mini, this will download the latest version from github and upgrade your system. Are you sure? [y/N]} " response
case "$response" in
[yY][eE][sS]|[yY])
if [[ -d /opt/Upgrade ]]; then
echo "WARNING: Old Upgrade directory exists"
read -r -p "${1:-Unable to proceed, must DELETE old Upgrade directory, are you sure? [y/N]} " response
case "$response" in
[yY][eE][sS]|[yY])
rm -rf /opt/Upgrade
sync
setup
;;
*)
echo "User denied directory removal, exit"
;;
esac
else
setup
fi
;;
*)
echo "User declined system update, exit"
;;
esac
fi
fi

View File

@ -9,7 +9,7 @@ WEB_CAM_BIT_RATE="8000"
WEB_CAM_FPS_RATE="25"
#####NETWORKING#####
HOSTNAME="WCV3"
CUSTOM_HOSTNAME="WCV3"
ENABLE_USB_ETH="false"
ENABLE_USB_ETH_MODULES="asix"

View File

@ -1,13 +1,13 @@
72349f3e54a44146d63dc775d37045b1 SD_ROOT/factory_t31_ZMC6tiIDQN
d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/mnt/.gitignore
34c6a4c3a941ff2becd9f487826d7692 SD_ROOT/wz_mini/etc/uvc.config
0ca440c725d13707e17f8bf4da6f02da SD_ROOT/wz_mini/etc/init.d/wz_cam.sh
a96f3eb3c571e95490317e746a9d697f SD_ROOT/wz_mini/etc/init.d/wz_init.sh
9d55cf0a4de134f12b2eb68f45efddd5 SD_ROOT/wz_mini/etc/init.d/wz_user.sh
b346d78a55b0d30b161c15b8c55f8277 SD_ROOT/wz_mini/etc/init.d/wz_post.sh
ad7d1a2f9db3079617731b5854ce3b6a SD_ROOT/wz_mini/etc/init.d/wz_cam.sh
0774518c06d6ef8e7181d35f194777cc SD_ROOT/wz_mini/etc/init.d/wz_init.sh
c94845a6a1bd6c20f643daf4595b03f9 SD_ROOT/wz_mini/etc/init.d/wz_user.sh
48c4fd27a194459efda6e92b446f51a0 SD_ROOT/wz_mini/etc/init.d/wz_post.sh
e3034eac02d8eda9902ca9cf89f0a586 SD_ROOT/wz_mini/etc/inittab
840aa9c26726201f7cffbf001bee193a SD_ROOT/wz_mini/etc/uvc_jxf22.config
2e2d5c1ebdcc16da6852e9cdd3ffc66c SD_ROOT/wz_mini/etc/wz_mini.conf.dist
2609cae8b3b084d83e84299528d8bc93 SD_ROOT/wz_mini/etc/wz_mini.conf.dist
8b5e58acfcbb20034dc4873a08b45fd9 SD_ROOT/wz_mini/etc/profile
2c2df1b9cb603f9c31c46162d6ac307f SD_ROOT/wz_mini/etc/alsa/alsa.conf
9e5591da95042bcca910403bde25dc60 SD_ROOT/wz_mini/etc/fstab
@ -25,7 +25,7 @@ d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/root/.gitignore
ec906872794379af570869ebfd49bb23 SD_ROOT/wz_mini/bin/tcpdump
db5c63af3c763fc6eb76f6e1b5c96794 SD_ROOT/wz_mini/bin/file
3feb341fca58bc705c3ed5705d4eb716 SD_ROOT/wz_mini/bin/factorycheck
fa09ee51c0aa8e9a5896051c20238965 SD_ROOT/wz_mini/bin/cmd
042c34e28f96300c402a08254dca1200 SD_ROOT/wz_mini/bin/cmd
a9a6bf805cbcfdd6698fe5efd65f91bb SD_ROOT/wz_mini/bin/nano
36cbfe7b96d4240a6b138dd3695ccefd SD_ROOT/wz_mini/bin/strings
1458f09775917db388f807f7ac01bb65 SD_ROOT/wz_mini/bin/socat
@ -49,13 +49,13 @@ a8970288e72c871bff6a4484f1e733d6 SD_ROOT/wz_mini/bin/readelf
41b56bb30f02bce5f5e2598073151e16 SD_ROOT/wz_mini/bin/ffmpeg
e37474a12d76cae16336476cba61e8b8 SD_ROOT/wz_mini/bin/neofetch
7fcc716cda1e024dae1045050a135beb SD_ROOT/wz_mini/bin/audioplay_t31
ff3a5698bed114d813440564c2923d6d SD_ROOT/wz_mini/bin/upgrade-run.sh
1b34a65eae3c4aed0704cc90e59757ce SD_ROOT/wz_mini/bin/upgrade-run.sh
e6a6a9dd8ce138686083a3d4303cea40 SD_ROOT/wz_mini/bin/iperf3
0468ffb319707687557353242a518923 SD_ROOT/wz_mini/bin/wg
65510c6c4d0db4b4679fc92d1c617fdd SD_ROOT/wz_mini/bin/rtmp-stream.sh
5d1359af0c7c5d326b8682a62f910620 SD_ROOT/wz_mini/bin/strace
516118bfcc0f0ddc93fb9339b3c6a315 SD_ROOT/wz_mini/bin/xtables-multi
a97ef595ae543e76de900c270baaa0d9 SD_ROOT/wz_mini/bin/gather_wz_logs.sh
17a23742c599a262e4144c499fa66845 SD_ROOT/wz_mini/bin/gather_wz_logs.sh
097cd91a56f2b0caea1dd87ae0e51a54 SD_ROOT/wz_mini/bin/screen
fbbc2a8f362d05fc31557b1a534b42c6 SD_ROOT/wz_mini/bin/wget
35420095a770c9bb6177788842f55bba SD_ROOT/wz_mini/bin/dropbearconvert
@ -77,7 +77,6 @@ ac9f3a5d097d25d5d972c3d2ad288df9 SD_ROOT/wz_mini/usr/bin/ucamera_v2
cf049b9446094cc8a7e07a33cf91c4a8 SD_ROOT/wz_mini/usr/bin/watch_up.sh
b339aee882a5d1c943ad08e4282ec3fd SD_ROOT/wz_mini/usr/bin/iCamera-dbg
20b061689308b2cee7edf3b9b906bca7 SD_ROOT/wz_mini/usr/bin/ucamera
d010b7a3e0c22fa6ea7fe1b53a13c119 SD_ROOT/wz_mini/usr/bin/upgrade-run.sh
580b1b6e91e72b4a4fef7b21d8954403 SD_ROOT/wz_mini/usr/bin/getSensorType
4c780f0455481d106d47d89f0ae04ed5 SD_ROOT/wz_mini/lib/uClibc.tar
9afeb088e4cbabbe0b04033b560204d0 SD_ROOT/wz_mini/lib/libimp.so
@ -185,5 +184,5 @@ ccf8f3611141656ba5594771bec06202 SD_ROOT/wz_mini/lib/modules/3.10.14__isvp_swan
14865a6e2e2df87a8362c6f20377a934 SD_ROOT/wz_mini/lib/libtinyalsa.so.2
bd383994491e4bdca81788c168feb2eb SD_ROOT/wz_mini/lib/libasound.so.2
f6f0d5a9ebd916de6bdb9695067809ae SD_ROOT/wz_mini/lib/libaudioProcess.so
2d825fabc13b2f654c26c492758e1c8e SD_ROOT/wz_mini/wz_mini.conf
2609cae8b3b084d83e84299528d8bc93 SD_ROOT/wz_mini/wz_mini.conf
d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/tmp/.gitignore