add initscript && cc, change cc

This commit is contained in:
wangzijiao 2018-09-12 17:28:29 +08:00
parent bec7c508da
commit 353291e764
32 changed files with 997 additions and 61 deletions

View File

@ -1,4 +0,0 @@
LIB_BUILD_COMMON_LIB := -ldbus-1 -luv -lcrypto -lcjson -luvdbus -lsqlite3 -ls2json -lpthread -lcurl -lz -lquickmail -luuid -lconfig
LIB_MAKE_COMMON_DEPEND := +uthash +dbus +libuv +libpthread +libs2json +libcjson +libsqlite3 +libopenssl +libcurl +libquickmail +libz +libuuid +libconfig +libcutils
BUILD_COMMON_LIB := $(LIB_BUILD_COMMON_LIB) -luvdbus
MAKE_COMMON_DEPEND := $(LIB_MAKE_COMMON_DEPEND) +libuvdbus

30
Makefile.common.submodule Normal file
View File

@ -0,0 +1,30 @@
# r16-pv1
HARDWARE_VERSION:=DVT
HARDWARE_ALIAS:=r16-pv1
ifeq ('$(CONFIG_BOARD_HARDWARE_VERSION_DVT)', 'y')
HARDWARE_VERSION=DVT
HARDWARE_ALIAS=r16-pv1
endif
ifeq ('$(CONFIG_BOARD_HARDWARE_VERSION_EVT)', 'y')
HARDWARE_VERSION=EVT
HARDWARE_ALIAS=r16-pv1
endif
ifeq ('$(CONFIG_BOARD_HARDWARE_VERSION_R311_PV1)', 'y')
HARDWARE_VERSION=r311-pv1
HARDWARE_ALIAS=r311-pv1
endif
ifeq ('$(CONFIG_BOARD_HARDWARE_VERSION_R311_PV2)', 'y')
HARDWARE_VERSION=r311-pv2
HARDWARE_ALIAS=r311-pv2
endif
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)
BUILD_DATE:=$(shell TZ='Asia/Shanghai' date '+%Y-%m-%d_%H:%M:%S')
$(info HARDWARE_VERSION: $(HARDWARE_VERSION) HARDWARE_ALIAS: $(HARDWARE_ALIAS) GIT_TAG: $(GIT_TAG) BUILD_DATE:$(BUILD_DATE) COMMIT_HASH:$(COMMIT_HASH))

54
app/InitScript/Makefile Normal file
View File

@ -0,0 +1,54 @@
include $(TOPDIR)/rules.mk
include $(TINA_BUILD_TOP)/package/netease/submodules/Makefile.common.submodule
# Name and release number of this package
PKG_NAME:=NeteaseInitScript
PKG_VERSION:=1
PKG_BUILD_DIR:=$(COMPILE_DIR)/$(PKG_NAME)
include $(BUILD_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Netease
TITLE:=Netease init script
endef
define Package/$(PKG_NAME)/description
Netease app start up scripts!
endef
define Build/Prepare
endef
define Build/Configure
endef
define Build/Compile
endef
define Build/InstallDev
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/usr/share/golang
$(INSTALL_DIR) $(1)/usr/share/golang/mcu
$(INSTALL_DIR) $(1)/etc/ssl/certs
$(INSTALL_BIN) ./common/backuplocalfiles.sh $(1)/usr/sbin/
$(INSTALL_BIN) ./$(HARDWARE_ALIAS)/netease.init $(1)/etc/init.d/netease_services
$(INSTALL_BIN) ./$(HARDWARE_ALIAS)/neteasewifi.init $(1)/etc/init.d/netease_wifi_service
$(INSTALL_BIN) ./$(HARDWARE_ALIAS)/neteasevoice.init $(1)/etc/init.d/netease_voice_service
$(INSTALL_BIN) ./$(HARDWARE_ALIAS)/neteaseplayer.init $(1)/etc/init.d/netease_player_service
$(INSTALL_BIN) ./$(HARDWARE_ALIAS)/neteasemanufacture_cc.init $(1)/etc/init.d/netease_cc_manufacture_service
$(INSTALL_BIN) ./$(HARDWARE_ALIAS)/neteasemanufacture_mcu.init $(1)/etc/init.d/netease_mcu_manufacture_service
$(INSTALL_BIN) ./$(HARDWARE_ALIAS)/neteasemanufacture_rf.init $(1)/etc/init.d/netease_rf_manufacture_service
$(INSTALL_BIN) ./$(HARDWARE_ALIAS)/neteasecc.init $(1)/etc/init.d/netease_cc_service
$(INSTALL_BIN) ./$(HARDWARE_ALIAS)/neteasebt.init $(1)/etc/init.d/netease_bt_service
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

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 numid=20 1
amixer cset numid=46 1
amixer cset numid=50 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,60 @@
#!/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 -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 --work-mode=0
procd_close_instance
}
start_service() {
init_dbus
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
}

View File

@ -1,31 +1,14 @@
include $(TOPDIR)/rules.mk
include $(TINA_BUILD_TOP)/package/netease/submodules/Makefile.common.submodule
PKG_NAME:=submodule_netease_control_center
PKG_NAME:=netease_control_center
PKG_RELEASE:=2
PKG_VERSION:=0.0.2
COMMIT_HASH:=$(shell git rev-parse HEAD 2>/dev/null)
BUILD_DATE:=$(shell TZ='Asia/Shanghai' date '+%Y-%m-%d_%H:%M:%S')
GIT_TAG:=$(shell git describe --tags `git rev-list --tags --max-count=1`)
PKG_BUILD_DIR := $(COMPILE_DIR)/$(PKG_NAME)
HARDWARE_VERSION:=DVT
include $(BUILD_DIR)/package.mk
ifeq ('$(CONFIG_BOARD_HARDWARE_VERSION_DVT)', 'y')
HARDWARE_VERSION=DVT
else
ifeq ('$(CONFIG_BOARD_HARDWARE_VERSION_EVT)', 'y')
HARDWARE_VERSION=EVT
else
HARDWARE_VERSION=NA
endif
endif
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Netease
@ -59,7 +42,7 @@ define Build/Compile
CXX="$(TARGET_CXX)" \
CGO_CFLAGS="$(TARGET_CFLAGS) -I$(CONFIG_TOOLCHAIN_ROOT)/include -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
CGO_LDFLAGS="$(TARGET_LDFLAGS)" \
GOPATH=$(PKG_BUILD_DIR) GOOS=linux GOARCH=arm CGO_ENABLED=1 go build -tags "netcgo json1" \
GOPATH=$(PKG_BUILD_DIR) GOOS=linux GOARCH=arm CGO_ENABLED=1 go build --tags "netcgo sqlite_json sqlite_trace" \
-ldflags "-X \"main.Hv=$(HARDWARE_VERSION)\" -X \"main.BuildVersion=$(COMMIT_HASH)\" -X \"main.BuildDate=$(BUILD_DATE)\" -X \"main.Tag=$(GIT_TAG)\""
cd $(PKG_BUILD_DIR)/src/$(PKG_NAME)/modules/hardware/mcu_leds && \
@ -85,19 +68,10 @@ define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/share/golang
$(INSTALL_DIR) $(1)/usr/share/golang/mcu
$(INSTALL_DIR) $(1)/etc/ssl/certs
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/$(PKG_NAME)/$(PKG_NAME) $(1)/usr/sbin/
$(INSTALL_BIN) ./backuplocalfiles.sh $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/$(PKG_NAME)/modules/hardware/mcu_leds/mcu_ota $(TOPDIR)/prebuilt/r16/
# $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/$(PKG_NAME)/modules/hardware/mcu_leds/mcu_ota $(TOPDIR)/prebuilt/r16/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/$(PKG_NAME)/nembd/evdev/bin/netease_keytest $(1)/usr/sbin/
$(INSTALL_BIN) ./netease.init $(1)/etc/init.d/netease_services
$(INSTALL_BIN) ./neteasewifi.init $(1)/etc/init.d/netease_wifi_service
$(INSTALL_BIN) ./neteasevoice.init $(1)/etc/init.d/netease_voice_service
$(INSTALL_BIN) ./neteaseplayer.init $(1)/etc/init.d/netease_player_service
$(INSTALL_BIN) ./neteasemanufacture_cc.init $(1)/etc/init.d/netease_cc_manufacture_service
$(INSTALL_BIN) ./neteasemanufacture_mcu.init $(1)/etc/init.d/netease_mcu_manufacture_service
$(INSTALL_BIN) ./neteasemanufacture_rf.init $(1)/etc/init.d/netease_rf_manufacture_service
$(INSTALL_BIN) ./neteasecc.init $(1)/etc/init.d/netease_cc_service
$(INSTALL_BIN) ./neteasebt.init $(1)/etc/init.d/netease_bt_service
$(INSTALL_DATA) mcu/* $(1)/usr/share/golang/mcu/
$(INSTALL_DATA) vol_adc.config $(1)/usr/share/golang/
# $(INSTALL_DATA) ./ca-certificates.crt $(1)/etc/ssl/certs/

View File

@ -0,0 +1,30 @@
package globals
type PlatformConfig struct {
MicAdc bool
}
var (
platformConfigs = map[string]PlatformConfig{
"default": PlatformConfig{MicAdc:false},
"EVT":PlatformConfig{MicAdc:true},
"r311-pv1":PlatformConfig{MicAdc:false},
}
curPlatformConfig *PlatformConfig
)
func GetCurPlatformConfig() PlatformConfig {
if curPlatformConfig != nil {
return *curPlatformConfig
}
if Hv == nil {
return platformConfigs["default"]
}
if tmp,ok := platformConfigs[*Hv]; ok {
curPlatformConfig = &tmp
return tmp
} else {
return platformConfigs["default"]
}
}

View File

@ -51,7 +51,7 @@ func EpRecord(eventId string, args map[string]interface{}) {
log.Println(log.ErrorLog, err)
}
}()
return
var tmp EventPoint
tmp.Base = http.Reqbase
args["event"] = eventId

View File

@ -19,12 +19,15 @@ import (
)
func Init() {
return
log.Println(log.DebugLog, "Begin init skin!")
C.SkinInit()
log.Println(log.DebugLog, "Init skin end!")
}
func GetSkinRes(key string) (path string) {
return
jump := time.Now()
defer func() {
log.Println(log.DebugLog, "Get skin key:", key, " val:", path, " coast time:", time.Now().Sub(jump))
@ -45,6 +48,8 @@ func GetSkinRes(key string) (path string) {
}
func UpdateRes(jsonStr string) {
return
cjsonstring := C.CString(jsonStr)
if uintptr(unsafe.Pointer(cjsonstring)) != uintptr(0) {
log.Println(log.DebugLog, "Begin update res!")
@ -54,6 +59,8 @@ func UpdateRes(jsonStr string) {
}
func UpdateResFromServer() {
return
log.Println(log.DebugLog, "Begin to update res from server!")
var req http.HttpReqHotfix
var rsp http.HttpRspHotfix

View File

@ -9,6 +9,7 @@ import (
"os"
"sync/atomic"
"time"
"netease_control_center/globals"
)
var (
@ -86,6 +87,7 @@ func adauMute(isMute bool) {
func VolTrigeMicAdc() {
adauMute(false)
vol, _ := adau1761.GetVol()
if globals.GetCurPlatformConfig().MicAdc == true {
if (lasttrigvol >= -1 && lasttrigvol <= 12 && vol <= 12) || (lasttrigvol == vol) {
lasttrigvol = vol
return
@ -99,9 +101,12 @@ func VolTrigeMicAdc() {
log.Println(log.ErrorLog, "Can not find vol adc regs:", vol)
}
}
}
func IdleMicAdc() {
adauMute(true)
if globals.GetCurPlatformConfig().MicAdc == true {
if lasttrigvol >= -1 && lasttrigvol <= 12 {
return
} else {
@ -113,3 +118,4 @@ func IdleMicAdc() {
adcval.Write2Adc()
}
}

View File

@ -12,7 +12,7 @@ import (
)
const (
DB_PATH = "/mnt/UDISK/golangsql.db"
DB_PATH = "file:/mnt/UDISK/golangsql.db?cache=shared&mode=memory"
SQLTABLENAME_CONFIG = "config"
SQLFMT_CREATE_CONFIG = `CREATE TABLE IF NOT EXISTS ` + SQLTABLENAME_CONFIG + ` (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
@ -60,6 +60,7 @@ func sqlInit() error {
log.Println(log.ErrorLog, "db open fail", err)
return err
} else {
db.SetMaxOpenConns(1)
log.Println(log.DebugLog, "Init sqlite success!")
initDriver = true
}
@ -68,7 +69,7 @@ func sqlInit() error {
if initTable == false {
rst, err := db.Exec(SQLFMT_CREATE_CONFIG)
if err != nil {
fmt.Println("Create table err", err)
log.Println(log.ErrorLog, "Create table err ", SQLFMT_CREATE_CONFIG, err)
return err
}
//fmt.Println(SQLFMT_CREATE_CONFIG)

View File

@ -133,6 +133,7 @@ func DecVol(step int) (int, error) {
}
func setEq(eq int) (err error) {
return
fd, err := os.Open(devpath)
if err != nil {
return err

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
include $(TINA_BUILD_TOP)/package/netease/Makefile.common
PKG_NAME:=submodule_netease_voice
PKG_NAME:=netease_voice
PKG_RELEASE:=1
PKG_VERSION:=0.0.1
@ -19,7 +19,7 @@ $(info CONFIG_USED_DC_SDK=$(CONFIG_USED_DC_SDK))
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Netease
TITLE:=Netease voice main program
TITLE:=Netease voice main program in submodule
MAINTAINER:=Wang zijiao <hzwangzijiao@corp.netease.com>
DEPENDS:= +libduilite +libjansson +libspeex +alsa-lib +libuws +libjson-c +libyunxin +libcutils $(MAKE_COMMON_DEPEND)