diff --git a/README.md b/README.md index 6963c6e..8834ade 100644 --- a/README.md +++ b/README.md @@ -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 @@ -382,6 +381,7 @@ NOTE: if you are upgrading a V2 camera from a release older than 06-16-22, you m ## Latest Updates +* 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 ) * 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. diff --git a/SD_ROOT/wz_mini/bin/upgrade-run.sh b/SD_ROOT/wz_mini/bin/upgrade-run.sh index 919ec53..662d844 100755 --- a/SD_ROOT/wz_mini/bin/upgrade-run.sh +++ b/SD_ROOT/wz_mini/bin/upgrade-run.sh @@ -71,44 +71,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 - -#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 diff --git a/SD_ROOT/wz_mini/etc/init.d/wz_cam.sh b/SD_ROOT/wz_mini/etc/init.d/wz_cam.sh index eb94b38..3b8c1c3 100755 --- a/SD_ROOT/wz_mini/etc/init.d/wz_cam.sh +++ b/SD_ROOT/wz_mini/etc/init.d/wz_cam.sh @@ -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 diff --git a/SD_ROOT/wz_mini/etc/init.d/wz_init.sh b/SD_ROOT/wz_mini/etc/init.d/wz_init.sh index 8967091..1d5cf42 100755 --- a/SD_ROOT/wz_mini/etc/init.d/wz_init.sh +++ b/SD_ROOT/wz_mini/etc/init.d/wz_init.sh @@ -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" diff --git a/SD_ROOT/wz_mini/etc/init.d/wz_post.sh b/SD_ROOT/wz_mini/etc/init.d/wz_post.sh index d5ddbe1..d2406e3 100755 --- a/SD_ROOT/wz_mini/etc/init.d/wz_post.sh +++ b/SD_ROOT/wz_mini/etc/init.d/wz_post.sh @@ -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 diff --git a/SD_ROOT/wz_mini/etc/init.d/wz_user.sh b/SD_ROOT/wz_mini/etc/init.d/wz_user.sh index 61947c8..58d56ed 100755 --- a/SD_ROOT/wz_mini/etc/init.d/wz_user.sh +++ b/SD_ROOT/wz_mini/etc/init.d/wz_user.sh @@ -33,7 +33,7 @@ hostname_set() { } 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 @@ -76,7 +76,7 @@ eth_wlan_up() { ifconfig wlan0 up pkill udhcpc udhcpc -i wlan0 -x hostname:$HOSTNAME -p /var/run/udhcpc.pid -b - 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 @@ -86,7 +86,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 @@ -103,7 +103,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 @@ -123,7 +123,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" @@ -165,12 +165,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 @@ -193,8 +192,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 @@ -236,7 +235,7 @@ if [[ "$ENABLE_USB_DIRECT" == "true" ]]; then HOST_MACADDR=$(echo "$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 @@ -252,7 +251,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 @@ -341,7 +340,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 @@ -370,8 +369,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" @@ -382,7 +381,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" @@ -407,7 +406,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 @@ -425,7 +424,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 @@ -435,8 +434,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 @@ -444,7 +443,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 @@ -461,7 +460,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" @@ -486,7 +485,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 @@ -503,7 +502,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 @@ -512,15 +511,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 @@ -552,7 +551,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 diff --git a/SD_ROOT/wz_mini/usr/bin/upgrade-run.sh b/SD_ROOT/wz_mini/usr/bin/upgrade-run.sh index 8cf45f5..662d844 100755 --- a/SD_ROOT/wz_mini/usr/bin/upgrade-run.sh +++ b/SD_ROOT/wz_mini/usr/bin/upgrade-run.sh @@ -44,6 +44,9 @@ 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 + +sleep 5 + /opt/wz_mini/bin/upgrade-run.sh backup_begin } @@ -68,43 +71,30 @@ 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 - -#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 +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 + umount -l /opt/wz_mini/tmp ls -l /opt/wz_mini/ rm -rf /opt/wz_mini/* diff --git a/file.chk b/file.chk index 2febea5..0dc1a96 100644 --- a/file.chk +++ b/file.chk @@ -1,10 +1,10 @@ 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 +f4e8ec1b1d69c3b5ba74c617ec7e73d0 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 @@ -49,7 +49,7 @@ 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 +4fc59ee666cd95f7af99cc75e21e455b 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 @@ -77,7 +77,7 @@ 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 +4fc59ee666cd95f7af99cc75e21e455b 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