Add dev_info v2(Default is v1)
Change-Id: I49693856ab5c97a5df3c199ed75091c4eee1800b
diff --git a/mbtk/mbtk_rild_v2/src/main.c b/mbtk/mbtk_rild_v2/src/main.c
index 0068bd3..a17e3d7 100755
--- a/mbtk/mbtk_rild_v2/src/main.c
+++ b/mbtk/mbtk_rild_v2/src/main.c
@@ -98,6 +98,7 @@
void data_call_state_change_cb(int cid, bool action, bool auto_change, int reason);
static int send_pack_to_queue(sock_cli_info_t* cli_info, void* pack);
+int req_band_set(ATPortType_enum port, mbtk_band_info_t* band, int *cme_err);
/* Called on command thread */
static void onATTimeout()
@@ -2252,9 +2253,10 @@
static void urc_msg_process(ril_urc_msg_info_t *msg)
{
+ // data can be NULL (For RIL_URC_MSG_BAND_SET)
if(!msg->data || msg->data_len <= 0) {
- LOGE("URC data is NULL.");
- return;
+ LOGW("URC data is NULL.");
+ // return;
}
switch(msg->msg) {
@@ -2281,6 +2283,30 @@
data_call_retry(ATPORTTYPE_0, reg_state);
break;
}
+ case RIL_URC_MSG_BAND_SET:
+ {
+ int cme_err = MBTK_RIL_ERR_CME_NON;
+ if(req_band_set(ATPORTTYPE_0, &band_info.band_support, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ {
+ LOGE("Set band fail.");
+ }
+ else // Set band success.
+ {
+ // log_hex("BAND-2", &band_set_info, sizeof(band_set_info_t));
+ band_info.band_set_success = TRUE;
+ if(band_info.band_area == MBTK_MODEM_BAND_AREA_CN) {
+ property_set("persist.mbtk.band_config", "CN");
+ } else if(band_info.band_area == MBTK_MODEM_BAND_AREA_EU) {
+ property_set("persist.mbtk.band_config", "EU");
+ } else if(band_info.band_area == MBTK_MODEM_BAND_AREA_SA) {
+ property_set("persist.mbtk.band_config", "SA");
+ } else {
+ property_set("persist.mbtk.band_config", "ALL");
+ }
+ LOGD("Set band success.");
+ }
+ break;
+ }
default:
{
LOGE("Unknown URC : %d", msg->msg);
@@ -2506,7 +2532,7 @@
if(mbtk_dev_info_read(MBTK_DEVICE_INFO_ITEM_MODEM, &(info_modem), sizeof(mbtk_device_info_modem_t))) {
LOGD("mbtk_dev_info_read(MODEM) fail, use default band.");
band_info.band_area = MBTK_MODEM_BAND_AREA_ALL;
- band_info.band_support.net_pref = MBTK_NET_PREF_UNUSE;
+ band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
band_info.band_support.gsm_band = MBTK_BAND_ALL_GSM_DEFAULT;
band_info.band_support.umts_band = MBTK_BAND_ALL_WCDMA_DEFAULT;
band_info.band_support.tdlte_band = MBTK_BAND_ALL_TDLTE_DEFAULT;
@@ -2514,7 +2540,15 @@
band_info.band_support.lte_ext_band = MBTK_BAND_ALL_EXT_LTE_DEFAULT;
} else {
band_info.band_area = info_modem.band_area;
- band_info.band_support.net_pref = MBTK_NET_PREF_UNUSE;
+#ifdef MBTK_DEV_INFO_VERSION_2
+ if(info_modem.net_pref < MBTK_NET_PREF_MAX) {
+ band_info.band_support.net_pref = info_modem.net_pref;
+ } else {
+ band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
+ }
+#else
+ band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
+#endif
band_info.band_support.gsm_band = info_modem.band_gsm;
band_info.band_support.umts_band = info_modem.band_wcdma;
band_info.band_support.tdlte_band = info_modem.band_tdlte;
@@ -2525,24 +2559,24 @@
// bool is_first = TRUE;
while(!band_info.band_set_success) {
// Set band.
+#if 1
+ ril_urc_msg_info_t *msg = (ril_urc_msg_info_t*)malloc(sizeof(ril_urc_msg_info_t));
+ if(msg) {
+ msg->msg = RIL_URC_MSG_BAND_SET;
+ msg->data = NULL;//mbtk_memcpy(&band_info, sizeof(ril_band_info_t));
+ msg->data_len = 0; //sizeof(ril_band_info_t);
#if 0
- info_urc_msg_t *urc = (info_urc_msg_t*)malloc(sizeof(info_urc_msg_t));
- if(!urc)
- {
- LOG("malloc() fail[%d].", errno);
- break;
- } else {
- urc->msg = INFO_URC_MSG_SET_BAND;
- urc->data = NULL;
- urc->data_len = 0;
- send_pack_to_queue(NULL, urc);
-
- if(is_first) {
- is_first = FALSE;
- } else {
- LOGE("*BAND exec error, will retry in 5s.");
+ if(msg->data == NULL) {
+ LOGE("mbtk_memcpy() fail.");
+ break;
}
+#endif
+ send_pack_to_queue(NULL, msg);
+
sleep(5);
+ } else {
+ LOG("malloc() fail[%d].", errno);
+ break;
}
#else
sleep(5);