1
0
mirror of https://github.com/fritz-smh/yi-hack synced 2025-06-07 16:06:11 +00:00

Voice notification, crond, led flash for error, log storage status

Add voice notification in English
Launch crond daemon be default
Check wifi connection status before ending:
    Cannot reach gateway: flash yellow led
    Normal: notification on English and led as configuraion
Log storage status by "df -h" to log file
Minor bug fix
Strip trainling spaces
This commit is contained in:
Tuan Minh Dang 2016-09-04 16:41:52 +07:00
parent cddc53daed
commit 7cb39f8da2
17 changed files with 102 additions and 69 deletions

View File

@ -26,7 +26,6 @@
# * strem audio from network to camera ==> svoxpico ?
# * create a watchdog script
led() {
# example usage :
# led -boff -yon
@ -83,6 +82,7 @@ telnetd &
### configure timezone
echo "$(get_config TIMEZONE)" > /etc/TZ
### get time is done after wifi configuration!
@ -113,6 +113,10 @@ cd /home/3518
# added :
himm 0x20050074 0x06802424
### Let ppl hear that we start
/home/rmm "/home/hd1/voice/welcome.g726" 1
/home/rmm "/home/hd1/voice/wait.g726" 1
### start blinking blue led for configuration in progress
#/home/led_ctl -boff -yon &
led -yoff -bfast
@ -256,12 +260,16 @@ log "Debug mode = $(get_config DEBUG)"
# first, configure wifi
### Let ppl hear that we start connect wifi
/home/rmm "/home/hd1/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
@ -289,6 +297,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/voice/wifi_connected.g726" 1
fi
### set the root password
root_pwd=$(get_config ROOT_PASSWORD)
[ $? -eq 0 ] && echo "root:$root_pwd" | chpasswd
@ -301,13 +315,6 @@ 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
@ -355,22 +362,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
@ -395,14 +386,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/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

BIN
sd/test/voice/bindkey_fail.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/connectting.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/download_fail.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/downloading.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/forbidden.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/pwdwrong.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/reset.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/scanok.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/start_wait.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/success.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/support_2d.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/updating.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/wait.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/wait_scan.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/welcome.g726 Executable file

Binary file not shown.

BIN
sd/test/voice/wifi_connected.g726 Executable file

Binary file not shown.