[Feature][T8TSK-88][AT]Restart the modem AT command(AT+LRSTMD)
Change-Id: I019d11dc46c5c9f8aba5e4a9a2d9404f6d4597ac
diff --git a/framework/lynq-ril-service/src/ril.cpp b/framework/lynq-ril-service/src/ril.cpp
index f989839..9a8ee83 100755
--- a/framework/lynq-ril-service/src/ril.cpp
+++ b/framework/lynq-ril-service/src/ril.cpp
@@ -82,6 +82,7 @@
#include "lynq_user.h"
#include "lynq_rndis.h"
#include "lynq_factory.h"
+#include <sys/stat.h>
/*lei add*/
/*rita add start*/
#include "lynq_at_temp.h"
@@ -6466,6 +6467,44 @@
return NULL;
}
+static void wait_reset_mipc_response(void)
+{
+ int outfd = open("/data/tp",O_RDONLY);
+ if(outfd == -1){
+ RLOGD("open error");
+ return;
+ }
+ char rst[1024];
+ char response[2048];
+ int s;
+ s = read(outfd,rst,sizeof(rst));
+ if (s>0)
+ {
+ RLOGD("lei buf: %s \n", rst);
+ /*respone ok or error*/
+ if(rst[0] = '0')
+ {
+ sprintf(response,"%s%s","+LRSTMD:",rst);
+ /*check fd can or can't write*/
+ write(ttyGS3_fd,response,strlen(response));
+ write(ttyGS3_fd,"\nOK\n",4);
+ }
+ else
+ {
+ sprintf(response,"%s%s","+CME ERROR:",rst);
+ /*check fd can or can't write*/
+ write(ttyGS3_fd,response,strlen(response));
+ }
+ }
+ else
+ {
+ RLOGD("wait_reset_mipc_response unknow error\n");
+ }
+ usleep(1);
+ close(outfd);
+ return;
+}
+
void startUsbLoop(void)
{
/*lei add*/
@@ -6559,6 +6598,11 @@
{
RLOGD("LYNQ send ATCMD:%s!!!",argv[1]);
lynqSendAt(argc,argv,1010);
+ usleep(50*1000);
+ if(!strcmp(buffer, "AT+LRSTMD"))
+ {
+ wait_reset_mipc_response();
+ }
continue;
}
if(!((1<<atoi(argv[2])) & (atCmd->support)))