[Bugfix][SZZT-87][AT]If the sleep is abnormal or the modem is abnormal,the at port cannot be opened properly
[Bugfix][SZZT-88][AT]Sleep is also mandatory without Internet access
Change-Id: I2c1254be7b4f021deca4668bf09565d009984cfc
diff --git a/src/lynq/framework/lynq-atsvc/src/lynq_common.cpp b/src/lynq/framework/lynq-atsvc/src/lynq_common.cpp
index 4e87815..11a0cf1 100755
--- a/src/lynq/framework/lynq-atsvc/src/lynq_common.cpp
+++ b/src/lynq/framework/lynq-atsvc/src/lynq_common.cpp
@@ -731,15 +731,16 @@
*/
void auto_suspend(int argv)
{
- pthread_t thid;
- pthread_attr_t a;
- pthread_attr_init(&a);
- pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED);
- int ret = pthread_create(&thid, &a, thread_test, NULL);
- if(ret != 0){
- RLOGD("pthread_create error!!!");
- return;
- }
+ // pthread_t thid;
+ // pthread_attr_t a;
+ // pthread_attr_init(&a);
+ // pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED);
+ // int ret = pthread_create(&thid, &a, thread_test, NULL);
+ // if(ret != 0){
+ // RLOGD("pthread_create error!!!");
+ // return;
+ // }
+ system("echo 11 | emdlogger_ctrl");
int res = system("mdlogctl stop");
//printf("auto_suspend mdlogctl stop ret %d\n", res);
res = system("echo 0 > /dev/wmtWifi");
@@ -794,8 +795,9 @@
{
if(g_lynq_mwakeupcfg)//means need autosleep,so wait
{
+ int i = 50;
/*wait*/
- while (1)
+ while (i)
{
if(sleep_end == 1)
{
@@ -804,8 +806,10 @@
}
RLOGD("check_autosleep need to wait\n");//reason:1.worst:network is not online need wait 10+1(s);2.autosleep not completed
sleep(1);
+ i--;
}
/*wait*/
+ sleep_end = 1;
//printf("g_lynq_mwakeupcfg %d no need to wait\n", g_lynq_mwakeupcfg);
}
diff --git a/src/lynq/framework/lynq-atsvc/src/main.cpp b/src/lynq/framework/lynq-atsvc/src/main.cpp
index 3bf12f6..6529ab2 100755
--- a/src/lynq/framework/lynq-atsvc/src/main.cpp
+++ b/src/lynq/framework/lynq-atsvc/src/main.cpp
@@ -141,6 +141,7 @@
*/
static int lynq_ensure_online(void)
{
+ #if 0
/*ensure inject 2G/3G/4G*/
int slot_id = get_default_sim_all();
int i = 3;
@@ -163,7 +164,8 @@
i--;
}
printf("%s i %d\n",__FUNCTION__, i);
- return i;
+ #endif
+ return 1;
}
/**
@@ -192,6 +194,7 @@
{
RLOGD("means user must be configed it go to sleep\n");
//printf("means user must be configed it go to sleep\n");
+ sleep(5);//for too early to send command cause fail
auto_suspend(g_lynq_mpwrsm);
//sleep(4);
}