add key platform config && voice init script

This commit is contained in:
wangzijiao 2018-09-14 15:30:22 +08:00
parent d27d8a5821
commit 84da3dc26a
4 changed files with 30 additions and 33 deletions

View File

@ -47,7 +47,7 @@ start_voice() {
echo $DBUS_SESSION_BUS_ADDRESS >> $LOG echo $DBUS_SESSION_BUS_ADDRESS >> $LOG
procd_open_instance procd_open_instance
procd_set_param oom_adj $OOM_ADJ procd_set_param oom_adj $OOM_ADJ
procd_set_param command $PROG_VOICE -D >> /tmp/voicelog 2>&1 procd_set_param command $PROG_VOICE --work-mode=0
procd_set_param respawn procd_set_param respawn
procd_append_param limits core=unlimited procd_append_param limits core=unlimited
procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS --work-mode=0 procd_set_param env DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS --work-mode=0

View File

@ -2,12 +2,13 @@ package globals
type PlatformConfig struct { type PlatformConfig struct {
MicAdc bool MicAdc bool
InputKeyPath string
} }
var ( var (
platformConfigs = map[string]PlatformConfig{ platformConfigs = map[string]PlatformConfig{
"default": PlatformConfig{MicAdc:false}, "default": PlatformConfig{MicAdc:false, InputKeyPath:"/dev/input/event2"},
"EVT":PlatformConfig{MicAdc:true}, "EVT":PlatformConfig{MicAdc:true, InputKeyPath:"/dev/input/event2"},
"r311-pv1":PlatformConfig{MicAdc:false}, "r311-pv1":PlatformConfig{MicAdc:false, InputKeyPath:"/dev/input/event1"},
} }
curPlatformConfig *PlatformConfig curPlatformConfig *PlatformConfig
) )

View File

@ -265,7 +265,7 @@ func TriggerKey(keycode int, isPress bool) {
} }
func KeyApp() error { func KeyApp() error {
dev, err := evdev.Open(devpath) dev, err := evdev.Open(globals.GetCurPlatformConfig().InputKeyPath)
if err != nil { if err != nil {
return err return err
} }

View File

@ -84,8 +84,7 @@ struct pcm_config recordconfig = {0};
struct audio_bypass *audiobypassconfig = NULL; struct audio_bypass *audiobypassconfig = NULL;
static char been_wakedup = 0; static char been_wakedup = 0;
static long parse_long(const char *str, int *err) static long parse_long(const char *str, int *err) {
{
long val; long val;
char *endptr; char *endptr;
@ -218,8 +217,7 @@ int Duilite_wakeup_cb(void *userdata, int type, char *msg, int len) {
CMD_MSC_MSG_CONTROLLER_WAKEUP, tmp, strlen(tmp)); CMD_MSC_MSG_CONTROLLER_WAKEUP, tmp, strlen(tmp));
} }
static char* g_pQuickWkKey[] = static char *g_pQuickWkKey[] = {
{
"xia yi shou", "xia yi shou",
"da sheng yi dian", "da sheng yi dian",
"xiao sheng yi dian", "xiao sheng yi dian",
@ -546,13 +544,10 @@ static void usage() {
"--rawfile=# record raw data to filepath\n" "--rawfile=# record raw data to filepath\n"
"--finalfile=# record duilite output to filepath\n"); "--finalfile=# record duilite output to filepath\n");
} }
enum { enum { OPT_RAW_FILE = 1, OPT_FINAL_FILE };
OPT_RAW_FILE = 1,
OPT_FINAL_FILE
};
void main(int argc, char **argv) { void main(int argc, char **argv) {
int ret, c, option_index, err,tmp; int ret, c, option_index, err, tmp;
char *rawfile = "/dev/null"; char *rawfile = "/dev/null";
char *finalfile = "/dev/null"; char *finalfile = "/dev/null";
static const char short_options[] = "hlt:w:Lfr"; static const char short_options[] = "hlt:w:Lfr";
@ -633,10 +628,6 @@ void main(int argc, char **argv) {
} }
} }
printf("parse arg end!\n"); printf("parse arg end!\n");
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGABRT, signal_handler);
// Base module init // Base module init
BaseInit(); BaseInit();
@ -660,6 +651,11 @@ void main(int argc, char **argv) {
recordconfig.audio_cb = NULL; recordconfig.audio_cb = NULL;
Neteasae_record_start(&recordconfig); Neteasae_record_start(&recordconfig);
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGABRT, signal_handler);
while (1) while (1)
usleep(1000000); usleep(1000000);
} }