예제 #1
0
int eng_at_pcmodem(eng_dev_info_t* dev_info)
{
    eng_thread_t t1,t2;

    ENG_LOG("%s ",__func__);

    start_gser(dev_info->host_int.dev_at);

    at_mux_fd = open(dev_info->modem_int.at_chan, O_RDWR);
    if(at_mux_fd < 0){
        ENG_LOG("%s: open %s fail [%s]\n",__FUNCTION__, dev_info->modem_int.at_chan,strerror(errno));
        return -1;
    }

    if (0 != eng_thread_create( &t1, eng_readpcat_thread, (void*)dev_info)){
        ENG_LOG("read pcat thread start error");
    }

    if (0 != eng_thread_create( &t2, eng_readmodemat_thread, (void*)dev_info)){
        ENG_LOG("read modemat thread start error");
    }
    return 0;
}
int main(void)
{
	int fd, rc, califlag=0;
	int engtest=0;
	char cmdline[ENG_CMDLINE_LEN];
    eng_thread_t t1,t2, t3,t4, t5;

#if 0
	int index;
	index = eng_sql_string2int_get("index");
	if(index == ENG_SQLSTR2INT_ERR){
		index = 0;
	} else {
		index++;
	}
	eng_sql_string2int_set("index", index);
	memset(cmdline, 0, ENG_CMDLINE_LEN);
	sprintf(cmdline, "logcat > /data/eng_%d.log &", index);
	system(cmdline);

#endif
	eng_sqlite_create();

	memset(cmdline, 0, ENG_CMDLINE_LEN);
	fd = open("/proc/cmdline", O_RDONLY);
	if(fd > 0) {
		rc = read(fd, cmdline, sizeof(cmdline));
		ENG_LOG("ENGTEST_MODE: cmdline=%s\n", cmdline);
		if(rc > 0) {
			if(strstr(cmdline,ENG_CALISTR) != NULL)
				califlag = 1;
			if(strstr(cmdline,"engtest") != NULL)
				engtest = 1;
		}
	}
	ALOGD("eng_pcclient califlag=%d, engtest=%d\n",califlag, engtest);

	if(engtest == 1) {
		eng_ctpcali();
	}

	if(califlag == 1){ //at handler in calibration mode
		eng_atcali_thread();
		return 0;
	}

#ifdef CONFIG_EMMC
	eng_check_factorymode_formmc();
#else
	eng_check_factorymode_fornand();
#endif

	set_vlog_priority();
	
	if (0 != eng_thread_create( &t1, eng_vlog_thread, NULL)){
		ENG_LOG("vlog thread start error");
	}

	if (0 != eng_thread_create( &t2, eng_vdiag_thread, NULL)){
		ENG_LOG("vdiag thread start error");
	}

	if (0 != eng_thread_create( &t3, eng_modemreset_thread, NULL)){
		ENG_LOG("vdiag thread start error");
	}

	if (0 != eng_thread_create( &t4, eng_sd_log, NULL)){
		ENG_LOG("sd log thread start error");
	}


	rc = eng_pcclient_init();

	if(rc == -1) {
		ENG_LOG("%s: init fail, exit\n",__func__);
		return -1;
	}

	if (0 != eng_thread_create( &t5, eng_atauto_thread, NULL)){
		ENG_LOG("atauto thread start error");
	}	

	eng_pcclient_hdlr(NULL);

	return 0;

}