Fix dev_info

Change-Id: If0239f3821c5ff984a35c43cb528f09eafcbf3e5
diff --git a/mbtk/mbtk_rild_v2/inc/ril_info.h b/mbtk/mbtk_rild_v2/inc/ril_info.h
index 9db80c6..23a4ee6 100755
--- a/mbtk/mbtk_rild_v2/inc/ril_info.h
+++ b/mbtk/mbtk_rild_v2/inc/ril_info.h
@@ -67,6 +67,7 @@
 
 typedef struct {
     bool band_set_success;
+    uint32 net_support; // MBTK_NET_SUPPORT_2G / MBTK_NET_SUPPORT_3G / MBTK_NET_SUPPORT_4G / MBTK_NET_SUPPORT_5G
     mbtk_modem_band_area_enum band_area;
     mbtk_band_info_t band_support;
 } ril_band_info_t;
diff --git a/mbtk/mbtk_rild_v2/src/main.c b/mbtk/mbtk_rild_v2/src/main.c
index 881c12b..f768ce6 100755
--- a/mbtk/mbtk_rild_v2/src/main.c
+++ b/mbtk/mbtk_rild_v2/src/main.c
@@ -2564,30 +2564,49 @@
     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.");
+        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;

+#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

         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 = 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_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 {

-            band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF;  // 15

+            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

+        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;

+        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;

     }
 
 //    bool is_first = TRUE;

diff --git a/mbtk/mbtk_rild_v2/src/ril_net.c b/mbtk/mbtk_rild_v2/src/ril_net.c
index 502d49e..6f2ad50 100755
--- a/mbtk/mbtk_rild_v2/src/ril_net.c
+++ b/mbtk/mbtk_rild_v2/src/ril_net.c
@@ -259,7 +259,9 @@
     int err = -1;
 
     if(band->gsm_band == 0 && band->umts_band == 0
-        && band->tdlte_band == 0 && band->fddlte_band == 0) {
+        && band->tdlte_band == 0 && band->fddlte_band == 0 && band->lte_ext_band == 0
+        && band->nr_3_band == 0 && band->nr_2_band == 0
+        && band->nr_1_band == 0 && band->nr_0_band == 0) {
         sprintf(cmd, "AT*BAND=%d", band->net_pref);
     } else {
         log_hex("BAND_SUPPORT", &band_info.band_support, sizeof(mbtk_band_info_t));
@@ -277,6 +279,21 @@
         if(band->fddlte_band == 0) {
             band->fddlte_band = band_info.band_support.fddlte_band;
         }
+        if(band->lte_ext_band == 0) {
+            band->lte_ext_band = band_info.band_support.lte_ext_band;
+        }
+        if(band->nr_3_band == 0) {
+            band->nr_3_band = band_info.band_support.nr_3_band;
+        }
+        if(band->nr_2_band == 0) {
+            band->nr_2_band = band_info.band_support.nr_2_band;
+        }
+        if(band->nr_1_band == 0) {
+            band->nr_1_band = band_info.band_support.nr_1_band;
+        }
+        if(band->nr_0_band == 0) {
+            band->nr_0_band = band_info.band_support.nr_0_band;
+        }
 
         if((band->gsm_band & band_info.band_support.gsm_band) != band->gsm_band) {
             LOG("GSM band error.");
@@ -303,6 +320,26 @@
             goto exit;
         }
 
+        if((band->nr_3_band & band_info.band_support.nr_3_band) != band->nr_3_band) {
+            LOG("nr_3_band band error.");
+            goto exit;
+        }
+
+        if((band->nr_2_band & band_info.band_support.nr_2_band) != band->nr_2_band) {
+            LOG("nr_2_band band error.");
+            goto exit;
+        }
+
+        if((band->nr_1_band & band_info.band_support.nr_1_band) != band->nr_1_band) {
+            LOG("nr_1_band band error.");
+            goto exit;
+        }
+
+        if((band->nr_0_band & band_info.band_support.nr_0_band) != band->nr_0_band) {
+            LOG("nr_0_band band error.");
+            goto exit;
+        }
+
         if(band->net_pref == 0xFF) { // No change net_pref.
             int tmp_int;
             err = at_send_command_singleline(port, "AT*BAND?", "*BAND:", &response);
@@ -330,10 +367,22 @@
             at_response_free(response);
         }
 
-        if(band->lte_ext_band > 0) {
-            sprintf(cmd, "AT*BAND=%d,%d,%d,%d,%d,,,,%d", band->net_pref, band->gsm_band, band->umts_band, band->tdlte_band, band->fddlte_band, band->lte_ext_band);
+        // Only support 4G/5G
+        if(band_info.net_support & MBTK_NET_SUPPORT_5G) {
+            // AT*band=19,0,0,482,134742231,0,24576,256,134217877,0
+            if(band->lte_ext_band > 0) {
+                sprintf(cmd, "AT*BAND=%d,%d,%d,%d,%d,%d,%d,%d,%d,0,,,,%d", band->net_pref, band->gsm_band, band->umts_band, band->tdlte_band, band->fddlte_band,
+                    band->nr_3_band, band->nr_2_band, band->nr_1_band, band->nr_0_band, band->lte_ext_band);
+            } else {
+                sprintf(cmd, "AT*BAND=%d,%d,%d,%d,%d,%d,%d,%d,%d,0", band->net_pref, band->gsm_band, band->umts_band, band->tdlte_band, band->fddlte_band,
+                    band->nr_3_band, band->nr_2_band, band->nr_1_band, band->nr_0_band);
+            }
         } else {
-            sprintf(cmd, "AT*BAND=%d,%d,%d,%d,%d", band->net_pref, band->gsm_band, band->umts_band, band->tdlte_band, band->fddlte_band);
+            if(band->lte_ext_band > 0) {
+                sprintf(cmd, "AT*BAND=%d,%d,%d,%d,%d,,,,%d", band->net_pref, band->gsm_band, band->umts_band, band->tdlte_band, band->fddlte_band, band->lte_ext_band);
+            } else {
+                sprintf(cmd, "AT*BAND=%d,%d,%d,%d,%d", band->net_pref, band->gsm_band, band->umts_band, band->tdlte_band, band->fddlte_band);
+            }
         }
     }
     err = at_send_command(port, cmd, &response);
@@ -364,6 +413,10 @@
 
 OK
 
+5G :
+*BAND: 19, 0, 0, 482, 149,0, 24576, 256, 134217877, 0, 0, 2, 2, 0
+
+
 // ?????????
 AT*BAND=5,79,147,128,1
 OK
@@ -473,6 +526,36 @@
     }
     band->fddlte_band = (uint32)tmp_int;
 
+    if(band_info.net_support & MBTK_NET_SUPPORT_5G) {
+        err = at_tok_nextint(&line, &tmp_int);
+        if (err < 0)
+        {
+            goto exit;
+        }
+        band->nr_3_band = (uint32)tmp_int;
+
+        err = at_tok_nextint(&line, &tmp_int);
+        if (err < 0)
+        {
+            goto exit;
+        }
+        band->nr_2_band = (uint32)tmp_int;
+
+        err = at_tok_nextint(&line, &tmp_int);
+        if (err < 0)
+        {
+            goto exit;
+        }
+        band->nr_1_band = (uint32)tmp_int;
+
+        err = at_tok_nextint(&line, &tmp_int);
+        if (err < 0)
+        {
+            goto exit;
+        }
+        band->nr_0_band = (uint32)tmp_int;
+    }
+
     // roamingConfig
     err = at_tok_nextint(&line, &tmp_int);
     if (err < 0)