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