add new api for mbtk,get modem version
Change-Id: I8cebf6552ee47eef2c8d2e980a0d6436c9a55ef8
diff --git a/mbtk/mbtk_rild/src/mbtk_info_server.c b/mbtk/mbtk_rild/src/mbtk_info_server.c
index d582fb4..f09e33c 100755
--- a/mbtk/mbtk_rild/src/mbtk_info_server.c
+++ b/mbtk/mbtk_rild/src/mbtk_info_server.c
@@ -1202,6 +1202,61 @@
return err;
}
+
+static int req_md_version_get(void *data, int *cme_err)
+{
+ ATResponse *response = NULL;
+ int err = at_send_command_multiline("AT*CGMR", "", &response);
+
+ if (err < 0 || response->success == 0 || !response->p_intermediates)
+ {
+ *cme_err = at_get_cme_error(response);
+ goto exit;
+ }
+
+ ATLine* lines_ptr = response->p_intermediates;
+ char *line = NULL;
+ while(lines_ptr)
+ {
+ line = lines_ptr->line;
+ char *start = strstr(line, "FALCON_CP_SDK");
+ if(start)
+ {
+ char *end = strstr(start, "_Linux");
+ if(end)
+ {
+ end += strlen("_Linux");
+ int length = end - start;
+ if (length)
+ {
+ strncpy(data, start, length);
+ ((char*)data)[length] = '\0';
+ break;
+ }
+ else
+ {
+ err = -1;
+ goto exit;
+
+ }
+ }
+ else
+ {
+ err = -1;
+ goto exit;
+ }
+ }
+ lines_ptr = lines_ptr->p_next;
+ }
+
+ goto exit;
+exit:
+ at_response_free(response);
+ return err;
+}
+
+
+
/*
ATI
Manufacturer:"LYNQ"
@@ -4224,6 +4279,33 @@
}
break;
}
+ case MBTK_INFO_ID_DEV_MD_VERSION_REQ:
+ {
+ if(pack->data_len == 0 || pack->data == NULL) // Get VERSION
+ {
+ char version[50] = {0};
+ if(req_md_version_get(version, &cme_err) || strlen(version) == 0 || cme_err != MBTK_INFO_ERR_CME_NON)
+ {
+ if(cme_err != MBTK_INFO_ERR_CME_NON) {
+ err = MBTK_INFO_ERR_CME + cme_err;
+ } else {
+ err = MBTK_INFO_ERR_UNKNOWN;
+ }
+ LOG("Get Version fail.");
+ }
+ else
+ {
+ pack_rsp_send(cli_info->fd, MBTK_INFO_ID_DEV_MD_VERSION_RSP, version, strlen(version));
+ }
+ }
+ else // Set MD_VERSION(Unsupport).
+ {
+ err = MBTK_INFO_ERR_UNSUPPORTED;
+ LOG("Unsupport set MD_VERSION.");
+ }
+ break;
+
+ }
case MBTK_INFO_ID_DEV_MODEL_REQ: //MODEL
{
if(pack->data_len == 0 || pack->data == NULL) // Get MODEL