Add RIL 5G support.
Change-Id: I06020103aad9a5f1975b49fbe494cbecbfac4b7f
diff --git a/mbtk/mbtk_rild_v2/src/main.c b/mbtk/mbtk_rild_v2/src/main.c
index da1e040..0823105 100755
--- a/mbtk/mbtk_rild_v2/src/main.c
+++ b/mbtk/mbtk_rild_v2/src/main.c
@@ -721,6 +721,7 @@
// $CREG: 1, "8330", "06447347", 7,"0d4", 2, 0
// $CREG: 1, "8010", "000060a7", 0,, 2, 0
// +CGREG: 1
+// +C5GREG: 1,"00280386","07e920010",11,1,"01"
static void urc_net_reg_state_change_process(const char *s, const char *sms_pdu)
{
mbtk_ril_net_reg_state_info_t state;
@@ -732,6 +733,8 @@
state.type = MBTK_NET_REG_TYPE_CALL;
} else if(strStartsWith(s, "+CGREG:")) {
state.type = MBTK_NET_REG_TYPE_DATA_GSM_WCDMA;
+ } else if(strStartsWith(s, "+C5GREG:")) {
+ state.type = MBTK_NET_REG_TYPE_DATA_NR;
} else {
state.type = MBTK_NET_REG_TYPE_DATA_LTE;
}
@@ -749,23 +752,24 @@
goto CGREG_EXIT;
}
state.reg_state = (mbtk_net_reg_state_enum)tmp_int; // Reg State.
- if (state.reg_state) // Reg
+ if (state.reg_state && at_tok_hasmore(&line)) // Reg
{
- if (at_tok_nextstr(&line, &tmp_str) < 0)
+ if (at_tok_nextstr(&line, &tmp_str) < 0) // tac
{
goto CGREG_EXIT;
}
+ state.tac = (uint64)strtoull(tmp_str, NULL, 16);
- if (at_tok_nextstr(&line, &tmp_str) < 0)
+ if (at_tok_nextstr(&line, &tmp_str) < 0) // ci
{
goto CGREG_EXIT;
}
+ state.ci = (uint64)strtoull(tmp_str, NULL, 16);
if (at_tok_nextint(&line, &tmp_int) < 0)
{
goto CGREG_EXIT;
}
-
state.tech = (mbtk_radio_technology_enum)tmp_int; // AcT
}
@@ -1087,6 +1091,286 @@
static void urc_cell_info_process(const char *s, const char *sms_pdu)
{
+ // +EEMNRSVC: <mcc>,<lenOfMnc>,<mnc>,<tac>,<phyCellId>,<dlNrArfcn>,<dlScs>,<ulNrArfcn>,<ulScs>,<sulNrArfcn>,<sulScs>,<band>,<dlBandwidth>,<cellId>,<IsRedCapCell>,<longDRXCyclePresent>,<shortDRXCyclePresent>,<longDRXCycle>,<shortDRXCycle>,<pagingCycle>,
+ // <rsrp>,<rsrq>,<sinr>,<rssi>,<qRxLevMin>,<qQualMin>,<srxlev>,
+ // <pathLoss>,
+ // <dlBler>,<averDlPRB>,<averDlMcs>,<averDlPortNum>,<averCQI>,<averLi>,<averRi>,<dlThroughPut>,<dlPeakThroughPut>,
+ // <ulBler>,<averUlPRB>,<averUlMcs>,<averUlPortNum>,<currPuschTxPower>,<currPucchTxPower>,<grantTotal>,<ulThroughPut>,<ulPeakThroughPut>,
+ // <nrrcModeState>,<nmmState>,<serviceState>,<IsSingleNmmRejectCause>,<NMMRejectCause>,<amfRegionId>,<amfSetId>,<amfPointer>,<nrTmsi>,
+ // <ulBandwidth>,<dlInitialBwpFreq>,<ulInitialBwpFreq>
+ /*
+ +EEMNRSVC: 1120, 2, 0, 2622342, 137, 158650, 0, 146678, 0, 0, 255, 28, 79, 620598788208, 0, 0, 0, 0, 0, 64,
+ 86, 65, 86, 51, 20, 0, 49,
+ 0,
+ 0, 0, 0, 0, 38, 0, 8, 0, 0,
+ 0, 256, 24, 16, 13, 20, 2, 2, 0,
+ 1, 10, 0, 1, 0, 9, 128, 5, 2358781729,
+ 79, 788390, 733390
+ */
+ if(strStartsWith(s, "+EEMNRSVC:")) {
+ // mcc,lenOfMnc,mnc,tac,PCI,dlNrArfcn,ulNrArfcn,band,rsrp,rsrq,sinr,rssi
+ // cellID
+ if(cell_info.running) {
+ int tmp_int;
+ int i = 0;
+ char* tmp_s = memdup(s,strlen(s) + 1);
+ char* free_ptr = tmp_s;
+ char *line = tmp_s;
+ char *tmp_str;
+ if (at_tok_start(&line) < 0)
+ {
+ goto EEMNRSVC_EXIT;
+ }
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // mcc
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value1 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // lenOfMnc
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value2 = (uint32)tmp_int;
+ if (at_tok_nextint(&line, &tmp_int) < 0) // mnc
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value3 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // tac
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value4 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // pci
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value5 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // dlNrArfcn
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value6 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // dlScs
+ {
+ goto EEMNRSVC_EXIT;
+ }
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // ulNrArfcn
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value7 = (uint32)tmp_int;
+
+ // <ulScs>,<sulNrArfcn>,<sulScs>
+ for(i =0; i < 3; i++)
+ {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ }
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // band
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value8 = (uint32)tmp_int;
+
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // dlBandwidth
+ {
+ goto EEMNRSVC_EXIT;
+ }
+
+
+ if (at_tok_nextstr(&line, &tmp_str) < 0) // cellId
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ // LOGD("cellID-str : %s", tmp_str);
+ cell_info.cell_list.cell[cell_info.cell_list.num].value64_1 = (uint64)strtoull(tmp_str, NULL, 10);
+ // LOGD("cellID : %llu", cell_info.cell_list.cell[cell_info.cell_list.num].value64_1);
+
+ // <IsRedCapCell>,<longDRXCyclePresent>,<shortDRXCyclePresent>,<longDRXCycle>,<shortDRXCycle>,<pagingCycle>
+ for(i =0; i < 6; i++)
+ {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ }
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // <rsrp>
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value9 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // <rsrq>
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value10 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // <sinr>
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value11 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // <rssi>
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value12 = (uint32)tmp_int;
+
+ cell_info.cell_list.num++;
+
+EEMNRSVC_EXIT:
+ free(free_ptr);
+ }
+ }
+ // +EEMNRINTER: <index>,<phyCellId>,<nrArfcn>,<dlScs>,<rsrp>,<rsrq>,<sinr>,<srxlev>,<mcc>,<lenOfMnc>,<mnc>,<tac>,<cellId>
+ /* +EEMNRINTER: 0, 508, 723360, 0, 39, 64, -8, 1, 0, 0, 0, 0, 4294967295 */
+ /* +EEMNRINTER: 1, 254, 723360, 0, 45, 72, 1, 7, 0, 0, 0, 0, 4294967295 */
+ /* +EEMNRINTER: 2, 595, 723360, 0, 40, 65, -5, 3, 0, 0, 0, 0, 4294967295 */
+ else if(strStartsWith(s, "+EEMNRINTER:")) {
+ // phyCellId,nrArfcn,rsrp,rsrq
+ if(cell_info.running) {
+ int tmp_int;
+ char* tmp_s = memdup(s,strlen(s) + 1);
+ char* free_ptr = tmp_s;
+ char *line = tmp_s;
+ if (at_tok_start(&line) < 0)
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ if (at_tok_nextint(&line, &tmp_int) < 0) // index
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int > 1007) // phyCellId (0 - 1007)
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value1 = (uint32)tmp_int;
+ if (at_tok_nextint(&line, &tmp_int) < 0) // nrArfcn
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value2 = (uint32)tmp_int;
+ if (at_tok_nextint(&line, &tmp_int) < 0) // dlScs
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ if (at_tok_nextint(&line, &tmp_int) < 0) // rsrp
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value3 = (uint32)tmp_int;
+ if (at_tok_nextint(&line, &tmp_int) < 0) // rsrq
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value4 = (uint32)tmp_int;
+
+ cell_info.cell_list.num++;
+EEMNRINTER_EXIT:
+ free(free_ptr);
+ }
+ }
+ // +EEMNRINTERRAT:<net_type>,<numInterRATEutra>,
+ // <earfcn>,<physCellId>,<rsrp>,<rsrq>,<sinr>,<mcc>,<lenOfMnc>,<mnc>,<tac>
+ // ......
+ // <earfcn>,<physCellId>,<rsrp>,<rsrq>,<sinr>,<mcc>,<lenOfMnc>,<mnc>,<tac>
+ /*
+ +EEMNRINTERRAT: 2, 6, // LTE
+ 1300, 423, 0, 0, 0, 0, 0, 0, 0,
+ 1300, 137, 0, 0, 0, 0, 0, 0, 0,
+ 1300, 149, 0, 0, 0, 0, 0, 0, 0,
+ 1300, 494, 0, 0, 0, 0, 0, 0, 0,
+ 1300, 337, 0, 0, 0, 0, 0, 0, 0,
+ 1300, 288, 0, 0, 0, 0, 0, 0, 0
+ */
+ /*
+ +EEMNRINTERRAT: 1, 0 // UMTS
+ */
+ else if(strStartsWith(s, "+EEMNRINTERRAT:")) {
+ // phyCellId,nrArfcn,rsrp,rsrq
+ if(cell_info.running) {
+ int tmp_int;
+ char* tmp_s = memdup(s,strlen(s) + 1);
+ char* free_ptr = tmp_s;
+ char *line = tmp_s;
+ if (at_tok_start(&line) < 0)
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ if (at_tok_nextint(&line, &tmp_int) < 0) // net_type
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+
+#define CI_DEV_EM_NETWORK_LTE 2
+
+ // Only support LTE.
+ if(tmp_int == CI_DEV_EM_NETWORK_LTE) { // LTE
+ int num;
+ int i, j;
+ if (at_tok_nextint(&line, &num) < 0) // numInterRATEutra
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ LOGD("LTE-RAT num : %d", num);
+ for(i = 0; i < num; i++) {
+ if (at_tok_nextint(&line, &tmp_int) < 0) // earfcn
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value2 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // physCellId
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value1 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // rsrp
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value3 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // rsrq
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value4 = (uint32)tmp_int;
+
+ // Jump 5 items.
+ j = 0;
+ while(j < 5) {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ j++;
+ }
+
+ cell_info.cell_list.num++;
+ }
+ }
+EEMNRINTERRAT_EXIT:
+ free(free_ptr);
+ }
+ }
/*
// <mcc>, <length of mnc>, <mnc>, <tac>, <PCI>, <dlEuarfcn>, < ulEuarfcn >, <band>, <dlBandwidth>,
// <rsrp>,<rsrq>, <sinr>,
@@ -1105,7 +1389,7 @@
0, 0,
7, 44
*/
- if(strStartsWith(s, "+EEMLTESVC:")) // LTE Server Cell
+ else if(strStartsWith(s, "+EEMLTESVC:")) // LTE Server Cell
{
// tac, PCI, dlEuarfcn, ulEuarfcn, band
if(cell_info.running) {
@@ -1735,7 +2019,9 @@
} else if(strStartsWith(s, "CONNECT") || strStartsWith(s, "+CGEV:")) {
urc_pdp_state_change_process(s, sms_pdu);
- } else if(strStartsWith(s, "+EEMLTESVC:") || strStartsWith(s, "+EEMLTEINTER:")
+ } else if(strStartsWith(s, "+EEMNRSVC:") || strStartsWith(s, "+EEMNRINTER:")
+ || strStartsWith(s, "+EEMNRINTERRAT:")
+ || strStartsWith(s, "+EEMLTESVC:") || strStartsWith(s, "+EEMLTEINTER:")
|| strStartsWith(s, "+EEMLTEINTRA:") || strStartsWith(s, "+EEMLTEINTERRAT:")
|| strStartsWith(s, "+EEMUMTSSVC:") || strStartsWith(s, "+EEMUMTSINTRA:")
|| strStartsWith(s, "+EEMUMTSINTERRAT:") || strStartsWith(s, "+EEMGINFOBASIC:")
@@ -1766,9 +2052,11 @@
// $CREG: 1, "8330", "06447347", 7,"0d4", 2, 0
// $CREG: 1, "8010", "000060a7", 0,, 2, 0
// +CGREG: 1
+ // +C5GREG: 1,"00280386","07e920010",11,1,"01"
else if(strStartsWith(s, "+CGREG:") // GMS/WCDMA data registed.
|| strStartsWith(s, "+CEREG:") // LTE data registed.
- || strStartsWith(s, "+CREG:")) // GMS/WCDMA/LTE CS registed.
+ || strStartsWith(s, "+CREG:") // GMS/WCDMA/LTE CS registed.
+ || strStartsWith(s, "+C5GREG:")) // NR data registed.
{
urc_net_reg_state_change_process(s, sms_pdu);
}
@@ -2497,6 +2785,102 @@
return NULL;
}
+static void band_support_init()
+{
+ mbtk_device_info_modem_t info_modem;
+ memset(&band_info.band_support, 0, sizeof(mbtk_band_info_t));
+ memset(&info_modem, 0, sizeof(mbtk_device_info_modem_t));
+#ifdef MBTK_DEV_INFO_VERSION_2
+ 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;
+#ifdef MBTK_5G_SUPPORT
+ band_info.band_support.net_pref = MBTK_NET_PREF_LTE_NR_NR_PREF; // 19
+ band_info.net_support = MBTK_NET_SUPPORT_4G | MBTK_NET_SUPPORT_5G;
+
+ band_info.band_support.gsm_band = 0;
+ band_info.band_support.umts_band = 0;
+ band_info.band_support.tdlte_band = MBTK_BAND_ALL_TDLTE_DEFAULT;
+ band_info.band_support.fddlte_band = MBTK_BAND_ALL_FDDLTE_DEFAULT;
+ band_info.band_support.lte_ext_band = MBTK_BAND_ALL_EXT_LTE_DEFAULT;
+
+ band_info.band_support.nr_3_band = MBTK_BAND_ALL_NR_3_DEFAULT;
+ band_info.band_support.nr_2_band = MBTK_BAND_ALL_NR_2_DEFAULT;
+ band_info.band_support.nr_1_band = MBTK_BAND_ALL_NR_1_DEFAULT;
+ band_info.band_support.nr_0_band = MBTK_BAND_ALL_NR_0_DEFAULT;
+#else
+ band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
+ band_info.net_support = MBTK_NET_SUPPORT_2G | MBTK_NET_SUPPORT_3G | MBTK_NET_SUPPORT_4G;
+
+ 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;
+ band_info.band_support.fddlte_band = MBTK_BAND_ALL_FDDLTE_DEFAULT;
+ band_info.band_support.lte_ext_band = MBTK_BAND_ALL_EXT_LTE_DEFAULT;
+
+ band_info.band_support.nr_3_band = 0;
+ band_info.band_support.nr_2_band = 0;
+ band_info.band_support.nr_1_band = 0;
+ band_info.band_support.nr_0_band = 0;
+#endif
+ } else {
+ band_info.band_area = info_modem.band_area;
+ band_info.net_support = info_modem.net_support;
+ if(info_modem.net_pref < MBTK_NET_PREF_MAX) {
+ band_info.band_support.net_pref = info_modem.net_pref;
+ } else {
+ if(band_info.net_support & MBTK_NET_SUPPORT_5G) {
+ band_info.band_support.net_pref = MBTK_NET_PREF_LTE_NR_NR_PREF; // 19
+ } else {
+ band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
+ }
+ }
+ 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;
+ band_info.band_support.fddlte_band = info_modem.band_fddlte;
+ band_info.band_support.lte_ext_band = info_modem.band_lte_ext;
+
+ band_info.band_support.nr_3_band = info_modem.band_nr_3;
+ band_info.band_support.nr_2_band = info_modem.band_nr_2;
+ band_info.band_support.nr_1_band = info_modem.band_nr_1;
+ band_info.band_support.nr_0_band = info_modem.band_nr_0;
+ }
+#else
+ 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_GSM_UMTS_LTE_LTE_PREF; // 15
+ band_info.net_support = MBTK_NET_SUPPORT_2G | MBTK_NET_SUPPORT_3G | MBTK_NET_SUPPORT_4G;
+
+ 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;
+ band_info.band_support.fddlte_band = MBTK_BAND_ALL_FDDLTE_DEFAULT;
+ band_info.band_support.lte_ext_band = MBTK_BAND_ALL_EXT_LTE_DEFAULT;
+
+ band_info.band_support.nr_3_band = 0;
+ band_info.band_support.nr_2_band = 0;
+ band_info.band_support.nr_1_band = 0;
+ band_info.band_support.nr_0_band = 0;
+ } else {
+ band_info.band_area = info_modem.band_area;
+ band_info.net_support = MBTK_NET_SUPPORT_2G | MBTK_NET_SUPPORT_3G | MBTK_NET_SUPPORT_4G;
+ band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
+ 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;
+ band_info.band_support.fddlte_band = info_modem.band_fddlte;
+ band_info.band_support.lte_ext_band = info_modem.band_lte_ext;
+
+ band_info.band_support.nr_3_band = 0;
+ band_info.band_support.nr_2_band = 0;
+ band_info.band_support.nr_1_band = 0;
+ band_info.band_support.nr_0_band = 0;
+ }
+#endif
+}
+
static void* ril_process_thread(void* arg)
{
UNUSED(arg);
@@ -2559,69 +2943,7 @@
*/
static void* band_config_thread()
{
- mbtk_device_info_modem_t info_modem;
- memset(&band_info.band_support, 0, sizeof(mbtk_band_info_t));
- memset(&info_modem, 0, sizeof(mbtk_device_info_modem_t));
band_info.band_set_success = FALSE;
- 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;
-#ifdef MBTK_DEV_INFO_VERSION_2
-
-#ifdef MBTK_5G_SUPPORT
- band_info.band_support.net_pref = MBTK_NET_PREF_LTE_NR_NR_PREF; // 19
- band_info.net_support = MBTK_NET_SUPPORT_4G | MBTK_NET_SUPPORT_5G;
-#else
- band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
- band_info.net_support = MBTK_NET_SUPPORT_2G | MBTK_NET_SUPPORT_3G | MBTK_NET_SUPPORT_4G;
-#endif
-
-#else
-
- band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
-
-#endif
- 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;
- band_info.band_support.fddlte_band = MBTK_BAND_ALL_FDDLTE_DEFAULT;
- band_info.band_support.lte_ext_band = MBTK_BAND_ALL_EXT_LTE_DEFAULT;
-
-#ifdef MBTK_DEV_INFO_VERSION_2
- band_info.band_support.nr_3_band = MBTK_BAND_ALL_NR_3_DEFAULT;
- band_info.band_support.nr_2_band = MBTK_BAND_ALL_NR_2_DEFAULT;
- band_info.band_support.nr_1_band = MBTK_BAND_ALL_NR_1_DEFAULT;
- band_info.band_support.nr_0_band = MBTK_BAND_ALL_NR_0_DEFAULT;
-#endif
- } else {
- band_info.band_area = info_modem.band_area;
-#ifdef MBTK_DEV_INFO_VERSION_2
- band_info.net_support = info_modem.net_support;
- if(info_modem.net_pref < MBTK_NET_PREF_MAX) {
- band_info.band_support.net_pref = info_modem.net_pref;
- } else {
- if(band_info.net_support & MBTK_NET_SUPPORT_5G) {
- band_info.band_support.net_pref = MBTK_NET_PREF_LTE_NR_NR_PREF; // 19
- } 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;
- band_info.band_support.fddlte_band = info_modem.band_fddlte;
- band_info.band_support.lte_ext_band = info_modem.band_lte_ext;
-#ifdef MBTK_DEV_INFO_VERSION_2
- band_info.band_support.nr_3_band = info_modem.band_nr_3;
- band_info.band_support.nr_2_band = info_modem.band_nr_2;
- band_info.band_support.nr_1_band = info_modem.band_nr_1;
- band_info.band_support.nr_0_band = info_modem.band_nr_0;
-#endif
- }
-
// bool is_first = TRUE;
while(!band_info.band_set_success) {
// Set band.
@@ -2664,6 +2986,9 @@
//check cfun and sim card status
ril_at_ready_process();
+
+ // Init support band.
+ band_support_init();
//any AT instruction that is not sent through pack_process_thread needs to precede the thread
//thread create