add r311 c1 evb init script

This commit is contained in:
wangzijiao 2019-01-08 19:55:49 +08:00
parent 8d682c33b5
commit 0bb64ed8e2
11 changed files with 847 additions and 0 deletions

View File

@ -28,6 +28,11 @@ ifeq ('$(CONFIG_BOARD_HARDWARE_VERSION_R311_PV2)', 'y')
HARDWARE_ALIAS=r311-pv2 HARDWARE_ALIAS=r311-pv2
endif endif
ifeq ('$(CONFIG_BOARD_HARDWARE_VERSION_R311_C1_EVB)', 'y')
HARDWARE_VERSION=r311-c1-evb
HARDWARE_ALIAS=r311-c1-evb
endif
GIT_TAG:=$(shell cd $(TOPDIR) && git describe --tags `git rev-list --tags --max-count=1`) GIT_TAG:=$(shell cd $(TOPDIR) && git describe --tags `git rev-list --tags --max-count=1`)
COMMIT_HASH:=$(shell cd $(TOPDIR) && git rev-parse HEAD 2>/dev/null) COMMIT_HASH:=$(shell cd $(TOPDIR) && git rev-parse HEAD 2>/dev/null)
BUILD_DATE:=$(shell TZ='Asia/Shanghai' date '+%Y-%m-%d_%H:%M:%S') BUILD_DATE:=$(shell TZ='Asia/Shanghai' date '+%Y-%m-%d_%H:%M:%S')

View File

@ -0,0 +1,164 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=120
STOP=120
USE_PROCD=1
DEPEND=netease_wifi_service,netease_voice_service,boot,netease_player_service
PROG_VOICE=/bin/netease_voice
PROG_CC=/usr/sbin/netease_control_center
PROG_PLAYER=/usr/bin/ihwplayer
PROG_LE_APP=/usr/bin/app_nevsps_bt
PROG_WIFI_APP=/bin/app_wifi_manager
PROG_OTA=/usr/bin/ota
PROG_ALARMER=/usr/bin/alarmer
PROG_KPLAYER=/usr/bin/KPlayer
PROG_SPLAYER=/usr/bin/SPlayer
OOM_ADJ=2
LOG=/tmp/netease.init.log
GOROOT=/usr/share/golang/
init_dbus() {
echo "init dbus" >> $LOG
if [ -x /tmp/dbus_env.sh ]
then
DBUS_DAEMON_ON=`ps | grep "dbus-daemon --fork" | grep -v grep | wc -l`
if [ "$DBUS_DAEMON_ON" == "1" ]
then
source /tmp/dbus_env.sh
else
echo "-----------------" >> /mnt/UDISK/reboot.log
date -R >> /mnt/UDISK/reboot.log
reboot -f
fi
else
export $(dbus-launch)
echo "export DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" > /tmp/dbus_env.sh
echo "export DBUS_SESSION_BUS_PID=\"$DBUS_SESSION_BUS_PID\"" >> /tmp/dbus_env.sh
chmod +x /tmp/dbus_env.sh
fi
echo "wzj: DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" >> $LOG
}
start_voice() {
echo "start voice" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_VOICE -D >> /tmp/voicelog 2>&1
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS
procd_close_instance
}
start_cc() {
echo "start cc" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_CC
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS
procd_close_instance
}
start_player() {
echo "start player" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_PLAYER -D
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_wifi() {
echo "start wifi" >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_WIFI_APP -D >> /tmp/wifilog
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_ble() {
echo "start ble" >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_LE_APP -D >> /tmp/blelog
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_ota() {
echo "start ota" >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_OTA -D >> /tmp/otalog
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_alarmer() {
echo "start ota" >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_ALARMER -D >> /tmp/otalog
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_dlna() {
echo "start dlna" >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_KPLAYER -D >> /tmp/dlnalog
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_airplay() {
echo "start airplay" >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_SPLAYER -D >> /tmp/airplaylog
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_all() {
echo "start all" >> $LOG
$PROG_CC > /dev/null 2>&1 &
$PROG_PLAYER -D > /dev/null 2>&1 &
$PROG_VOICE -D > /dev/null 2>&1 &
}
start_service() {
#/etc/bluetooth/btenable.sh on
init_dbus
start_dlna
start_airplay
#start_ble
start_ota
start_alarmer
}

View File

@ -0,0 +1,58 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=110
STOP=110
USE_PROCD=1
DEPEND=boot
PROG_VOICE=/bin/netease_voice
PROG_CC=/usr/sbin/netease_control_center
PROG_PLAYER=/usr/bin/ihwplayer
PROG_BT_APP=/usr/bin/app_nevsps_bt
PROG_WIFI_APP=/bin/app_wifi_manager
PROG_OTA=/usr/bin/ota
PROG_ALARMER=/usr/bin/alarmer
OOM_ADJ=2
LOG=/tmp/netease.init.log
GOROOT=/usr/share/golang/
init_dbus() {
echo "init dbus" >> $LOG
if [ -x /tmp/dbus_env.sh ]
then
DBUS_DAEMON_ON=`ps | grep "dbus-daemon --fork" | grep -v grep | wc -l`
if [ "$DBUS_DAEMON_ON" == "1" ]
then
source /tmp/dbus_env.sh
else
echo "-----------------" >> /mnt/UDISK/reboot.log
date -R >> /mnt/UDISK/reboot.log
reboot -f
fi
else
export $(dbus-launch)
echo "export DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" > /tmp/dbus_env.sh
echo "export DBUS_SESSION_BUS_PID=\"$DBUS_SESSION_BUS_PID\"" >> /tmp/dbus_env.sh
chmod +x /tmp/dbus_env.sh
fi
echo "bt_service: DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" >> $LOG
}
start_bt() {
echo "start bt" >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_BT_APP -D >> /tmp/btlog
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_service() {
init_dbus
start_bt
}

View File

@ -0,0 +1,61 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=121
STOP=121
USE_PROCD=1
DEPEND=netease_wifi_service,netease_voice_service,boot,netease_player_service,netease_service
PROG_VOICE=/bin/netease_voice
PROG_CC=/usr/sbin/netease_control_center
PROG_PLAYER=/usr/bin/ihwplayer
PROG_LE_APP=/usr/bin/app_nevsps_bt
PROG_WIFI_APP=/bin/app_wifi_manager
PROG_OTA=/usr/bin/ota
PROG_ALARMER=/usr/bin/alarmer
PROG_KPLAYER=/usr/bin/KPlayer
PROG_SPLAYER=/usr/bin/SPlayer
OOM_ADJ=2
LOG=/tmp/netease.init.log
GOROOT=/usr/share/golang/
init_dbus() {
echo "init dbus" >> $LOG
if [ -x /tmp/dbus_env.sh ]
then
DBUS_DAEMON_ON=`ps | grep "dbus-daemon --fork" | grep -v grep | wc -l`
if [ "$DBUS_DAEMON_ON" == "1" ]
then
source /tmp/dbus_env.sh
else
echo "-----------------" >> /mnt/UDISK/reboot.log
date -R >> /mnt/UDISK/reboot.log
reboot -f
fi
else
export $(dbus-launch)
echo "export DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" > /tmp/dbus_env.sh
echo "export DBUS_SESSION_BUS_PID=\"$DBUS_SESSION_BUS_PID\"" >> /tmp/dbus_env.sh
chmod +x /tmp/dbus_env.sh
fi
echo "wzj: DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" >> $LOG
}
start_cc() {
echo "start cc" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_CC
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_service() {
init_dbus
start_cc
}

View File

@ -0,0 +1,18 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=60
STOP=60
USE_PROCD=1
LOG=/tmp/netease.init.log
DBUS_SESSION_FILE=/tmp/dbus-session.env
create_dbus_env() {
dbus-daemon --session --print-address >> $DBUS_SESSION_FILE &
sync
}
start_service() {
create_dbus_env
}

View File

@ -0,0 +1,89 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
STOP=121
USE_PROCD=1
PROG_VOICE=/bin/netease_voice
PROG_CC=/usr/sbin/netease_control_center
PROG_PLAYER=/usr/bin/ihwplayer
PROG_LE_APP=/usr/bin/app_nevsps_bt
PROG_WIFI_APP=/bin/app_wifi_manager
PROG_OTA=/usr/bin/ota
PROG_ALARMER=/usr/bin/alarmer
PROG_KPLAYER=/usr/bin/KPlayer
PROG_SPLAYER=/usr/bin/SPlayer
PROG_WIRELESS_TEST=/usr/bin/wirelessTest
PROG_MCU_OTA=/usr/bin/mcu_ota
OOM_ADJ=2
LOG=/tmp/netease.init.log
GOROOT=/usr/share/golang/
init_dbus() {
echo "init dbus" >> $LOG
if [ -x /tmp/dbus_env.sh ]
then
DBUS_DAEMON_ON=`ps | grep "dbus-daemon --fork" | grep -v grep | wc -l`
if [ "$DBUS_DAEMON_ON" == "1" ]
then
source /tmp/dbus_env.sh
else
echo "-----------------" >> /mnt/UDISK/reboot.log
date -R >> /mnt/UDISK/reboot.log
reboot -f
fi
else
export $(dbus-launch)
echo "export DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" > /tmp/dbus_env.sh
echo "export DBUS_SESSION_BUS_PID=\"$DBUS_SESSION_BUS_PID\"" >> /tmp/dbus_env.sh
chmod +x /tmp/dbus_env.sh
fi
echo "wzj: DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" >> $LOG
}
start_cc() {
echo "start cc manufacture mode" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_CC
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS ccmode=manufacture GOROOT=$GOROOT
procd_close_instance
}
start_wirelessTest() {
echo "start cc manufacture mode" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_WIRELESS_TEST
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS ccmode=manufacture GOROOT=$GOROOT
procd_close_instance
}
start_mcu_ota() {
echo "start cc manufacture mode" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_MCU_OTA
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS ccmode=manufacture GOROOT=$GOROOT
procd_close_instance
}
start_service() {
init_dbus
start_cc
}

View File

@ -0,0 +1,89 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
STOP=121
USE_PROCD=1
PROG_VOICE=/bin/netease_voice
PROG_CC=/usr/sbin/netease_control_center
PROG_PLAYER=/usr/bin/ihwplayer
PROG_LE_APP=/usr/bin/app_nevsps_bt
PROG_WIFI_APP=/bin/app_wifi_manager
PROG_OTA=/usr/bin/ota
PROG_ALARMER=/usr/bin/alarmer
PROG_KPLAYER=/usr/bin/KPlayer
PROG_SPLAYER=/usr/bin/SPlayer
PROG_WIRELESS_TEST=/usr/bin/wirelessTest
PROG_MCU_OTA=/usr/bin/mcu_ota
OOM_ADJ=2
LOG=/tmp/netease.init.log
GOROOT=/usr/share/golang/
init_dbus() {
echo "init dbus" >> $LOG
if [ -x /tmp/dbus_env.sh ]
then
DBUS_DAEMON_ON=`ps | grep "dbus-daemon --fork" | grep -v grep | wc -l`
if [ "$DBUS_DAEMON_ON" == "1" ]
then
source /tmp/dbus_env.sh
else
echo "-----------------" >> /mnt/UDISK/reboot.log
date -R >> /mnt/UDISK/reboot.log
reboot -f
fi
else
export $(dbus-launch)
echo "export DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" > /tmp/dbus_env.sh
echo "export DBUS_SESSION_BUS_PID=\"$DBUS_SESSION_BUS_PID\"" >> /tmp/dbus_env.sh
chmod +x /tmp/dbus_env.sh
fi
echo "wzj: DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" >> $LOG
}
start_cc() {
echo "start cc manufacture mode" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_CC
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS ccmode=manufacture GOROOT=$GOROOT
procd_close_instance
}
start_wirelessTest() {
echo "start cc manufacture mode" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_WIRELESS_TEST
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS ccmode=manufacture GOROOT=$GOROOT
procd_close_instance
}
start_mcu_ota() {
echo "start cc manufacture mode" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_MCU_OTA
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS ccmode=manufacture GOROOT=$GOROOT
procd_close_instance
}
start_service() {
init_dbus
start_mcu_ota
}

View File

@ -0,0 +1,89 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
STOP=121
USE_PROCD=1
PROG_VOICE=/bin/netease_voice
PROG_CC=/usr/sbin/netease_control_center
PROG_PLAYER=/usr/bin/ihwplayer
PROG_LE_APP=/usr/bin/app_nevsps_bt
PROG_WIFI_APP=/bin/app_wifi_manager
PROG_OTA=/usr/bin/ota
PROG_ALARMER=/usr/bin/alarmer
PROG_KPLAYER=/usr/bin/KPlayer
PROG_SPLAYER=/usr/bin/SPlayer
PROG_WIRELESS_TEST=/usr/bin/wirelessTest
PROG_MCU_OTA=/usr/bin/mcu_ota
OOM_ADJ=2
LOG=/tmp/netease.init.log
GOROOT=/usr/share/golang/
init_dbus() {
echo "init dbus" >> $LOG
if [ -x /tmp/dbus_env.sh ]
then
DBUS_DAEMON_ON=`ps | grep "dbus-daemon --fork" | grep -v grep | wc -l`
if [ "$DBUS_DAEMON_ON" == "1" ]
then
source /tmp/dbus_env.sh
else
echo "-----------------" >> /mnt/UDISK/reboot.log
date -R >> /mnt/UDISK/reboot.log
reboot -f
fi
else
export $(dbus-launch)
echo "export DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" > /tmp/dbus_env.sh
echo "export DBUS_SESSION_BUS_PID=\"$DBUS_SESSION_BUS_PID\"" >> /tmp/dbus_env.sh
chmod +x /tmp/dbus_env.sh
fi
echo "wzj: DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" >> $LOG
}
start_cc() {
echo "start cc manufacture mode" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_CC
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS ccmode=manufacture GOROOT=$GOROOT
procd_close_instance
}
start_wirelessTest() {
echo "start cc manufacture mode" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_WIRELESS_TEST
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS ccmode=manufacture GOROOT=$GOROOT
procd_close_instance
}
start_mcu_ota() {
echo "start cc manufacture mode" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_MCU_OTA
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS ccmode=manufacture GOROOT=$GOROOT
procd_close_instance
}
start_service() {
init_dbus
start_wirelessTest
}

View File

@ -0,0 +1,151 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=110
STOP=110
USE_PROCD=1
DEPEND=netease_voice_service,boot
PROG_VOICE=/bin/netease_voice
PROG_CC=/usr/sbin/netease_control_center
PROG_PLAYER=/usr/bin/ihwplayer
PROG_LE_APP=/usr/bin/app_nevsps
PROG_WIFI_APP=/bin/app_wifi_manager
PROG_OTA=/usr/bin/ota
PROG_ALARMER=/usr/bin/alarmer
PROG_KPLAYER=/usr/bin/KPlayer
OOM_ADJ=2
LOG=/tmp/netease.init.log
GOROOT=/usr/share/golang/
init_dbus() {
echo "init dbus" >> $LOG
if [ -x /tmp/dbus_env.sh ]
then
DBUS_DAEMON_ON=`ps | grep "dbus-daemon --fork" | grep -v grep | wc -l`
if [ "$DBUS_DAEMON_ON" == "1" ]
then
source /tmp/dbus_env.sh
else
echo "-----------------" >> /mnt/UDISK/reboot.log
date -R >> /mnt/UDISK/reboot.log
reboot -f
fi
else
export $(dbus-launch)
echo "export DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" > /tmp/dbus_env.sh
echo "export DBUS_SESSION_BUS_PID=\"$DBUS_SESSION_BUS_PID\"" >> /tmp/dbus_env.sh
chmod +x /tmp/dbus_env.sh
fi
echo "wzj: DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" >> $LOG
}
enable_soundcard() {
echo "set r311 audio pass through"
amixer cset iface=MIXER,name='DACR Mixer AIF1DA0R Switch' 1
amixer cset iface=MIXER,name='DACL Mixer AIF1DA0L Switch' 1
amixer cset iface=MIXER,name='Headphone Switch' 1
echo 4 > /sys/netease/cpld_control/cpld_init
adau1761 2 0
adau1761 0 8
}
start_voice() {
echo "start voice" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_VOICE -D >> /tmp/voicelog 2>&1
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS
procd_close_instance
}
start_cc() {
echo "start cc" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_CC
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS
procd_close_instance
}
start_player() {
echo "start player" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_PLAYER -D
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_wifi() {
echo "start wifi" >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_WIFI_APP -D >> /tmp/wifilog
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_ble() {
echo "start ble" >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_LE_APP -D >> /tmp/blelog
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_ota() {
echo "start ota" >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_OTA -D >> /tmp/otalog
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_alarmer() {
echo "start ota" >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_ALARMER -D >> /tmp/otalog
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_dlna() {
echo "start dlna" >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_KPLAYER -D >> /tmp/dlnalog
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_service() {
enable_soundcard
init_dbus
start_player
}

View File

@ -0,0 +1,65 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=109
STOP=109
USE_PROCD=1
DEPEND=boot
PROG_VOICE=/bin/netease_voice
PROG_CC=/usr/sbin/netease_control_center
PROG_PLAYER=/usr/bin/ihwplayer
PROG_LE_APP=/usr/bin/app_nevsps
PROG_WIFI_APP=/bin/app_wifi_manager
PROG_OTA=/usr/bin/ota
PROG_ALARMER=/usr/bin/alarmer
PROG_KPLAYER=/usr/bin/KPlayer
OOM_ADJ=2
LOG=/tmp/netease.init.log
GOROOT=/usr/share/golang/
init_dbus() {
echo "init dbus" >> $LOG
if [ -x /tmp/dbus_env.sh ]
then
DBUS_DAEMON_ON=`ps | grep "dbus-daemon --fork" | grep -v grep | wc -l`
if [ "$DBUS_DAEMON_ON" == "1" ]
then
source /tmp/dbus_env.sh
else
echo "-----------------" >> /mnt/UDISK/reboot.log
date -R >> /mnt/UDISK/reboot.log
reboot -f
fi
else
export $(dbus-launch)
echo "export DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" > /tmp/dbus_env.sh
echo "export DBUS_SESSION_BUS_PID=\"$DBUS_SESSION_BUS_PID\"" >> /tmp/dbus_env.sh
chmod +x /tmp/dbus_env.sh
fi
echo "netease_voice: DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" >> $LOG
}
start_voice() {
echo "start voice" >> $LOG
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_VOICE --work-mode=1
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS --work-mode=0
procd_close_instance
}
start_adc() {
echo 1 > /sys/netease/cpld_control/cpld_init
}
start_service() {
init_dbus
start_adc
start_voice
}

View File

@ -0,0 +1,58 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=110
STOP=110
USE_PROCD=1
DEPEND=boot
PROG_VOICE=/bin/netease_voice
PROG_CC=/usr/sbin/netease_control_center
PROG_PLAYER=/usr/bin/ihwplayer
PROG_LE_APP=/usr/bin/app_nevsps
PROG_WIFI_APP=/bin/app_wifi_manager
PROG_OTA=/usr/bin/ota
PROG_ALARMER=/usr/bin/alarmer
OOM_ADJ=2
LOG=/tmp/netease.init.log
GOROOT=/usr/share/golang/
init_dbus() {
echo "init dbus" >> $LOG
if [ -x /tmp/dbus_env.sh ]
then
DBUS_DAEMON_ON=`ps | grep "dbus-daemon --fork" | grep -v grep | wc -l`
if [ "$DBUS_DAEMON_ON" == "1" ]
then
source /tmp/dbus_env.sh
else
echo "-----------------" >> /mnt/UDISK/reboot.log
date -R >> /mnt/UDISK/reboot.log
reboot -f
fi
else
export $(dbus-launch)
echo "export DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" > /tmp/dbus_env.sh
echo "export DBUS_SESSION_BUS_PID=\"$DBUS_SESSION_BUS_PID\"" >> /tmp/dbus_env.sh
chmod +x /tmp/dbus_env.sh
fi
echo "wifi_service: DBUS_SESSION_BUS_ADDRESS=\"$DBUS_SESSION_BUS_ADDRESS\"" >> $LOG
}
start_wifi() {
echo "start wifi" >> $LOG
procd_open_instance
procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_WIFI_APP -D >> /tmp/wifilog
procd_set_param respawn
procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS GOROOT=$GOROOT
procd_close_instance
}
start_service() {
init_dbus
start_wifi
}