Merge branch 'master' of ssh://g.hz.netease.com:22222/IoT/midware
This commit is contained in:
commit
654b257b51
|
@ -0,0 +1,27 @@
|
|||
/include
|
||||
out
|
||||
.config
|
||||
tmp
|
||||
build
|
||||
!/build
|
||||
.config.old
|
||||
build/libuv-v1.11.0/
|
||||
.orig
|
||||
/logs
|
||||
*.orig
|
||||
.vscode
|
||||
.idea
|
||||
cmake-build-debug
|
||||
build/portaudio-190600_20161030/
|
||||
build/portaudio/
|
||||
build/sqlite-autoconf-3190200/
|
||||
build/sqlite-autoconf-3190300/
|
||||
build/ca-certificates
|
||||
lichee/linux-4.9/user_headers/
|
||||
.DS_Store
|
||||
._.DS_Store
|
||||
prebuilt/r311/mcu_ota
|
||||
prebuilt/r311/fw_bcm43436b0.bin
|
||||
prebuilt/r311/wl
|
||||
*.code-workspace
|
||||
*.si4project
|
|
@ -18,6 +18,11 @@ ifeq ('$(CONFIG_BOARD_HARDWARE_VERSION_R311_PV1)', 'y')
|
|||
HARDWARE_ALIAS=r311-pv1
|
||||
endif
|
||||
|
||||
ifeq ('$(CONFIG_BOARD_HARDWARE_VERSION_R311_PV1_CES)', 'y')
|
||||
HARDWARE_VERSION=r311-pv1c
|
||||
HARDWARE_ALIAS=r311-pv1c
|
||||
endif
|
||||
|
||||
ifeq ('$(CONFIG_BOARD_HARDWARE_VERSION_R311_PV2)', 'y')
|
||||
HARDWARE_VERSION=r311-pv2
|
||||
HARDWARE_ALIAS=r311-pv2
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -14,7 +14,7 @@ define Package/$(PKG_NAME)
|
|||
CATEGORY:=Netease
|
||||
TITLE:=Netease control center submodule
|
||||
MAINTAINER:=Wang zijiao <hzwangzijiao@corp.netease.com>
|
||||
DEPENDS:=+libpthread +libspeex +alsa-lib +wifimanager +bluetooth +softap +libuvdbus +libuuid +libcutils +libcjson +libs2json
|
||||
DEPENDS:=+libpthread +libspeex +alsa-lib +wifimanager +bluetooth +softap +libuvdbus +libuuid +libcutils +libcjson +libs2json +libiconv-full
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
|
|
|
@ -40,6 +40,7 @@ var (
|
|||
GitTag *string
|
||||
StartTime time.Time
|
||||
Hv *string
|
||||
ActualHv *string
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -3,14 +3,18 @@ package globals
|
|||
import "netease_control_center/interfaces/log"
|
||||
|
||||
type PlatformConfig struct {
|
||||
IconSwitch bool
|
||||
TopLight bool
|
||||
MicAdc bool
|
||||
LedMcuInit bool
|
||||
InputKeyPath string
|
||||
}
|
||||
var (
|
||||
platformConfigs = map[string]PlatformConfig{
|
||||
"default": PlatformConfig{MicAdc:false, InputKeyPath:"/dev/input/event2"},
|
||||
"EVT":PlatformConfig{MicAdc:true, InputKeyPath:"/dev/input/event2"},
|
||||
"r311-pv1":PlatformConfig{MicAdc:false, InputKeyPath:"/dev/input/event1"},
|
||||
"default": PlatformConfig{MicAdc:false, LedMcuInit:true,IconSwitch:true, TopLight:true, InputKeyPath:"/dev/input/event2"},
|
||||
"EVT":PlatformConfig{MicAdc:true,LedMcuInit:true,IconSwitch:true, TopLight:true, InputKeyPath:"/dev/input/event2"},
|
||||
"r311-pv1":PlatformConfig{MicAdc:false, LedMcuInit:true, IconSwitch:true, TopLight:true, InputKeyPath:"/dev/input/event1"},
|
||||
"r311-pv1c":PlatformConfig{MicAdc:true, LedMcuInit:false, IconSwitch:false, TopLight:false, InputKeyPath:"/dev/input/event1"},
|
||||
}
|
||||
curPlatformConfig *PlatformConfig
|
||||
)
|
||||
|
@ -20,16 +24,16 @@ func GetCurPlatformConfig() PlatformConfig {
|
|||
return *curPlatformConfig
|
||||
}
|
||||
|
||||
if Hv == nil {
|
||||
if ActualHv == nil {
|
||||
log.Println(log.ErrorLog, "Can not get the right platform, hv is nil!")
|
||||
return platformConfigs["default"]
|
||||
}
|
||||
|
||||
queryString := *Hv
|
||||
queryString := *ActualHv
|
||||
if queryString == "DVT" {
|
||||
queryString = "EVT"
|
||||
}
|
||||
if tmp,ok := platformConfigs[*Hv]; ok {
|
||||
if tmp,ok := platformConfigs[*ActualHv]; ok {
|
||||
curPlatformConfig = &tmp
|
||||
return tmp
|
||||
} else {
|
||||
|
|
|
@ -3,6 +3,7 @@ package vui
|
|||
import (
|
||||
"netease_control_center/interfaces/vui/cvui"
|
||||
"time"
|
||||
"netease_control_center/globals"
|
||||
)
|
||||
|
||||
type IconLedDesc struct {
|
||||
|
@ -17,7 +18,9 @@ func (this *IconLedDesc) GetPath() string {
|
|||
return cvui.GetSkinRes(this.Name)
|
||||
}
|
||||
func (this IconLedDesc) Show() {
|
||||
ShowIcon(this)
|
||||
if globals.GetCurPlatformConfig().IconSwitch == true {
|
||||
ShowIcon(this)
|
||||
}
|
||||
}
|
||||
|
||||
func (this IconLedDesc) Clear() {
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"netease_control_center/modules"
|
||||
"os"
|
||||
"time"
|
||||
"netease_control_center/nembd/Init"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -15,6 +16,7 @@ var (
|
|||
BuildVersion string
|
||||
Tag string
|
||||
Hv string
|
||||
ActualHv string
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -29,6 +31,14 @@ func main() {
|
|||
globals.BuildDate = BuildDate
|
||||
globals.GitTag = &Tag
|
||||
globals.Hv = &Hv
|
||||
ActualHv = Hv
|
||||
globals.ActualHv = &ActualHv
|
||||
|
||||
if Hv == "r311-pv1c" {
|
||||
Hv = "EVT"
|
||||
globals.GitTag = new(string)
|
||||
*globals.GitTag = "1.1.19"
|
||||
}
|
||||
|
||||
log.Println(log.DebugLog, "BuildVersion: ", globals.BuildVersion)
|
||||
log.Println(log.DebugLog, "BuildTime: ", globals.BuildDate)
|
||||
|
@ -40,6 +50,7 @@ func main() {
|
|||
select {}
|
||||
}
|
||||
|
||||
Init.InitBoard(ActualHv)
|
||||
http.HttpInit()
|
||||
modules.Init()
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"netease_control_center/modules/hardware/mcu_leds/atservice"
|
||||
"sync"
|
||||
"time"
|
||||
"netease_control_center/nembd"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -119,6 +120,17 @@ func SetMicClose(isMicClose bool, who globals.WhoCLoseMic, lock bool) {
|
|||
globals.IsMicClose = isMicClose
|
||||
MicLightSwitch(isMicClose, false)
|
||||
globals.MicCloseTrig = who
|
||||
|
||||
switch nembd.Host(*globals.ActualHv) {
|
||||
case nembd.HostPv1C:
|
||||
if isMicClose {
|
||||
nembd.DigitalWrite("G", nembd.High)
|
||||
nembd.DigitalWrite("B", nembd.High)
|
||||
} else {
|
||||
nembd.DigitalWrite("G", nembd.Low)
|
||||
nembd.DigitalWrite("B", nembd.Low)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func MicLightSwitch(on bool, lock bool) {
|
||||
|
|
|
@ -319,7 +319,9 @@ func StartBoardRoutine() {
|
|||
<-playstopch
|
||||
}
|
||||
|
||||
led_mcu.McuResetInitStatus()
|
||||
if GetCurPlatformConfig().LedMcuInit == true {
|
||||
led_mcu.McuResetInitStatus()
|
||||
}
|
||||
|
||||
if NewBoard == false {
|
||||
StartBackground_wificheck()
|
||||
|
|
|
@ -216,9 +216,40 @@ func KeyResponse(keycode int, pressedTimes uint8, longpress bool, insistTime tim
|
|||
} else {
|
||||
switch pressedTimes {
|
||||
case 1:
|
||||
VboxTagTestSongSimilar()
|
||||
if globals.CurBootState == globals.BootStage_WIFIPARING || globals.CurBootState == globals.BootStage_BACKUPSYSTEM_WIFIPARING {
|
||||
schedule.SendSCmd(schedule.SCMD_SuperTask_System_WifiModeChange_AP_BT)
|
||||
eventPoint.EpRecord("H411", map[string]interface{}{"pressedTimes": pressedTimes, "pressedtime": insistTime.Nanoseconds() / 1e6, "net": true, "status": "ap/ble wifi paring", "longpress": longpress})
|
||||
} else {
|
||||
if schedule.CheckTaskActive(schedule.TaskLevel_SystemService) == false {
|
||||
log.Println(log.ErrorLog, "come into mic control!!!")
|
||||
player.SoundEffectPlayCmd(globals.CMD_SE_PLAY, vui.SoundNotice_Scaozuofankui001.GetPath())
|
||||
if globals.IsMicClose == true {
|
||||
//globals.CurVboxVolSt.MuteMic = false
|
||||
|
||||
SetMicClose(false, globals.WhoCLoseMic_User, true)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
player.SoundEffectPlayCmd(globals.CMD_SE_PLAY, vui.SoundNotice_Mic_Open.GetPath())
|
||||
} else {
|
||||
//globals.CurVboxVolSt.MuteMic = true
|
||||
|
||||
SetMicClose(true, globals.WhoCLoseMic_User, true)
|
||||
if GetCurVoiceStatus() != globals.VoiceStatus_IDLE {
|
||||
VoiceEndSession()
|
||||
UpdateVoiceStatus(globals.VoiceStatus_IDLE)
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
player.SoundEffectPlayCmd(globals.CMD_SE_PLAY, vui.SoundNotice_Mic_Close.GetPath())
|
||||
}
|
||||
eventPoint.EpRecord("H111", map[string]interface{}{"pressedtime": insistTime.Nanoseconds() / 1e6, "status": globals.IsMicClose, "net": false})
|
||||
} else {
|
||||
log.Println(log.DebugLog, "Currently s task run, ignore mic disable command!")
|
||||
eventPoint.EpRecord("H411", map[string]interface{}{"pressedTimes": pressedTimes, "status": "do nothing", "pressedtime": insistTime.Nanoseconds() / 1e6, "net": (globals.CurBootState == globals.BootStage_WIFIPARING), "longpress": longpress})
|
||||
}
|
||||
}
|
||||
schedule.SendSCmd(schedule.SCMD_KeyInterrupt)
|
||||
//VboxTagTestSongSimilar()
|
||||
case 2:
|
||||
VboxCardTestTag()
|
||||
//VboxCardTestTag()
|
||||
//CopyLogfiles()
|
||||
//schedule.PlayNoticeAsync(globals.AdSrcType_TTS, "日志已保存", globals.CONST_AUDIO_ID, false, nil, nil)
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
"time"
|
||||
"netease_control_center/interfaces/cserveraddr"
|
||||
"netease_control_center/modules/storage"
|
||||
"netease_control_center/nembd"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -37,6 +38,11 @@ func MscToastLed_Before() {
|
|||
tmp := DirectLed{EffectId: atservice.GUIDE_EFFECT_ID_EXEC_CMD, Action: atservice.GUIDE_ACTION_START}
|
||||
led_mcu.DirectLedControl(tmp.EffectId, tmp.Action, tmp.StartLampNum, []byte{uint8(adau1761.MustGetVol())})
|
||||
}
|
||||
|
||||
switch nembd.Host(*ActualHv) {
|
||||
case nembd.HostPv1C:
|
||||
nembd.DigitalWrite("G", nembd.High)
|
||||
}
|
||||
}
|
||||
func MscToastFinish(arg TtsPlayerArg) {
|
||||
//停止执行灯灯效
|
||||
|
@ -46,6 +52,11 @@ func MscToastFinish(arg TtsPlayerArg) {
|
|||
vui.IconLed_Clear.Show()
|
||||
//}
|
||||
|
||||
switch nembd.Host(*ActualHv) {
|
||||
case nembd.HostPv1C:
|
||||
nembd.DigitalWrite("G", nembd.Low)
|
||||
}
|
||||
|
||||
//检查是否网络缓存播放失败
|
||||
if arg.StopReason == NoticeStopReason_Error {
|
||||
go MscToastFile(vui.SoundNotice_Song_Get_Timeout.GetPath(), CONST_AUDIO_ID, true, false, nil)
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
. "netease_control_center/globals"
|
||||
"netease_control_center/interfaces/log"
|
||||
"netease_control_center/modules/player"
|
||||
"netease_control_center/nembd"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -13,10 +14,19 @@ var (
|
|||
|
||||
func InternetConnectEvent() {
|
||||
log.Println(log.DebugLog, "Internet Connected Event!")
|
||||
|
||||
switch nembd.Host(*ActualHv) {
|
||||
case nembd.HostPv1C:
|
||||
nembd.DigitalWrite("R", nembd.Low)
|
||||
}
|
||||
}
|
||||
|
||||
func InterneteDisconnectEvent() {
|
||||
log.Println(log.DebugLog, "Internet Disconnected Event!")
|
||||
switch nembd.Host(*ActualHv) {
|
||||
case nembd.HostPv1C:
|
||||
nembd.DigitalWrite("R", nembd.High)
|
||||
}
|
||||
}
|
||||
|
||||
func NetworkServiceSwitch(on bool) {
|
||||
|
|
|
@ -22,6 +22,7 @@ import (
|
|||
//"netease_control_center/modules/hardware/misc"
|
||||
"netease_control_center/globals"
|
||||
"netease_control_center/utils/customization"
|
||||
"netease_control_center/nembd"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -77,6 +78,11 @@ func UpdateVoiceStatus(curStatus VoiceStatuses) {
|
|||
// stamp := uint8(utils.Angle2LedNo2(lastWakeup.Angle, 12, 4, false))
|
||||
// led_mcu.DirectLedControl(atservice.GUIDE_EFFECT_ID_VOICE_INPUT, atservice.GUIDE_ACTION_START, stamp, []byte{})
|
||||
|
||||
switch nembd.Host(*ActualHv) {
|
||||
case nembd.HostPv1C:
|
||||
nembd.DigitalWrite("B", nembd.High)
|
||||
}
|
||||
|
||||
case VoiceStatus_RECOGING:
|
||||
BeginRecogTime = time.Now()
|
||||
led_mcu.DirectLedControl(atservice.GUIDE_EFFECT_ID_THINKING, atservice.GUIDE_ACTION_START, 0, []byte{})
|
||||
|
@ -92,6 +98,11 @@ func UpdateVoiceStatus(curStatus VoiceStatuses) {
|
|||
led_mcu.DirectLedClear(atservice.GUIDE_EFFECT_ID_THINKING)
|
||||
led_mcu.DirectLedClear(atservice.GUIDE_EFFECT_ID_VOICE_INPUT)
|
||||
IconLed_Clear.Show()
|
||||
|
||||
switch nembd.Host(*ActualHv) {
|
||||
case nembd.HostPv1C:
|
||||
nembd.DigitalWrite("B", nembd.Low)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -161,6 +161,9 @@ func ShowLastDirectLed() {
|
|||
ShowDirectLed(LastDirectLed)
|
||||
}
|
||||
func DirectLedControl(EffectId GUIDE_EFFECT_ID, Action GUIDE_ACTION, StartLampNum uint8, data []byte) {
|
||||
if globals.GetCurPlatformConfig().TopLight == false {
|
||||
return
|
||||
}
|
||||
if GUIDE_EFFECT_ID_NONE == EffectId {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -56,15 +56,7 @@ func uartInit() error {
|
|||
return errors.New("port open error!")
|
||||
} else {
|
||||
flushUart() //flush uart data
|
||||
sPort.Close()
|
||||
sPort, err = serial.OpenPort(c)
|
||||
if err != nil {
|
||||
log.Println(log.ErrorLog, err)
|
||||
return errors.New("port open error!")
|
||||
} else {
|
||||
flushUart() //flush uart data
|
||||
go uartReadStart()
|
||||
}
|
||||
go uartReadStart()
|
||||
}
|
||||
|
||||
return err
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package Init
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"netease_control_center/nembd/host/r311_pv1c"
|
||||
"netease_control_center/nembd"
|
||||
)
|
||||
|
||||
func InitBoard(BoardName string) error {
|
||||
switch BoardName {
|
||||
case nembd.HostPv1C:
|
||||
r311_pv1c.Init()
|
||||
nembd.SetHost(nembd.Host(BoardName), 0)
|
||||
|
||||
//init gpios
|
||||
nembd.SetDirection("R", nembd.Out)
|
||||
nembd.SetDirection("G", nembd.Out)
|
||||
nembd.SetDirection("B", nembd.Out)
|
||||
|
||||
nembd.ActiveLow("R", true)
|
||||
nembd.ActiveLow("G", true)
|
||||
nembd.ActiveLow("B", true)
|
||||
|
||||
|
||||
nembd.DigitalWrite("R", nembd.High)
|
||||
nembd.DigitalWrite("G", nembd.Low)
|
||||
nembd.DigitalWrite("B", nembd.Low)
|
||||
return nil
|
||||
default:
|
||||
return errors.New(fmt.Sprintf("Unknow board name:%s\n", BoardName))
|
||||
}
|
||||
}
|
|
@ -37,8 +37,15 @@ const (
|
|||
|
||||
// Host R16 Netease voice box
|
||||
HostIHW1 = "IHW1"
|
||||
|
||||
// R311 pv1 ces board
|
||||
HostPv1C = "r311-pv1c"
|
||||
)
|
||||
|
||||
func (this Host) Equal(name string) bool {
|
||||
return string(this) == name
|
||||
}
|
||||
|
||||
func execOutput(name string, arg ...string) (output string, err error) {
|
||||
var out []byte
|
||||
if out, err = exec.Command(name, arg...).Output(); err != nil {
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package r311_pv1c
|
||||
|
||||
import (
|
||||
embd "netease_control_center/nembd"
|
||||
"netease_control_center/nembd/host/generic"
|
||||
)
|
||||
|
||||
var pins = embd.PinMap{
|
||||
&embd.PinDesc{ID: "PL3", Aliases: []string{"R"}, Caps: embd.CapDigital, DigitalLogical: 355},
|
||||
&embd.PinDesc{ID: "PH5", Aliases: []string{"B"}, Caps: embd.CapDigital, DigitalLogical: 229},
|
||||
&embd.PinDesc{ID: "PL2", Aliases: []string{"G"}, Caps: embd.CapDigital, DigitalLogical: 354},
|
||||
}
|
||||
|
||||
func Init() {
|
||||
embd.Register(embd.HostPv1C, func(rev int) *embd.Descriptor {
|
||||
return &embd.Descriptor{
|
||||
GPIODriver: func() embd.GPIODriver {
|
||||
return embd.NewGPIODriver(pins, generic.NewDigitalPin, nil, nil)
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
|
@ -6,7 +6,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
embd "netease_control_center/nembd"
|
||||
)
|
||||
|
||||
type Key int
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// Package servo allows control of servos using a PWM controller.
|
||||
package servo
|
||||
|
||||
import "netease_control_center/nembd/util"
|
||||
|
||||
import (
|
||||
"github.com/golang/glog"
|
||||
"github.com/kidoman/embd/util"
|
||||
"netease_control_center/interfaces/log"
|
||||
)
|
||||
|
||||
|
@ -42,6 +42,5 @@ func (s *Servo) SetAngle(angle int) error {
|
|||
us := util.Map(int64(angle), 0, 180, int64(s.Minus), int64(s.Maxus))
|
||||
|
||||
log.Printf(log.DebugLog, "servo: given angle %v calculated %v us\n", angle, us)
|
||||
|
||||
return s.PWM.SetMicroseconds(int(us))
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ endchoice
|
|||
|
||||
choice
|
||||
prompt "Selected CAE SDK"
|
||||
default XUNFEI_CAE_SDK
|
||||
default NETEASE_DUILITE_SDK
|
||||
|
||||
config NETEASE_CAE_SDK
|
||||
bool "Used netease CAE SDK"
|
||||
|
@ -24,12 +24,10 @@ choice
|
|||
config XUNFEI_CAE_SDK
|
||||
bool "Used xunfei CAE SDK"
|
||||
|
||||
config NETEASE_DUILITE_SDK
|
||||
bool "Used duilite CAE SDK"
|
||||
endchoice
|
||||
|
||||
config NETEASE_DUILITE_SDK
|
||||
bool "Used duilite CAE SDK"
|
||||
default y
|
||||
|
||||
choice
|
||||
prompt "Selected TTS SDK"
|
||||
default XUNFEI_TTS_SDK
|
||||
|
|
|
@ -21,32 +21,34 @@ define Package/$(PKG_NAME)
|
|||
CATEGORY:=Netease
|
||||
TITLE:=Netease voice main program in submodule
|
||||
MAINTAINER:=Wang zijiao <hzwangzijiao@corp.netease.com>
|
||||
DEPENDS:= +libcae +libneteasedc +libneteasevoicews +libduilite +libjansson +libspeex +alsa-lib +libuws +libjson-c +libyunxin +libcutils $(MAKE_COMMON_DEPEND)
|
||||
DEPENDS:=+libneteasedc +libneteasevoicews +libduilite +libjansson +libspeex +alsa-lib +libuws +libjson-c +libyunxin +libcutils $(MAKE_COMMON_DEPEND)
|
||||
|
||||
ifeq ('$(CONFIG_XUNFEI_MSC_SDK)', 'y')
|
||||
DEPENDS+=+libmsc
|
||||
DEPENDS+= +libmsc
|
||||
else ifeq ('$(CONFIG_XUNFEI_TTS_SDK)', 'y')
|
||||
DEPENDS+=+libmsc
|
||||
DEPENDS+= +libmsc
|
||||
endif
|
||||
|
||||
ifeq ('$(CONFIG_XUNFEI_CAE_SDK)', 'y')
|
||||
DEPENDS+=+libcae
|
||||
DEPENDS+= +libcae
|
||||
TARGET_CFLAGS+= -DENABLE_MODULE_XUNFEICAE=1
|
||||
endif
|
||||
|
||||
ifeq ('$(CONFIG_NETEASE_MSC_SDK)', 'y')
|
||||
DEPENDS+=+libneteasevoicews
|
||||
DEPENDS+= +libneteasevoicews
|
||||
endif
|
||||
|
||||
ifeq ('$(CONFIG_NETEASE_CAE_SDK)', 'y')
|
||||
DEPENDS+=+libfmae
|
||||
DEPENDS+= +libfmae
|
||||
endif
|
||||
|
||||
ifeq ('$(CONFIG_NETEASE_DUILITE_SDK)', 'y')
|
||||
DEPENDS+=+libduilite
|
||||
DEPENDS+= +libduilite
|
||||
TARGET_CFLAGS+= -DENABLE_MODULE_DUILITE=1
|
||||
endif
|
||||
|
||||
ifeq ('$(CONFIG_USED_DC_SDK)', 'y')
|
||||
DEPENDS+=+libneteasedc
|
||||
DEPENDS+= +libneteasedc
|
||||
endif
|
||||
endef
|
||||
|
||||
|
@ -93,6 +95,7 @@ define Build/Configure
|
|||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(info TARGET_CFLAGS=$(TARGET_CFLAGS))
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/src \
|
||||
ARCH="$(TARGET_ARCH)" \
|
||||
AR="$(TARGET_AR)" \
|
||||
|
|
|
@ -20,6 +20,8 @@ when who why
|
|||
/* ------------------------------------------------------------------------
|
||||
** Includes
|
||||
** ------------------------------------------------------------------------ */
|
||||
#ifdef ENABLE_MODULE_XUNFEICAE
|
||||
|
||||
#include "cae_lib.h"
|
||||
#include "error.h"
|
||||
#include <assert.h>
|
||||
|
@ -216,3 +218,5 @@ int Netease_CAESetShowLog(int show_log) {
|
|||
CAESetShowLog(show_log);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
|
@ -112,6 +112,7 @@ int queue_full(audio_queue_t *queue) {
|
|||
|
||||
int queue_write(audio_queue_t *queue, char data[], int dataLen) {
|
||||
if (queue == NULL || data == NULL || dataLen <= 0) {
|
||||
printf("Input is null, return! datalen:%d\n", dataLen);
|
||||
return false;
|
||||
}
|
||||
pthread_mutex_lock(&(queue->mutex));
|
||||
|
@ -139,7 +140,7 @@ int queue_write(audio_queue_t *queue, char data[], int dataLen) {
|
|||
queue->rear = (queue->rear + dataLen) % queue->capacity;
|
||||
pthread_mutex_unlock(&(queue->mutex));
|
||||
native_event_set(queue->sync_event);
|
||||
// printf("queue_write end \n");
|
||||
//printf("queue_write end queue:0x%p\n", queue);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -153,7 +154,7 @@ int queue_read(audio_queue_t *queue, char **data) {
|
|||
if (queue == NULL || data == NULL) {
|
||||
return 0;
|
||||
}
|
||||
//printf("queue_read pthread_cond_wait begin\n");
|
||||
//printf("queue_read pthread_cond_wait begin 0x%p\n", queue);
|
||||
native_event_wait(queue->sync_event, 0x7fffffff);
|
||||
pthread_mutex_lock(&(queue->mutex));
|
||||
queueBase = (char *)(queue + 1);
|
||||
|
@ -163,7 +164,7 @@ int queue_read(audio_queue_t *queue, char **data) {
|
|||
|
||||
temp_buff = (char *)malloc(queueLen);
|
||||
if (NULL == temp_buff) {
|
||||
printf("queue_read malloc error queueLen%d\n", queueLen);
|
||||
//printf("queue_read malloc error queueLen%d\n", queueLen);
|
||||
pthread_mutex_unlock(&(queue->mutex));
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,8 @@ typedef enum {
|
|||
} VoiceSessionStatus;
|
||||
|
||||
typedef enum {
|
||||
WorkMode_R311_PV1 = 0
|
||||
WorkMode_R311_PV1 = 0,
|
||||
WorkMode_R311_PV1_CES = 1,
|
||||
} WorkMode;
|
||||
|
||||
void setVss(VoiceSessionStatus st);
|
||||
|
|
|
@ -19,8 +19,9 @@ when who why
|
|||
|
||||
#ifndef __CAE_H__
|
||||
#define __CAE_H__
|
||||
#if ENABLE_MODULE_XUNFEICAE
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* C++ */
|
||||
|
||||
|
@ -46,4 +47,5 @@ int Netease_CAESetShowLog(int show_log);
|
|||
} /* extern "C" */
|
||||
#endif /* C++ */
|
||||
|
||||
#endif /* ENABLE_MODULE_XUNFEICAE */
|
||||
#endif /* __CAE_H__ */
|
||||
|
|
|
@ -35,15 +35,22 @@ extern "C" {
|
|||
//#define ENABLE_YUNXIN
|
||||
|
||||
#if USED_NETEASE_FMAE
|
||||
|
||||
#include <fmae/fmae.h>
|
||||
|
||||
#else
|
||||
|
||||
#ifdef ENABLE_MODULE_XUNFEICAE
|
||||
#include "cae.h"
|
||||
#include "cae_lib.h"
|
||||
#include "cae_thread.h"
|
||||
#include <cae/cae_errors.h>
|
||||
#include <cae/cae_intf.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include "cae_lib.h"
|
||||
#include "cae_thread.h"
|
||||
|
||||
struct IAT_HD;
|
||||
|
||||
typedef enum {
|
||||
|
@ -90,8 +97,12 @@ struct IAT_HD {
|
|||
void Netease_IAT_DeInit();
|
||||
int Netease_IAT_Init();
|
||||
void Netease_IAT_write(const void *audiobuf, int audiolen);
|
||||
|
||||
#if ENABLE_MODULE_XUNFEICAE
|
||||
int Netease_MSP_Init(CAEDATA **cdata);
|
||||
int Netease_MSP_Deinit();
|
||||
#endif
|
||||
|
||||
void Netease_IAT_checkflag(int angle);
|
||||
|
||||
// 1: fail, 0: success
|
||||
|
|
|
@ -41,10 +41,13 @@ when who why
|
|||
#if USED_NETEASE_DUILITE
|
||||
// speech voice cb
|
||||
#include "nduilite.h"
|
||||
#include <cae/cae_errors.h>
|
||||
#include <duilite.h>
|
||||
#endif
|
||||
|
||||
#if ENABLE_MODULE_XUNFEICAE
|
||||
#include <cae/cae_errors.h>
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
** Macros
|
||||
** ------------------------------------------------------------------------ */
|
||||
|
@ -76,7 +79,7 @@ typedef struct _FMAEUserData {
|
|||
} FMAEUserData;
|
||||
FMAE_HANDLE g_hFMAE;
|
||||
const char *g_fmaeCfgPath = "/usr/share/fmae_res/config.ini";
|
||||
#else
|
||||
#elif ENABLE_MODULE_XUNFEICAE
|
||||
CAEDATA *caeconfig = NULL;
|
||||
#endif
|
||||
|
||||
|
@ -226,6 +229,7 @@ static char *g_pQuickWkKey[] = {
|
|||
int Duilite_doa_cb(void *userdata, int type, char *msg, int len) {
|
||||
json_t *tmp;
|
||||
json_t *js;
|
||||
|
||||
n_toast("Doa cb:%s, wakeup by: %s\n", msg, getVoiceWakeupword());
|
||||
if (NULL == msg || len <= 0) {
|
||||
return 0;
|
||||
|
@ -315,6 +319,7 @@ static void record_audio_cb(const void *audio, unsigned int audio_len,
|
|||
if (caeconfig != NULL && caeconfig->cae != NULL) {
|
||||
// n_debug("write audio to cae !\n");
|
||||
#endif
|
||||
|
||||
#if USED_NETEASE_DC
|
||||
// unsigned char* pBuf = (unsigned char*)audio;
|
||||
#if 1
|
||||
|
@ -349,11 +354,11 @@ static void record_audio_cb(const void *audio, unsigned int audio_len,
|
|||
debug_waste_time("__cacheCAEAudio", &cachetime);
|
||||
#endif
|
||||
|
||||
#if USED_NETEASE_FMAE
|
||||
#if USED_NETEASE_FMAE && ENABLE_MODULE_XUNFEICAE
|
||||
ret = FMAEAudioWrite(g_hFMAE, audio, audio_len);
|
||||
|
||||
// printf("write %d at %p ret = %d\n", audio_len, audio, ret);
|
||||
#elif USED_XUNFEI_CAE
|
||||
#elif ENABLE_MODULE_XUNFEICAE
|
||||
Netease_CAEAudioWrite(caeconfig, audio, audio_len);
|
||||
#endif
|
||||
// n_debug("write finish!\n");
|
||||
|
@ -395,11 +400,13 @@ static PDBUS_MSG_PACK DBusMessageCb(uv_loop_t *pLoop, DBusConnection *pConn,
|
|||
|
||||
case CMD_CC_MSC_BEGIN_SESSION:
|
||||
n_toast("Recv cc create session command! msg:%s\n", pMsg->pMsg);
|
||||
if (been_wakedup == 0 && caeconfig != NULL) {
|
||||
if (been_wakedup == 0) {
|
||||
// todo do not waked up, do wake here
|
||||
n_toast("has not waked up!todo waked up!");
|
||||
#if USED_XUNFEI_CAE
|
||||
Netease_CAESetRealBeam(caeconfig, 0);
|
||||
|
||||
#if ENABLE_MODULE_XUNFEICAE
|
||||
if (NULL != caeconfig)
|
||||
Netease_CAESetRealBeam(caeconfig, 0);
|
||||
#endif
|
||||
}
|
||||
js = json_loadb(pMsg->pMsg, pMsg->msgSize, 0, NULL);
|
||||
|
@ -537,7 +544,7 @@ static void usage() {
|
|||
"-l, --list-devices list all soundcards and digital audio "
|
||||
"devices\n"
|
||||
"-L, --list-pcms list device names\n"
|
||||
"-w, --work-mode=# work mode: 0: r311_pv1\n"
|
||||
"-w, --work-mode=# work mode: 0: r311_pv1(dmic) 1:r311_pv1_ces(nmic)\n"
|
||||
"-f, --list-format list all format in alsa\n"
|
||||
"-r, --just-record Only record voice to file\n"
|
||||
"-t, --type=# sample format (case insensitive): raw,wav\n"
|
||||
|
@ -649,13 +656,15 @@ void main(int argc, char **argv) {
|
|||
printf("Will record final data to file:%s\n", finalfile);
|
||||
}
|
||||
|
||||
recordconfig.audio_cb = NULL;
|
||||
//recordconfig.audio_cb = NULL;
|
||||
Neteasae_record_start(&recordconfig);
|
||||
|
||||
signal(SIGINT, signal_handler);
|
||||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGABRT, signal_handler);
|
||||
|
||||
Netease_nduilite_init(Duilite_wakeup_cb, Duilite_doa_cb,
|
||||
Duilite_beforming_cb, Duilite_vad_cb);
|
||||
while (1)
|
||||
usleep(1000000);
|
||||
}
|
||||
|
@ -686,14 +695,6 @@ void main(int argc, char **argv) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if (access(TEST_SERVER_CFG_FILE, F_OK) == 0) {
|
||||
g_bIsUsedTestServer = 1;
|
||||
} else {
|
||||
g_bIsUsedTestServer = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if USED_NETEASE_FMAE
|
||||
ret = Netease_audiobypass_init(&audiobypassconfig, NULL,
|
||||
AUDIO_BYPASS_CHANNEL_MSC_IAT);
|
||||
|
|
|
@ -75,7 +75,10 @@ when who why
|
|||
* Global Variable Definitions
|
||||
*
|
||||
* ------------------------------------------------------------------------ */
|
||||
#if ENABLE_MODULE_XUNFEICAE
|
||||
CAEDATA **cae;
|
||||
#endif
|
||||
|
||||
struct IAT_HD *iathd;
|
||||
static char isBeginSession = 0;
|
||||
static int audiostate = MSP_AUDIO_SAMPLE_CONTINUE;
|
||||
|
|
|
@ -33,7 +33,6 @@ when who why
|
|||
|
||||
#include "msc.h"
|
||||
#include "nduilite.h"
|
||||
#include <cae/cae_errors.h>
|
||||
#include <duilite.h>
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
|
@ -395,7 +394,7 @@ void Netease_nduilite_writeaudio(const void *audioData,
|
|||
return;
|
||||
}
|
||||
|
||||
//n_debug("Write nduilite data, len:%d\n", audio_len);
|
||||
n_debug("Write nduilite data, len:%d\n", audio_len);
|
||||
ret = duilite_fespa_feed(fespa, audioData, audio_len);
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -33,7 +33,9 @@ when who why
|
|||
#include "record.h"
|
||||
|
||||
#include "error.h"
|
||||
#if ENABLE_MODULE_XUNFEICAE
|
||||
#include <cae/cae_intf.h>
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <stdint.h>
|
||||
|
@ -56,6 +58,7 @@ when who why
|
|||
** ------------------------------------------------------------------------ */
|
||||
static char *out_pcm_name;
|
||||
|
||||
#if ENABLE_MODULE_XUNFEICAE
|
||||
static Proc_CAENew api_cae_new;
|
||||
static Proc_CAEAudioWrite api_cae_audio_write;
|
||||
static Proc_CAEResetEng api_cae_reset_eng;
|
||||
|
@ -66,6 +69,7 @@ static Proc_CAEGetVersion api_cae_get_version;
|
|||
static Proc_CAEGetChannel api_cae_get_channel;
|
||||
static Proc_CAESetShowLog api_cae_set_show_log;
|
||||
static Proc_CAEDestroy api_cae_destroy;
|
||||
#endif
|
||||
|
||||
static off64_t fdcount = 0;
|
||||
static snd_output_t *sndlog;
|
||||
|
@ -110,15 +114,18 @@ static void *QueueReadThread(void *param) {
|
|||
char *data_buff = NULL;
|
||||
readLen = queue_read(record->queue, &data_buff);
|
||||
if (0 == readLen) {
|
||||
// printf("queue_read readLen = 0\n");
|
||||
printf("queue_read readLen = 0\n");
|
||||
// usleep(16000);
|
||||
continue;
|
||||
}
|
||||
if (record->buff_size != readLen) {
|
||||
// printf("\nqueue_read readLen %d\n", readLen);
|
||||
}
|
||||
printf("\nqueue_read readLen %d\n", readLen);
|
||||
|
||||
if (record->cb)
|
||||
record->cb(data_buff, readLen, NETEASE_SUCCESS);
|
||||
|
||||
free(data_buff);
|
||||
}
|
||||
printf("QueueReadThread end, running:%d \n", record->runing);
|
||||
|
@ -185,23 +192,63 @@ static void do_test_position(RecordData *record) {
|
|||
}
|
||||
}
|
||||
|
||||
static void prg_exit(int code, RecordData *record) {
|
||||
n_toast("Do exit!!\n");
|
||||
exit(code);
|
||||
}
|
||||
|
||||
/* I/O error handler */
|
||||
static void xrun(RecordData *record) {
|
||||
snd_pcm_status_t *status;
|
||||
int res;
|
||||
|
||||
snd_pcm_status_alloca(&status);
|
||||
if ((res = snd_pcm_status(record->handle, status)) < 0) {
|
||||
n_toast("status error: %s", snd_strerror(res));
|
||||
prg_exit(EXIT_FAILURE, record);
|
||||
}
|
||||
if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
|
||||
fprintf(stderr, ("Status:\n"));
|
||||
snd_pcm_status_dump(status, sndlog);
|
||||
|
||||
if ((res = snd_pcm_prepare(record->handle)) < 0) {
|
||||
n_toast("xrun: prepare error: %s", snd_strerror(res));
|
||||
prg_exit(EXIT_FAILURE, record);
|
||||
}
|
||||
return; /* ok, data should be accepted again */
|
||||
} else if (snd_pcm_status_get_state(status) == SND_PCM_STATE_DRAINING) {
|
||||
fprintf(stderr, ("Status(DRAINING):\n"));
|
||||
snd_pcm_status_dump(status, sndlog);
|
||||
fprintf(stderr,
|
||||
("capture stream format change? attempting recover...\n"));
|
||||
if ((res = snd_pcm_prepare(record->handle)) < 0) {
|
||||
n_toast("xrun(DRAINING): prepare error: %s", snd_strerror(res));
|
||||
prg_exit(EXIT_FAILURE, record);
|
||||
}
|
||||
return;
|
||||
}
|
||||
fprintf(stderr, ("Status(R/W):\n"));
|
||||
snd_pcm_status_dump(status, sndlog);
|
||||
n_toast("read/write error, state = %s",
|
||||
snd_pcm_state_name(snd_pcm_status_get_state(status)));
|
||||
prg_exit(EXIT_FAILURE, record);
|
||||
}
|
||||
|
||||
static ssize_t pcm_read(RecordData *record) {
|
||||
ssize_t r;
|
||||
size_t result = 0;
|
||||
size_t rcount = record->chunk_size;
|
||||
size_t count = rcount;
|
||||
char *data = record->buffer;
|
||||
|
||||
while (count > 0 && !!record->runing) {
|
||||
r = snd_pcm_readi(record->handle, data, count);
|
||||
if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
|
||||
fprintf(stderr, "read data == EAGAIN\n");
|
||||
n_debug("read data == EAGAIN\n");
|
||||
snd_pcm_wait(record->handle, 50);
|
||||
} else if (r == -EPIPE) {
|
||||
/* EPIPE means overrun */
|
||||
fprintf(stderr, "overrun occurred/n");
|
||||
LOG_EX(LOG_Error, "ALSA Read Data = -EPIPE\n");
|
||||
snd_pcm_prepare(record->handle);
|
||||
xrun(record);
|
||||
continue;
|
||||
} else if (r < 0) {
|
||||
fprintf(stderr, "error from read: %s/n", snd_strerror(r));
|
||||
|
@ -312,6 +359,66 @@ static void begin_wave(RecordData *record, int fd, size_t cnt) {
|
|||
}
|
||||
}
|
||||
|
||||
// voice binary data convert by HongChuanRong
|
||||
static void CheckData(const void *dataIn, int lenIn, void *dataOut,
|
||||
int *lenOut) {
|
||||
#define DATA_CHAN_NUM (12)
|
||||
static short ckDataBuf[DATA_CHAN_NUM];
|
||||
static int ckDataPos = 0;
|
||||
static int chanOneFoundFlag = 0;
|
||||
if (lenIn % sizeof(int) != 0) {
|
||||
fprintf(stderr, "fatal error!\n");
|
||||
return;
|
||||
}
|
||||
const int totalCountsIn = lenIn / sizeof(int);
|
||||
const int *pDataIn = (const int *)dataIn;
|
||||
short *pDataOut = (short *)dataOut;
|
||||
int countsOut = 0;
|
||||
|
||||
if (!chanOneFoundFlag) {
|
||||
// we have to find chan one first (Peng)
|
||||
for (auto k = 0; k < totalCountsIn; ++k) {
|
||||
const int chanId = (pDataIn[k] >> 8) & 0x0f;
|
||||
if (chanId == 1) {
|
||||
// chan one found
|
||||
chanOneFoundFlag = 1;
|
||||
CheckData(pDataIn + k, (totalCountsIn - k) * sizeof(int),
|
||||
dataOut, lenOut);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (auto k = 0; k < totalCountsIn; ++k) {
|
||||
const int chanId = (pDataIn[k] >> 8) & 0x0f;
|
||||
|
||||
if (chanId == (ckDataPos + 1)) {
|
||||
ckDataBuf[ckDataPos++] = (short)(pDataIn[k] >> 16);
|
||||
} else {
|
||||
fprintf(stderr, "expecting chan: %d, input chan: %d\n",
|
||||
ckDataPos + 1, chanId);
|
||||
ckDataPos = 0;
|
||||
}
|
||||
|
||||
if (ckDataPos == DATA_CHAN_NUM) {
|
||||
short finalOut[8];
|
||||
finalOut[0] = ckDataBuf[8 - 1];
|
||||
finalOut[1] = ckDataBuf[2 - 1];
|
||||
finalOut[2] = ckDataBuf[7 - 1];
|
||||
finalOut[3] = ckDataBuf[1 - 1];
|
||||
finalOut[4] = ckDataBuf[9 - 1];
|
||||
finalOut[5] = ckDataBuf[3 - 1];
|
||||
finalOut[6] = ckDataBuf[4 - 1];
|
||||
finalOut[7] = ckDataBuf[10 - 1];
|
||||
|
||||
memcpy(pDataOut + countsOut, finalOut, sizeof(finalOut));
|
||||
countsOut += 8;
|
||||
ckDataPos = 0;
|
||||
}
|
||||
}
|
||||
(*lenOut) = countsOut * sizeof(short);
|
||||
}
|
||||
|
||||
static void *RecordThread(void *param) {
|
||||
RecordData *record = (RecordData *)param;
|
||||
int ret = 0;
|
||||
|
@ -334,8 +441,10 @@ static void *RecordThread(void *param) {
|
|||
if (record->finalfilefd > 0 && record->pcm_cfg->backupfile_waveformat > 0) {
|
||||
begin_wave(record, record->backupfilefd, (size_t)max_file_size);
|
||||
}
|
||||
n_toast("Running:%d, work mode:%d\n", record->runing, getWorkMode());
|
||||
while (!!record->runing) {
|
||||
if (getWorkMode() == WorkMode_R311_PV1) {
|
||||
switch (getWorkMode()) {
|
||||
case WorkMode_R311_PV1:
|
||||
if (pcm_read(record->pcm_cfg->adc) ==
|
||||
record->pcm_cfg->adc->chunk_size) {
|
||||
if (pcm_read(record) == record->chunk_size) {
|
||||
|
@ -362,8 +471,11 @@ static void *RecordThread(void *param) {
|
|||
|
||||
// printf("copy to 0x%p, size:%d\n", (record->buffer +
|
||||
// i * record->bits_per_frame / 8 +
|
||||
// 6 * record->significant_bits_per_sample /
|
||||
// 8), 2 * record->significant_bits_per_sample / 8);
|
||||
// 6 * record->significant_bits_per_sample
|
||||
// /
|
||||
// 8), 2 *
|
||||
// record->significant_bits_per_sample
|
||||
// / 8);
|
||||
memcpy(
|
||||
(void *)(record->buffer +
|
||||
i * record->bits_per_frame / 8 +
|
||||
|
@ -399,9 +511,48 @@ static void *RecordThread(void *param) {
|
|||
pcm_read(record);
|
||||
printf("Read adc codec error!\n");
|
||||
}
|
||||
} else {
|
||||
printf("Unknow work mode!\n");
|
||||
exit(0);
|
||||
|
||||
break;
|
||||
|
||||
case WorkMode_R311_PV1_CES:
|
||||
// printf("Begin to read\n");
|
||||
ret = pcm_read(record);
|
||||
// printf("Read: %d\n", ret);
|
||||
|
||||
if (ret == record->chunk_size) {
|
||||
int len = 0;
|
||||
char *newbuf = (char *)malloc(record->chunk_bytes + 60);
|
||||
if (newbuf != NULL) {
|
||||
CheckData(record->buffer, record->chunk_bytes,
|
||||
(void *)newbuf, &len);
|
||||
if (record->backupfilefd > 0) {
|
||||
#if 0
|
||||
xwrite(record->backupfilefd, newbuf, len);
|
||||
fdcount += len;
|
||||
#else
|
||||
xwrite(record->backupfilefd, record->buffer, record->chunk_bytes);
|
||||
fdcount += record->chunk_bytes;
|
||||
#endif
|
||||
}
|
||||
queue_write(record->queue, newbuf, len);
|
||||
free(newbuf);
|
||||
}
|
||||
|
||||
// if (record->backupfilefd > 0) {
|
||||
// xwrite(record->backupfilefd, record->buffer,
|
||||
// record->chunk_bytes);
|
||||
// fdcount += record->chunk_bytes;
|
||||
// }
|
||||
// queue_write(record->queue, record->buffer,
|
||||
// record->chunk_bytes);
|
||||
} else {
|
||||
fprintf(stderr, "short read, read %d frames/n", ret);
|
||||
LOG_EX(LOG_Error, "ALSA Short Read, Read %d Frames: %d\n", ret);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
n_error("Unknow mode!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,6 +624,26 @@ int Neteasae_record_start(struct pcm_config *pcm_cfg) {
|
|||
|
||||
break;
|
||||
|
||||
case WorkMode_R311_PV1_CES:
|
||||
pcm_cfg->device_name = "hw:1,0";
|
||||
pcm_cfg->channels = 2;
|
||||
pcm_cfg->rate = 96000;
|
||||
pcm_cfg->period_size = 1535;
|
||||
pcm_cfg->format = "S32_LE";
|
||||
|
||||
printf("Begin to init R311 pv1 ces i2s0!");
|
||||
init_params(pcm_cfg, 1);
|
||||
|
||||
pthread_attr_init(&thread_attr);
|
||||
pthread_attr_setschedpolicy(&thread_attr, SCHED_RR);
|
||||
thread_param.sched_priority = sched_get_priority_max(SCHED_RR);
|
||||
pthread_attr_setschedparam(&thread_attr, &thread_param);
|
||||
|
||||
pthread_create(&pcm_cfg->recordata->tid_pcm_read, &thread_attr,
|
||||
RecordThread, (void *)pcm_cfg->recordata);
|
||||
pthread_create(&pcm_cfg->recordata->tid_queue_read, NULL,
|
||||
QueueReadThread, (void *)pcm_cfg->recordata);
|
||||
break;
|
||||
default:
|
||||
printf("Unknow mode!\n");
|
||||
exit(0);
|
||||
|
@ -501,6 +672,7 @@ static int init_params(struct pcm_config *pcm_cfg, int init_queue) {
|
|||
record->pcm_cfg = pcm_cfg;
|
||||
record->cb = pcm_cfg->audio_cb;
|
||||
|
||||
n_toast("r_cb:%p, pcm_cb:%p\n", record->cb, pcm_cfg->audio_cb);
|
||||
//设置录音参数参数
|
||||
rc = snd_pcm_open(&record->handle, pcm_cfg->device_name,
|
||||
SND_PCM_STREAM_CAPTURE, 0);
|
||||
|
@ -603,14 +775,15 @@ static int init_params(struct pcm_config *pcm_cfg, int init_queue) {
|
|||
}
|
||||
|
||||
if (init_queue > 0) {
|
||||
record->queue_buff = (char *)malloc(
|
||||
sizeof(audio_queue_t) + record->chunk_bytes * QUEUE_BUFF_MULTIPLE + 1);
|
||||
record->queue_buff =
|
||||
(char *)malloc(sizeof(audio_queue_t) +
|
||||
record->chunk_bytes * QUEUE_BUFF_MULTIPLE + 1);
|
||||
if (NULL == record->queue_buff) {
|
||||
ret = NETEASE_ERROR_OUT_OF_MEMORY;
|
||||
goto error;
|
||||
}
|
||||
record->queue = queue_init(record->queue_buff,
|
||||
record->chunk_bytes * QUEUE_BUFF_MULTIPLE + 1);
|
||||
record->queue = queue_init(
|
||||
record->queue_buff, record->chunk_bytes * QUEUE_BUFF_MULTIPLE + 1);
|
||||
} else {
|
||||
record->queue_buff = NULL;
|
||||
record->queue = NULL;
|
||||
|
@ -620,7 +793,8 @@ static int init_params(struct pcm_config *pcm_cfg, int init_queue) {
|
|||
snd_pcm_sw_params_set_avail_min(record->handle, swparams,
|
||||
record->chunk_size);
|
||||
snd_pcm_sw_params_set_start_threshold(record->handle, swparams, 1);
|
||||
snd_pcm_sw_params_set_stop_threshold(record->handle, swparams, 8000);
|
||||
snd_pcm_sw_params_set_stop_threshold(record->handle, swparams,
|
||||
record->buff_size);
|
||||
|
||||
if (snd_pcm_sw_params(record->handle, swparams) < 0) {
|
||||
n_error("unable to install sw params:");
|
||||
|
|
Loading…
Reference in New Issue