add key platform config && voice init script
This commit is contained in:
parent
d27d8a5821
commit
84da3dc26a
|
@ -47,7 +47,7 @@ start_voice() {
|
|||
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 command $PROG_VOICE --work-mode=0
|
||||
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
|
||||
|
|
|
@ -2,12 +2,13 @@ package globals
|
|||
|
||||
type PlatformConfig struct {
|
||||
MicAdc bool
|
||||
InputKeyPath string
|
||||
}
|
||||
var (
|
||||
platformConfigs = map[string]PlatformConfig{
|
||||
"default": PlatformConfig{MicAdc:false},
|
||||
"EVT":PlatformConfig{MicAdc:true},
|
||||
"r311-pv1":PlatformConfig{MicAdc:false},
|
||||
"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"},
|
||||
}
|
||||
curPlatformConfig *PlatformConfig
|
||||
)
|
||||
|
|
|
@ -265,7 +265,7 @@ func TriggerKey(keycode int, isPress bool) {
|
|||
}
|
||||
|
||||
func KeyApp() error {
|
||||
dev, err := evdev.Open(devpath)
|
||||
dev, err := evdev.Open(globals.GetCurPlatformConfig().InputKeyPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -84,8 +84,7 @@ struct pcm_config recordconfig = {0};
|
|||
struct audio_bypass *audiobypassconfig = NULL;
|
||||
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;
|
||||
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));
|
||||
}
|
||||
|
||||
static char* g_pQuickWkKey[] =
|
||||
{
|
||||
static char *g_pQuickWkKey[] = {
|
||||
"xia yi shou",
|
||||
"da sheng yi dian",
|
||||
"xiao sheng yi dian",
|
||||
|
@ -546,10 +544,7 @@ static void usage() {
|
|||
"--rawfile=# record raw data to filepath\n"
|
||||
"--finalfile=# record duilite output to filepath\n");
|
||||
}
|
||||
enum {
|
||||
OPT_RAW_FILE = 1,
|
||||
OPT_FINAL_FILE
|
||||
};
|
||||
enum { OPT_RAW_FILE = 1, OPT_FINAL_FILE };
|
||||
|
||||
void main(int argc, char **argv) {
|
||||
int ret, c, option_index, err, tmp;
|
||||
|
@ -633,10 +628,6 @@ void main(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
printf("parse arg end!\n");
|
||||
|
||||
signal(SIGINT, signal_handler);
|
||||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGABRT, signal_handler);
|
||||
// Base module init
|
||||
BaseInit();
|
||||
|
||||
|
@ -660,6 +651,11 @@ void main(int argc, char **argv) {
|
|||
|
||||
recordconfig.audio_cb = NULL;
|
||||
Neteasae_record_start(&recordconfig);
|
||||
|
||||
signal(SIGINT, signal_handler);
|
||||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGABRT, signal_handler);
|
||||
|
||||
while (1)
|
||||
usleep(1000000);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue