Skip to content
Open
Binary file modified sd/home
Binary file not shown.
153 changes: 108 additions & 45 deletions sd/test/equip_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@ get_config() {
### first we assume that this script is started from /home/init.sh and will replace it from the below lines (which are not commented in init.sh :

#if [ -f "/home/hd1/test/equip_test.sh" ]; then
# /home/hd1/test/equip_test.sh
# exit
# /home/hd1/test/equip_test.sh
# exit
#fi

### Init logs
log_init

######################################################
# start of our custom script !!!!!!
######################################################
Expand All @@ -82,8 +85,9 @@ log "Start telnet server..."
telnetd &


### configure timezone
echo "$(get_config TIMEZONE)" > /etc/TZ
### configure timezone

echo "$(get_config TIMEZONE)" > /etc/TZ

### get time is done after wifi configuration!

Expand Down Expand Up @@ -113,13 +117,41 @@ cd /home/3518
# added :
himm 0x20050074 0x06802424

### Let ppl hear that we start
/home/rmm "/home/hd1/test/voice/welcome.g726" 1
/home/rmm "/home/hd1/test/voice/wait.g726" 1

### start blinking blue led for configuration in progress
#/home/led_ctl -boff -yon &
led -yoff -bfast


insmod /home/mtprealloc7601Usta.ko
insmod /home/mt7601Usta.ko
bcmver="bd1e"
bcmver1="0bdc"
bcmcmd=$(lsusb|grep "0a5c"|cut -d':' -f3)

if [ $bcmver = $bcmcmd ];then
echo 1 > /tmp/isbcm
#/home/bcm/nvram set /home/bcm/nvram.bin
/home/bcm/nvram get
mount -t usbfs none /proc/bus/usb
/home/bcm/bcmdl -n /tmp/nvram.bin /home/bcm/fw_bcmdhd_xy_r2.bin.trx -C 5
insmod /home/bcm/bcmdhd.ko iface_name=ra0
log "BCM 43143:bd1e"
elif [ $bcmver1 = $bcmcmd ];then
echo 1 > /tmp/isbcm
#/home/bcm/nvram set /home/bcm/nvram.bin
/home/bcm/nvram get
mount -t usbfs none /proc/bus/usb
/home/bcm/bcmdl -n /tmp/nvram.bin /home/bcm/fw_bcmdhd_xy_r2.bin.trx -C 5
insmod /home/bcm/bcmdhd.ko iface_name=ra0
log "BCM 43143:0bdc"
else
echo 1 > /tmp/ismtk
insmod /home/mtprealloc7601Usta.ko
insmod /home/mt7601Usta.ko
log "MTK 7601"
fi

ifconfig ra0 up

Expand Down Expand Up @@ -165,19 +197,19 @@ cd /home/3518


himm 0x20050074 0x06802424

### what is this ?
cd /home
./peripheral &
cd /home
./peripheral &
./dispatch &
./exnet &
#./mysystem &

count=5

while [ $count -gt 0 ]
do
if [ -f "/tmp/init_finish" ]; then
if [ -f "/tmp/init_finish" ]; then
break
else
count=`expr $count - 1`
Expand All @@ -193,8 +225,6 @@ done
cp /home/hd1/test/wpa_supplicant.conf /home/wpa_supplicant.conf


### Init logs
log_init
# Put version informations in logs and a file which will be included in the http server default page
TMP_VERSION_FILE=/tmp/version_information
rm -f ${TMP_VERSION_FILE}
Expand All @@ -216,6 +246,12 @@ case ${FIRMWARE_LETTER} in
HTTP_VERSION='M'
;;

# 1.8.6.1
Q) # Tested :)
RTSP_VERSION='M'
HTTP_VERSION='M'
;;

# 1.8.5.1
M) # Tested :)
RTSP_VERSION='M'
Expand Down Expand Up @@ -247,7 +283,6 @@ log "The RTSP server binary version which will be used is the '${RTSP_VERSION}'"
log "The HTTP server binary version which will be used is the '${HTTP_VERSION}'"



log "Check for some files size..."
ls -l /home/hd1/test/rtspsvr* /home/hd1/test/http/server* | sed "s/^/ /" >> ${LOG_FILE}

Expand All @@ -256,12 +291,16 @@ log "Debug mode = $(get_config DEBUG)"

# first, configure wifi

### Let ppl hear that we start connect wifi
/home/rmm "/home/hd1/test/voice/connectting.g726" 1

log "Check for wifi configuration file...*"
log $(find /home -name "wpa_supplicant.conf")

log "Start wifi configuration..."
log $(/home/wpa_supplicant -B -i ra0 -c /home/wpa_supplicant.conf )
res=$(/home/wpa_supplicant -B -i ra0 -c /home/wpa_supplicant.conf )
log "Status for wifi configuration=$? (0 is ok)"
log "Wifi configuration answer: $res"

log "Do network configuration 1/2 (ip and gateway)"
#ifconfig ra0 192.168.1.121 netmask 255.255.255.0
Expand All @@ -273,14 +312,14 @@ log "Done"
log "Configuration is :"
ifconfig | sed "s/^/ /" >> ${LOG_FILE}

### configure DNS (google one)
### configure DNS
log "Do network configuration 2/2 (DNS)"
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver $(get_config NAMESERVER)" > /etc/resolv.conf
log "Done"

### configure time on a NTP server
### configure time on a NTP server
log "Get time from a NTP server..."
NTP_SERVER=$(get_config NTP_SERVER)
NTP_SERVER=$(get_config NTP_SERVER)
log "But first, test the NTP server '${NTP_SERVER}':"
ping -c1 ${NTP_SERVER} >> ${LOG_FILE}
log "Previous datetime is $(date)"
Expand All @@ -289,6 +328,12 @@ log "Done"
log "New datetime is $(date)"


### Check if reach gateway and notify
ping -c1 -W2 $(get_config GATEWAY) > /dev/null
if [ 0 -eq $? ]; then
/home/rmm "/home/hd1/test/voice/wifi_connected.g726" 1
fi

### set the root password
root_pwd=$(get_config ROOT_PASSWORD)
[ $? -eq 0 ] && echo "root:$root_pwd" | chpasswd
Expand All @@ -297,17 +342,10 @@ root_pwd=$(get_config ROOT_PASSWORD)
log "Start blue led on"
led -yoff -bon


### Rename the timeout sound file to avoid being spammed with chinese audio stuff...
[ -f /home/timeout.g726 ] && mv /home/timeout.g726 /home/timeout.g726.OFF

### Rmm stuff
# without this, most things does not work (http server, rtsp)
# It starts to use the cloud (which is no more launched) so you will find timeout in the logs
cd /home
./rmm &


sync

### Launch FTP server
Expand Down Expand Up @@ -355,23 +393,6 @@ cd /home
./record_event &
./mp4record 60 &

### Launch script to check for motion the last minute
/home/hd1/test/check_motion.sh &

### Rtsp server
cd /home/hd1/test/
log "Start rtsp server : rtspsvr${RTSP_VERSION}..."
if [[ $(get_config DEBUG) == "yes" ]] ; then
./rtspsvr${RTSP_VERSION} > /${LOG_DIR}/log_rtsp.txt 2>&1 &
else
./rtspsvr${RTSP_VERSION} &
fi
sleep 1
log "Check for rtsp process : "
ps | grep rtspsvr | grep -v grep >> ${LOG_FILE}

sleep 5

### Some configuration

himm 0x20050068 0x327c2c
Expand All @@ -395,14 +416,56 @@ himm 0x20030048 0x302

rm /home/hd1/FSCK*

# Check and create crontabs folder
crontab_folder="/var/spool/cron/crontabs"
if [ ! -r "$crontab_folder" ]; then
mkdir -p "$crontab_folder"
fi
# Start crond daemon
/usr/sbin/crond -b

### Final led color

led $(get_config LED_WHEN_READY)
### Check if reach gateway and notify
ping -c1 -W2 $(get_config GATEWAY) > /dev/null
if [ 0 -eq $? ]; then
led $(get_config LED_WHEN_READY)
/home/rmm "/home/hd1/test/voice/success.g726" 1
else
led -boff -yfast
fi

### Rmm stuff
# without this, most things does not work (http server, rtsp)
# It starts to use the cloud (which is no more launched) so you will find timeout in the logs
# This must be launched after all "/home/rmm" command calls
cd /home
./rmm &


### Rtsp server
cd /home/hd1/test/
log "Start rtsp server : rtspsvr${RTSP_VERSION}..."
if [[ $(get_config DEBUG) == "yes" ]] ; then
./rtspsvr${RTSP_VERSION} > /${LOG_DIR}/log_rtsp.txt 2>&1 &
else
./rtspsvr${RTSP_VERSION} &
fi
sleep 1
log "Check for rtsp process : "
ps | grep rtspsvr | grep -v grep >> ${LOG_FILE}

sleep 5


### List the processes after startup
log "Processes after startup :"
ps >> ${LOG_FILE}

### List storage status
log "Storage status :"
df -h >> ${LOG_FILE}

### to make sure log are written...

sync
Expand Down
Binary file added sd/test/voice/bindkey_fail.g726
Binary file not shown.
Binary file added sd/test/voice/connectting.g726
Binary file not shown.
Binary file added sd/test/voice/download_fail.g726
Binary file not shown.
Binary file added sd/test/voice/downloading.g726
Binary file not shown.
Binary file added sd/test/voice/forbidden.g726
Binary file not shown.
Binary file added sd/test/voice/pwdwrong.g726
Binary file not shown.
Binary file added sd/test/voice/reset.g726
Binary file not shown.
Binary file added sd/test/voice/scanok.g726
Binary file not shown.
Binary file added sd/test/voice/start_wait.g726
Binary file not shown.
Binary file added sd/test/voice/success.g726
Binary file not shown.
Binary file added sd/test/voice/support_2d.g726
Binary file not shown.
Binary file added sd/test/voice/updating.g726
Binary file not shown.
Binary file added sd/test/voice/wait.g726
Binary file not shown.
Binary file added sd/test/voice/wait_scan.g726
Binary file not shown.
Binary file added sd/test/voice/welcome.g726
Binary file not shown.
Binary file added sd/test/voice/wifi_connected.g726
Binary file not shown.
1 change: 1 addition & 0 deletions sd/test/yi-hack.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ROOT_PASSWORD=1234qwer
IP=192.168.1.121
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
NAMESERVER=192.168.1.254

### Led color after full boot
# The sequence will be :
Expand Down