兼容 dev_info v1

Change-Id: I5659a6275f96f68867d4fd753c05915576dee568
diff --git a/mbtk/mbtk_rild_v2/src/main.c b/mbtk/mbtk_rild_v2/src/main.c
index f768ce6..4b8d320 100755
--- a/mbtk/mbtk_rild_v2/src/main.c
+++ b/mbtk/mbtk_rild_v2/src/main.c
@@ -2566,6 +2566,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;

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

@@ -2573,15 +2574,18 @@
         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

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

@@ -2603,10 +2607,12 @@
         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;

diff --git a/mbtk/mbtk_rild_v2/src/ril_net.c b/mbtk/mbtk_rild_v2/src/ril_net.c
index 6f2ad50..2848bf9 100755
--- a/mbtk/mbtk_rild_v2/src/ril_net.c
+++ b/mbtk/mbtk_rild_v2/src/ril_net.c
@@ -366,7 +366,7 @@
 
             at_response_free(response);
         }
-
+#ifdef MBTK_DEV_INFO_VERSION_2
         // 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
@@ -384,6 +384,13 @@
                 sprintf(cmd, "AT*BAND=%d,%d,%d,%d,%d", band->net_pref, band->gsm_band, band->umts_band, band->tdlte_band, band->fddlte_band);
             }
         }
+#else
+        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);
+        }
+#endif
     }
     err = at_send_command(port, cmd, &response);
 
@@ -526,7 +533,9 @@
     }
     band->fddlte_band = (uint32)tmp_int;
 
-    if(band_info.net_support & MBTK_NET_SUPPORT_5G) {
+#ifdef MBTK_DEV_INFO_VERSION_2
+    if(band_info.net_support & MBTK_NET_SUPPORT_5G)
+    {
         err = at_tok_nextint(&line, &tmp_int);
         if (err < 0)
         {
@@ -555,6 +564,7 @@
         }
         band->nr_0_band = (uint32)tmp_int;
     }
+#endif
 
     // roamingConfig
     err = at_tok_nextint(&line, &tmp_int);
diff --git a/mbtk/mbtk_utils/device_info.c b/mbtk/mbtk_utils/device_info.c
index d107020..da66f3d 100755
--- a/mbtk/mbtk_utils/device_info.c
+++ b/mbtk/mbtk_utils/device_info.c
@@ -24,6 +24,7 @@
     }
 }
 
+#ifdef MBTK_DEV_INFO_VERSION_2
 static char* net_support_str_get(uint32 net_support)
 {
     static char net_str[100] = {0};
@@ -61,6 +62,7 @@
     }
     return net_str;
 }
+#endif
 
 static char* band_str_get(uint32 band, int index)
 {
@@ -117,6 +119,7 @@
         return -1;
     }
 
+#ifdef MBTK_DEV_INFO_VERSION_2
     printf("net_pref:%d\n", info_modem.net_pref);
     printf("net_support:%s\n", net_support_str_get(info_modem.net_support));
     printf("Band:%s\n", band_2_str(info_modem.band_area));
@@ -129,6 +132,15 @@
     printf("Band NR_2:0x%08x(%s)\n", info_modem.band_nr_2, band_str_get(info_modem.band_nr_2, 2));
     printf("Band NR_1:0x%08x(%s)\n", info_modem.band_nr_1, band_str_get(info_modem.band_nr_1, 1));
     printf("Band NR_0:0x%08x(%s)\n", info_modem.band_nr_0, band_str_get(info_modem.band_nr_0, 0));
+#else
+    printf("Band:%s\n", band_2_str(info_modem.band_area));
+    printf("Band GSM:0x%08x(%s)\n", info_modem.band_gsm, band_str_get(info_modem.band_gsm, 0));
+    printf("Band WCDMA:0x%08x(%s)\n", info_modem.band_wcdma, band_str_get(info_modem.band_wcdma, 0));
+    printf("Band TDLTE:0x%08x(%s)\n", info_modem.band_tdlte, band_str_get(info_modem.band_tdlte, 1));
+    printf("Band FDDLTE:0x%08x(%s)\n", info_modem.band_fddlte, band_str_get(info_modem.band_fddlte, 0));
+    printf("Band EXT_LTE:0x%08x(%s)\n", info_modem.band_lte_ext, band_str_get(info_modem.band_lte_ext, 0));
+#endif
+
     return 0;
 }
 
diff --git a/mbtk/mbtk_utils_linux/device_info_generate.c b/mbtk/mbtk_utils_linux/device_info_generate.c
index 9744aab..58afe45 100755
--- a/mbtk/mbtk_utils_linux/device_info_generate.c
+++ b/mbtk/mbtk_utils_linux/device_info_generate.c
@@ -57,17 +57,21 @@
     .name = MBTK_DEVICE_INFO_ITEM_STR_MODEM,
     .version = MBTK_DEVICE_INFO_CURR_VERSION,
     .band_area = MBTK_MODEM_BAND_AREA_ALL,  // Default for all bands.
+#ifdef MBTK_DEV_INFO_VERSION_2
     .net_pref = 15,        // Default *band is 15
     .net_support = MBTK_NET_SUPPORT_2G | MBTK_NET_SUPPORT_3G | MBTK_NET_SUPPORT_4G,      // Default support 2G/3G/4G
+#endif
     .band_gsm = MBTK_BAND_ALL_GSM_DEFAULT,
     .band_wcdma = MBTK_BAND_ALL_WCDMA_DEFAULT,
     .band_tdlte = MBTK_BAND_ALL_TDLTE_DEFAULT,
     .band_fddlte = MBTK_BAND_ALL_FDDLTE_DEFAULT,
     .band_lte_ext = MBTK_BAND_ALL_EXT_LTE_DEFAULT,
+#ifdef MBTK_DEV_INFO_VERSION_2
     .band_nr_3 = MBTK_BAND_ALL_NR_3_DEFAULT,
     .band_nr_2 = MBTK_BAND_ALL_NR_2_DEFAULT,
     .band_nr_1 = MBTK_BAND_ALL_NR_1_DEFAULT,
     .band_nr_0 = MBTK_BAND_ALL_NR_0_DEFAULT
+#endif
 };
 
 static mbtk_device_info_log_t item_log = {
@@ -164,6 +168,7 @@
     return 0;
 }
 
+#ifdef MBTK_DEV_INFO_VERSION_2
 static char* net_support_str_get(uint32 net_support)
 {
     static char net_str[100] = {0};
@@ -201,7 +206,7 @@
     }
     return net_str;
 }
-
+#endif
 /*
 *
 * device_info_generate -a [a/ab] -b [revision_out] -c [revision_in] -d [project] -e [project_cust] -f [cn/eu/sa/all] -o [out_bin]
@@ -252,10 +257,12 @@
                     item_modem.band_tdlte = MBTK_BAND_CN_TDLTE_DEFAULT;
                     item_modem.band_fddlte = MBTK_BAND_CN_FDDLTE_DEFAULT;
                     item_modem.band_lte_ext = MBTK_BAND_CN_EXT_LTE_DEFAULT;
+#ifdef MBTK_DEV_INFO_VERSION_2
                     item_modem.band_nr_3 = MBTK_BAND_CN_NR_3_DEFAULT;
                     item_modem.band_nr_2 = MBTK_BAND_CN_NR_2_DEFAULT;
                     item_modem.band_nr_1 = MBTK_BAND_CN_NR_1_DEFAULT;
                     item_modem.band_nr_0 = MBTK_BAND_CN_NR_0_DEFAULT;
+#endif
                 } else if(strcmp(optarg, "eu") == 0) {
                     item_modem.band_area = MBTK_MODEM_BAND_AREA_EU;
                     item_modem.band_gsm = MBTK_BAND_EU_GSM_DEFAULT;
@@ -263,10 +270,12 @@
                     item_modem.band_tdlte = MBTK_BAND_EU_TDLTE_DEFAULT;
                     item_modem.band_fddlte = MBTK_BAND_EU_FDDLTE_DEFAULT;
                     item_modem.band_lte_ext = MBTK_BAND_EU_EXT_LTE_DEFAULT;
+#ifdef MBTK_DEV_INFO_VERSION_2
                     item_modem.band_nr_3 = MBTK_BAND_EU_NR_3_DEFAULT;
                     item_modem.band_nr_2 = MBTK_BAND_EU_NR_2_DEFAULT;
                     item_modem.band_nr_1 = MBTK_BAND_EU_NR_1_DEFAULT;
                     item_modem.band_nr_0 = MBTK_BAND_EU_NR_0_DEFAULT;
+#endif
                 } else if(strcmp(optarg, "sa") == 0) {
                     item_modem.band_area = MBTK_MODEM_BAND_AREA_SA;
                     item_modem.band_gsm = MBTK_BAND_SA_GSM_DEFAULT;
@@ -274,10 +283,12 @@
                     item_modem.band_tdlte = MBTK_BAND_SA_TDLTE_DEFAULT;
                     item_modem.band_fddlte = MBTK_BAND_SA_FDDLTE_DEFAULT;
                     item_modem.band_lte_ext = MBTK_BAND_SA_EXT_LTE_DEFAULT;
+#ifdef MBTK_DEV_INFO_VERSION_2
                     item_modem.band_nr_3 = MBTK_BAND_SA_NR_3_DEFAULT;
                     item_modem.band_nr_2 = MBTK_BAND_SA_NR_2_DEFAULT;
                     item_modem.band_nr_1 = MBTK_BAND_SA_NR_1_DEFAULT;
                     item_modem.band_nr_0 = MBTK_BAND_SA_NR_0_DEFAULT;
+#endif
                 } else {
                     item_modem.band_area = MBTK_MODEM_BAND_AREA_ALL;
                     item_modem.band_gsm = MBTK_BAND_ALL_GSM_DEFAULT;
@@ -285,10 +296,12 @@
                     item_modem.band_tdlte = MBTK_BAND_ALL_TDLTE_DEFAULT;
                     item_modem.band_fddlte = MBTK_BAND_ALL_FDDLTE_DEFAULT;
                     item_modem.band_lte_ext = MBTK_BAND_ALL_EXT_LTE_DEFAULT;
+#ifdef MBTK_DEV_INFO_VERSION_2
                     item_modem.band_nr_3 = MBTK_BAND_ALL_NR_3_DEFAULT;
                     item_modem.band_nr_2 = MBTK_BAND_ALL_NR_2_DEFAULT;
                     item_modem.band_nr_1 = MBTK_BAND_ALL_NR_1_DEFAULT;
                     item_modem.band_nr_0 = MBTK_BAND_ALL_NR_0_DEFAULT;
+#endif
                     printf("Set to default band.\n");
                 }
                 break;