[feature][T8TSK-67][system]The SDK ready mechanism
Change-Id: I163c66524f899aef3e56201d1db8cf7cfb2b8d66
diff --git a/framework/lynq-ril-service/src/main.cpp b/framework/lynq-ril-service/src/main.cpp
index bf6f28e..043068f 100755
--- a/framework/lynq-ril-service/src/main.cpp
+++ b/framework/lynq-ril-service/src/main.cpp
@@ -61,6 +61,29 @@
NULL
};
+/**
+ * @brief success return 1 else return 0
+ *
+ * @return int
+ */
+static int lynq_check_modem_state(void)
+{
+ FILE *fp;
+ char buffer[64]={};
+ fp = popen("cat /sys/kernel/ccci/boot","r");
+ fgets(buffer,sizeof(buffer),fp);
+ if(buffer[4] == '4')
+ {
+ pclose(fp);
+ return 1;
+ }
+ else
+ {
+ pclose(fp);
+ return 0;
+ }
+}
+
int main(int argc, char **argv) {
/*lei add for gsw
reason:Socket sending failed at GSW
@@ -117,6 +140,15 @@
android::startGdbusLoop();
RLOGD("RIL_Init RIL_register completed");
printf("DemoApp launch done!\n");
+ if(!lynq_check_modem_state())
+ {
+ system("uci set lynq_uci.sdk_ready=1");
+ }
+ else
+ {
+ sleep(2);
+ system("uci set lynq_uci.sdk_ready=0");
+ }
while (true) {
sleep(UINT32_MAX);
}
diff --git a/framework/lynq-ril-service/src/ril.cpp b/framework/lynq-ril-service/src/ril.cpp
index e970e9b..2d202f7 100755
--- a/framework/lynq-ril-service/src/ril.cpp
+++ b/framework/lynq-ril-service/src/ril.cpp
@@ -178,6 +178,7 @@
char *at_buf_ext[MAX_AT_CMD];
int sockfd = 0;
int imei_cnt = 0;
+bool sdk_ready = true;
/*lei add*/
#if RILC_LOG
static char printBuf[PRINTBUF_SIZE];
@@ -4249,6 +4250,31 @@
}
}
}
+ /*lei add for sdk ready 2022/8/17*/
+ else
+ {
+ if(sdk_ready == true)
+ {
+ p.setDataPosition(0);
+ if(p.dataAvail() > 0)
+ {
+ p.readInt32(&resp_type);
+ p.readInt32(&request);
+ p.readInt32(&slot_id);
+ p.readInt32(&error1);
+ if(!error1)
+ {
+ system("uci set lynq_uci.sdk_ready=0");
+ }
+ else
+ {
+ system("uci set lynq_uci.sdk_ready=2");
+ }
+ }
+ sdk_ready = false;
+ }
+ }
+ /*lei add for sdk ready 2022/8/17*/
break;
}
/*lei add for AT+CGSN 2022/8/4*/