Add API:mbtk_get_modem_version from v2.
Change-Id: I5df09ddfaf0b7d55822e1b0b559b014a36bfdc48
diff --git a/mbtk/mbtk_rild_v2/src/ril_dev.c b/mbtk/mbtk_rild_v2/src/ril_dev.c
index f2de0f1..763ed41 100755
--- a/mbtk/mbtk_rild_v2/src/ril_dev.c
+++ b/mbtk/mbtk_rild_v2/src/ril_dev.c
@@ -474,6 +474,58 @@
return err;
}
+static int req_md_version_get(ATPortType_enum port,void *data, int *cme_err)
+{
+ ATResponse *response = NULL;
+ int err = at_send_command_multiline(port,"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;
+}
+
//void net_list_free(void *data);
// Return MBTK_INFO_ERR_SUCCESS,will call pack_error_send() to send RSP.
@@ -759,6 +811,28 @@
}
break;
}
+ case RIL_MSG_ID_DEV_MD_VERSION_REQ:
+ {
+ if(pack->data_len == 0 || pack->data == NULL) // Get VERSION
+ {
+ char version[50] = {0};
+ if(req_md_version_get(cli_info->port,version, &cme_err) || strlen(version) == 0 || cme_err != MBTK_RIL_ERR_CME_NON)
+ {
+ if(cme_err != MBTK_RIL_ERR_CME_NON) {
+ err = MBTK_RIL_ERR_CME + cme_err;
+ } else {
+ err = MBTK_RIL_ERR_UNKNOWN;
+ }
+ LOG("Get MD Version fail.");
+ }
+ else
+ {
+ ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, version, strlen((char*)version));
+ }
+ }
+ break;
+
+ }
default:
{
err = MBTK_RIL_ERR_REQ_UNKNOWN;