Fix dev_info
Change-Id: If0239f3821c5ff984a35c43cb528f09eafcbf3e5
diff --git a/build.sh b/build.sh
index d38c7d3..a048741 100755
--- a/build.sh
+++ b/build.sh
@@ -22,6 +22,7 @@
export BUILD_GCC_VERSION=`cat config | grep CONFIG_GCC_VERSION | cut -d '=' -f 2`
export MBTK_DEV_INFO_VERSION=`cat config | grep CONFIG_DEV_INFO_VERSION | cut -d '=' -f 2`
+export CONFIG_MBTK_5G_SUPPORT=`cat config | grep CONFIG_MBTK_5G_SUPPORT | cut -d '=' -f 2`
if [ -n "$1" ] ;then
case "$1" in
diff --git a/configs/config-SDK4G_v2102_v1360-LYNQ_SDK_ASR_T108_V05.04.01.00 b/configs/config-SDK4G_v2102_v1360-LYNQ_SDK_ASR_T108_V05.04.01.00
index 7d2b9f7..2cc0655 100755
--- a/configs/config-SDK4G_v2102_v1360-LYNQ_SDK_ASR_T108_V05.04.01.00
+++ b/configs/config-SDK4G_v2102_v1360-LYNQ_SDK_ASR_T108_V05.04.01.00
@@ -9,3 +9,6 @@
# mbtk_source version : 1 / 2
CONFIG_MBTK_SOURCE_VERSION=2
+
+# Support 5G or not : Y/N
+CONFIG_MBTK_5G_SUPPORT=N
diff --git a/configs/config-SDK4G_v2102_v1360-master b/configs/config-SDK4G_v2102_v1360-master
index 7d2b9f7..2cc0655 100755
--- a/configs/config-SDK4G_v2102_v1360-master
+++ b/configs/config-SDK4G_v2102_v1360-master
@@ -9,3 +9,6 @@
# mbtk_source version : 1 / 2
CONFIG_MBTK_SOURCE_VERSION=2
+
+# Support 5G or not : Y/N
+CONFIG_MBTK_5G_SUPPORT=N
diff --git a/configs/config-SDK5G_v2102_v1380-master b/configs/config-SDK5G_v2102_v1380-master
index 7d2b9f7..73a6341 100755
--- a/configs/config-SDK5G_v2102_v1380-master
+++ b/configs/config-SDK5G_v2102_v1380-master
@@ -9,3 +9,6 @@
# mbtk_source version : 1 / 2
CONFIG_MBTK_SOURCE_VERSION=2
+
+# Support 5G or not : Y/N
+CONFIG_MBTK_5G_SUPPORT=Y
diff --git a/configs/config-v1265-LYNQ_SDK_ASR_T108_GXX-000_V05.03.01.01 b/configs/config-v1265-LYNQ_SDK_ASR_T108_GXX-000_V05.03.01.01
index fd44dc9..04ca261 100755
--- a/configs/config-v1265-LYNQ_SDK_ASR_T108_GXX-000_V05.03.01.01
+++ b/configs/config-v1265-LYNQ_SDK_ASR_T108_GXX-000_V05.03.01.01
@@ -9,3 +9,6 @@
# mbtk_source version : 1 / 2
CONFIG_MBTK_SOURCE_VERSION=1
+
+# Support 5G or not : Y/N
+CONFIG_MBTK_5G_SUPPORT=N
diff --git a/configs/config-v1265-LYNQ_SDK_ASR_T108_V05.03.01.00 b/configs/config-v1265-LYNQ_SDK_ASR_T108_V05.03.01.00
index fd44dc9..04ca261 100755
--- a/configs/config-v1265-LYNQ_SDK_ASR_T108_V05.03.01.00
+++ b/configs/config-v1265-LYNQ_SDK_ASR_T108_V05.03.01.00
@@ -9,3 +9,6 @@
# mbtk_source version : 1 / 2
CONFIG_MBTK_SOURCE_VERSION=1
+
+# Support 5G or not : Y/N
+CONFIG_MBTK_5G_SUPPORT=N
diff --git a/configs/config-v1265-LYNQ_SDK_ASR_T108_YX-000_V05.03.01.01 b/configs/config-v1265-LYNQ_SDK_ASR_T108_YX-000_V05.03.01.01
index fd44dc9..04ca261 100755
--- a/configs/config-v1265-LYNQ_SDK_ASR_T108_YX-000_V05.03.01.01
+++ b/configs/config-v1265-LYNQ_SDK_ASR_T108_YX-000_V05.03.01.01
@@ -9,3 +9,6 @@
# mbtk_source version : 1 / 2
CONFIG_MBTK_SOURCE_VERSION=1
+
+# Support 5G or not : Y/N
+CONFIG_MBTK_5G_SUPPORT=N
diff --git a/configs/config-v1265-master b/configs/config-v1265-master
index fd44dc9..04ca261 100755
--- a/configs/config-v1265-master
+++ b/configs/config-v1265-master
@@ -9,3 +9,6 @@
# mbtk_source version : 1 / 2
CONFIG_MBTK_SOURCE_VERSION=1
+
+# Support 5G or not : Y/N
+CONFIG_MBTK_5G_SUPPORT=N
diff --git a/init.sh b/init.sh
index 0eab8ab..eb126d5 100755
--- a/init.sh
+++ b/init.sh
@@ -44,6 +44,12 @@
fi
CONFIG_FILE_NAME=config-$ASR_RLS_BRANCH-$ASR_CUSTOM_BRANCH
+
+if [ ! -f configs/$CONFIG_FILE_NAME ];then
+ echo "No found config file : $CONFIG_FILE_NAME , use default config file."
+ CONFIG_FILE_NAME=config-default
+fi
+
if [ -f configs/$CONFIG_FILE_NAME ];then
cp -f configs/$CONFIG_FILE_NAME config
./build.sh clean
diff --git a/mbtk/Make.defines b/mbtk/Make.defines
index 5bb656c..41a894f 100755
--- a/mbtk/Make.defines
+++ b/mbtk/Make.defines
@@ -82,6 +82,10 @@
DEFINE += -DMBTK_DEV_INFO_VERSION_2
endif
+ifeq ($(CONFIG_MBTK_5G_SUPPORT), Y)
+DEFINE += -DMBTK_5G_SUPPORT
+endif
+
LIB_DIR = \
-L$(OUT_DIR)/lib
diff --git a/mbtk/include/mbtk/mbtk_device_v2.h b/mbtk/include/mbtk/mbtk_device_v2.h
index 711b893..7beb84d 100755
--- a/mbtk/include/mbtk/mbtk_device_v2.h
+++ b/mbtk/include/mbtk/mbtk_device_v2.h
@@ -22,21 +22,40 @@
#define MBTK_BAND_ALL_TDLTE_DEFAULT 482 // TDD-LTE : ASR default.
#define MBTK_BAND_ALL_FDDLTE_DEFAULT 134742231 // FDD-LTE : ASR default.
#define MBTK_BAND_ALL_EXT_LTE_DEFAULT 0 // EXT-LTE
+#define MBTK_BAND_ALL_NR_3_DEFAULT 0
+#define MBTK_BAND_ALL_NR_2_DEFAULT 24576 // n78/n79
+#define MBTK_BAND_ALL_NR_1_DEFAULT 256 // n41
+#define MBTK_BAND_ALL_NR_0_DEFAULT 134217877 // n1/n3/n5/n8/n28
+
#define MBTK_BAND_CN_GSM_DEFAULT 11 // GSM : B3/B8 (PGSM 900/DCS GSM 1800/EGSM 900)
#define MBTK_BAND_CN_WCDMA_DEFAULT 145 // WCDMA : B1/B5/B8
#define MBTK_BAND_CN_TDLTE_DEFAULT 482 // TDD-LTE : B34/B38/B39/B40/B41
#define MBTK_BAND_CN_FDDLTE_DEFAULT 149 // FDD-LTE : B1/B3/B5/B8
#define MBTK_BAND_CN_EXT_LTE_DEFAULT 0 // EXT-LTE
+#define MBTK_BAND_CN_NR_3_DEFAULT 0
+#define MBTK_BAND_CN_NR_2_DEFAULT 24576 // n78/n79
+#define MBTK_BAND_CN_NR_1_DEFAULT 384 // n40/n41
+#define MBTK_BAND_CN_NR_0_DEFAULT 134217877 // n1/n3/n5/n8/n28
+
#define MBTK_BAND_EU_GSM_DEFAULT 11 // GSM : B3/B8 (PGSM 900/DCS GSM 1800/EGSM 900)
#define MBTK_BAND_EU_WCDMA_DEFAULT 145 // WCDMA : B1/B5/B8
#define MBTK_BAND_EU_TDLTE_DEFAULT 416 // TDD-LTE : B38/B40/B41
#define MBTK_BAND_EU_FDDLTE_DEFAULT 134742229 // FDD-LTE : B1/B3/B5/B7/B8/B20/B28
#define MBTK_BAND_EU_EXT_LTE_DEFAULT 0 // EXT-LTE
+#define MBTK_BAND_EU_NR_3_DEFAULT 0
+#define MBTK_BAND_EU_NR_2_DEFAULT 12352 // n71/n77/n78
+#define MBTK_BAND_EU_NR_1_DEFAULT 416 // n38/n40/n41
+#define MBTK_BAND_EU_NR_0_DEFAULT 134742229 // n1/n3/n5/n7/n8/n20/n28
+
#define MBTK_BAND_SA_GSM_DEFAULT 79 // GSM : B2/B3/B5/B8(GSM 850/PGSM 900/EGSM 900/DCS GSM 1800/PCS GSM 1900)
#define MBTK_BAND_SA_WCDMA_DEFAULT 155 // WCDMA : B1/B2/B4/B5/B8
#define MBTK_BAND_SA_TDLTE_DEFAULT 128 // TDD-LTE : B40
#define MBTK_BAND_SA_FDDLTE_DEFAULT 134217951 // FDD-LTE : B1/B2/B3/B4/B5/B7/B8/B28
#define MBTK_BAND_SA_EXT_LTE_DEFAULT 2 // EXT-LTE : B66
+#define MBTK_BAND_SA_NR_3_DEFAULT MBTK_BAND_ALL_NR_3_DEFAULT
+#define MBTK_BAND_SA_NR_2_DEFAULT MBTK_BAND_ALL_NR_2_DEFAULT
+#define MBTK_BAND_SA_NR_1_DEFAULT MBTK_BAND_ALL_NR_1_DEFAULT
+#define MBTK_BAND_SA_NR_0_DEFAULT MBTK_BAND_ALL_NR_0_DEFAULT
#define MBTK_DEVICE_INFO_ITEM_STR_BASIC "BASIC"
#define MBTK_DEVICE_INFO_ITEM_STR_FOTA "FOTA"
@@ -48,6 +67,11 @@
#define MBTK_DEVICE_INFO_ITEM_ADDR_MODEM 0x900 // Fota is 1k
#define MBTK_DEVICE_INFO_ITEM_ADDR_LOG 0xD00 // Modem is 1k
+#define MBTK_NET_SUPPORT_2G (1)
+#define MBTK_NET_SUPPORT_3G (1<<1)
+#define MBTK_NET_SUPPORT_4G (1<<2)
+#define MBTK_NET_SUPPORT_5G (1<<3)
+
typedef enum {
MBTK_DEVICE_INFO_ITEM_BASIC = 0,
MBTK_DEVICE_INFO_ITEM_FOTA,
@@ -108,12 +132,17 @@
uint8 name[16];
uint32 version; // Default : 0x01
mbtk_modem_band_area_enum band_area;
+ uint32 net_pref; // Refor to : mbtk_net_pref_enum
+ uint32 net_support; // 1:GSM 2:WCDMA 4:LTE 8:NR
uint32 band_gsm;
uint32 band_wcdma;
uint32 band_tdlte;
uint32 band_fddlte;
uint32 band_lte_ext;
- uint32 net_pref; // Refor to : mbtk_net_pref_enum
+ uint32 band_nr_3;
+ uint32 band_nr_2;
+ uint32 band_nr_1;
+ uint32 band_nr_0;
} mbtk_device_info_modem_t;
typedef struct {
diff --git a/mbtk/include/mbtk/mbtk_ril_api.h b/mbtk/include/mbtk/mbtk_ril_api.h
index 352950f..73665ad 100755
--- a/mbtk/include/mbtk/mbtk_ril_api.h
+++ b/mbtk/include/mbtk/mbtk_ril_api.h
@@ -244,16 +244,29 @@
13 : GSM/UMTS/LTE(GSM preferred)
14 : GSM/UMTS/LTE(UMTS preferred)
15 : GSM/UMTS/LTE(LTE preferred)
+ 16 : 5GS network
+ 17 : Dual mode(4G/5G, auto)
+ 18 : Dual mode(4G/5G, LTE preferred)
+ 19 : Dual mode(4G/5G, 5GS preferred)
+ 20 : Triple mode(3G/4G/5G, auto)
+ 21 : Triple mode(3G/4G/5G, UMTS preferred)
+ 22 : Triple mode(3G/4G/5G, LTE preferred)
+ 23 : Triple mode(3G/4G/5G, 5GS preferred)
+ 24 : Quadruple mode (2G/3G/4G/5G, auto)
+ 25 : Quadruple mode (2G/3G/4G/5G, GSM preferred)
+ 26 : Quadruple mode (2G/3G/4G/5G, UMTS preferred)
+ 27 : Quadruple mode (2G/3G/4G/5G, LTE preferred)
+ 28 : Quadruple mode (2G/3G/4G/5G, 5GS preferred)
*/
typedef enum
{
MBTK_NET_PREF_UNUSE = -1,
- MBTK_NET_PREF_GSM_ONLY = 0,
- MBTK_NET_PREF_UMTS_ONLY,
+ MBTK_NET_PREF_GSM_ONLY = 0, // 0 : GSM Only
+ MBTK_NET_PREF_UMTS_ONLY, // 1 : UMTS Only
MBTK_NET_PREF_GSM_UMTS_AUTO,
MBTK_NET_PREF_GSM_UMTS_GSM_PREF,
MBTK_NET_PREF_GSM_UMTS_UMTS_PREF,
- MBTK_NET_PREF_LTE_ONLY,
+ MBTK_NET_PREF_LTE_ONLY, // 5 : LTE Only
MBTK_NET_PREF_GSM_LTE_AUTO,
MBTK_NET_PREF_GSM_LTE_GSM_PREF,
MBTK_NET_PREF_GSM_LTE_LTE_PREF,
@@ -263,8 +276,20 @@
MBTK_NET_PREF_GSM_UMTS_LTE_AUTO,
MBTK_NET_PREF_GSM_UMTS_LTE_GSM_PREF,
MBTK_NET_PREF_GSM_UMTS_LTE_UMTS_PREF,
- MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF,
-
+ MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF, // 15
+ MBTK_NET_PREF_NR_ONLY, // 16 : NR Only
+ MBTK_NET_PREF_LTE_NR_AUTO,
+ MBTK_NET_PREF_LTE_NR_LTE_PREF,
+ MBTK_NET_PREF_LTE_NR_NR_PREF,
+ MBTK_NET_PREF_UMTS_LTE_NR_AUTO, // 20
+ MBTK_NET_PREF_UMTS_LTE_NR_UMTS_PREF,
+ MBTK_NET_PREF_UMTS_LTE_NR_LTE_PREF,
+ MBTK_NET_PREF_UMTS_LTE_NR_NR_PREF,
+ MBTK_NET_PREF_GSM_UMTS_LTE_NR_AUTO,
+ MBTK_NET_PREF_GSM_UMTS_LTE_NR_GSM_PREF, // 25
+ MBTK_NET_PREF_GSM_UMTS_LTE_NR_UMTS_PREF,
+ MBTK_NET_PREF_GSM_UMTS_LTE_NR_LTE_PREF,
+ MBTK_NET_PREF_GSM_UMTS_LTE_NR_NR_PREF,
// Last item.
MBTK_NET_PREF_MAX
} mbtk_net_pref_enum;
@@ -313,6 +338,10 @@
uint32 tdlte_band; // mbtk_tdlte_band_enum
uint32 fddlte_band; // mbtk_fddlte_band_enum
uint32 lte_ext_band; // mbtk_lte_ext_band_enum
+ uint32 nr_3_band;
+ uint32 nr_2_band;
+ uint32 nr_1_band;
+ uint32 nr_0_band;
} __attribute__((packed)) mbtk_band_info_t;
typedef enum
diff --git a/mbtk/include/mbtk/mbtk_utils.h b/mbtk/include/mbtk/mbtk_utils.h
index 6a532f9..8f9c780 100755
--- a/mbtk/include/mbtk/mbtk_utils.h
+++ b/mbtk/include/mbtk/mbtk_utils.h
@@ -100,6 +100,9 @@
void mbtk_close(int fd);
+int mbtk_band_2_list(uint32 band, int index, int band_list[]);
+
+uint32 mbtk_list_2_band(int band_list[]);
#ifdef __cplusplus
} // extern "C"
diff --git a/mbtk/libmbtk_lib/common/mbtk_utils.c b/mbtk/libmbtk_lib/common/mbtk_utils.c
index afade99..1694c42 100755
--- a/mbtk/libmbtk_lib/common/mbtk_utils.c
+++ b/mbtk/libmbtk_lib/common/mbtk_utils.c
@@ -614,3 +614,46 @@
}
}
+int mbtk_band_2_list(uint32 band, int index, int band_list[])
+{
+ int i = 0;
+ int count = 0;
+ while(i < 32)
+ {
+ if(band & (1 << i))
+ {
+ // printf("Band : %d\n", i + 1 + index * 32);
+ band_list[count++] = i + 1 + index * 32;
+ }
+ i++;
+ }
+ return count;
+}
+
+uint32 mbtk_list_2_band(int band_list[])
+{
+ int i = 0;
+ uint32 band = 0;
+ while(band_list[i])
+ {
+ if(band_list[i] > 96)
+ {
+ band |= (uint32)(1 << (band_list[i] - 97));
+ }
+ else if(band_list[i] > 64)
+ {
+ band |= (uint32)(1 << (band_list[i] - 65));
+ }
+ else if(band_list[i] > 32)
+ {
+ band |= (uint32)(1 << (band_list[i] - 33));
+ }
+ else
+ {
+ band |= (uint32)(1 << (band_list[i] - 1));
+ }
+ i++;
+ }
+ return band;
+}
+
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)
diff --git a/mbtk/mbtk_utils/device_info.c b/mbtk/mbtk_utils/device_info.c
index 73bc0d1..d107020 100755
--- a/mbtk/mbtk_utils/device_info.c
+++ b/mbtk/mbtk_utils/device_info.c
@@ -1,5 +1,6 @@
#include <string.h>
#include "mbtk_type.h"
+#include "mbtk_utils.h"
#ifdef MBTK_DEV_INFO_VERSION_2
#include "mbtk_device_v2.h"
@@ -23,6 +24,66 @@
}
}
+static char* net_support_str_get(uint32 net_support)
+{
+ static char net_str[100] = {0};
+
+ if(net_support & MBTK_NET_SUPPORT_2G) { // GSM
+ if(strlen(net_str) > 0) {
+ strcat(net_str, "/2G");
+ } else {
+ strcat(net_str, "2G");
+ }
+ }
+
+ if(net_support & MBTK_NET_SUPPORT_3G) { // WCDMA
+ if(strlen(net_str) > 0) {
+ strcat(net_str, "/3G");
+ } else {
+ strcat(net_str, "3G");
+ }
+ }
+
+ if(net_support & MBTK_NET_SUPPORT_4G) { // LTE
+ if(strlen(net_str) > 0) {
+ strcat(net_str, "/4G");
+ } else {
+ strcat(net_str, "4G");
+ }
+ }
+
+ if(net_support & MBTK_NET_SUPPORT_5G) { // NR
+ if(strlen(net_str) > 0) {
+ strcat(net_str, "/5G");
+ } else {
+ strcat(net_str, "5G");
+ }
+ }
+ return net_str;
+}
+
+static char* band_str_get(uint32 band, int index)
+{
+ int band_list[33] = {0};
+ int ret = mbtk_band_2_list(band, index, band_list);
+ if(ret > 0) {
+ static char buff[150] = {0};
+ memset(buff, 0, sizeof(buff));
+ int i = 0;
+ while(i < ret) {
+ if(strlen(buff) > 0) {
+ sprintf(buff + strlen(buff), "/b%d", band_list[i]);
+ } else {
+ sprintf(buff + strlen(buff), "b%d", band_list[i]);
+ }
+ i++;
+ }
+ return buff;
+ } else {
+ return "NON";
+ }
+}
+
int main(int argc, char *argv[])
{
mbtk_device_info_basic_t info_basic;
@@ -56,13 +117,18 @@
return -1;
}
+ 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));
- printf("Band GSM:0x%08x\n", info_modem.band_gsm);
- printf("Band WCDMA:0x%08x\n", info_modem.band_wcdma);
- printf("Band TDLTE:0x%08x\n", info_modem.band_tdlte);
- printf("Band FDDLTE:0x%08x\n", info_modem.band_fddlte);
- printf("Band EXT_LTE:0x%08x\n", info_modem.band_lte_ext);
-
+ 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));
+ printf("Band NR_3:0x%08x(%s)\n", info_modem.band_nr_3, band_str_get(info_modem.band_nr_3, 3));
+ 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));
return 0;
}
diff --git a/mbtk/mbtk_utils_linux/device_info_generate.c b/mbtk/mbtk_utils_linux/device_info_generate.c
index e1341df..9744aab 100755
--- a/mbtk/mbtk_utils_linux/device_info_generate.c
+++ b/mbtk/mbtk_utils_linux/device_info_generate.c
@@ -57,11 +57,17 @@
.name = MBTK_DEVICE_INFO_ITEM_STR_MODEM,
.version = MBTK_DEVICE_INFO_CURR_VERSION,
.band_area = MBTK_MODEM_BAND_AREA_ALL, // Default for all bands.
+ .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
.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
+ .band_lte_ext = MBTK_BAND_ALL_EXT_LTE_DEFAULT,
+ .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
};
static mbtk_device_info_log_t item_log = {
@@ -73,7 +79,7 @@
static void help()
{
#ifdef MBTK_DEV_INFO_VERSION_2
- printf("device_info_generate -a [a/ab] -b [revision_out] -c [revision_in] -d [project] -e [project_cust] -f [cn/eu/all] -g [build_time] -h [net_pref] -o [out_bin]\n");
+ printf("device_info_generate -a [a/ab] -b [revision_out] -c [revision_in] -d [project] -e [project_cust] -f [cn/eu/all] -g [build_time] -h [net_pref] -i [net_support] -o [out_bin]\n");
#else
printf("device_info_generate -a [a/ab] -b [revision_out] -c [revision_in] -d [project] -e [project_cust] -f [cn/eu/all] -g [build_time] -o [out_bin]\n");
#endif
@@ -158,6 +164,44 @@
return 0;
}
+static char* net_support_str_get(uint32 net_support)
+{
+ static char net_str[100] = {0};
+
+ if(net_support & 0x01) { // GSM
+ if(strlen(net_str) > 0) {
+ strcat(net_str, "/2G");
+ } else {
+ strcat(net_str, "2G");
+ }
+ }
+
+ if(net_support & 0x02) { // WCDMA
+ if(strlen(net_str) > 0) {
+ strcat(net_str, "/3G");
+ } else {
+ strcat(net_str, "3G");
+ }
+ }
+
+ if(net_support & 0x04) { // LTE
+ if(strlen(net_str) > 0) {
+ strcat(net_str, "/4G");
+ } else {
+ strcat(net_str, "4G");
+ }
+ }
+
+ if(net_support & 0x08) { // NR
+ if(strlen(net_str) > 0) {
+ strcat(net_str, "/5G");
+ } else {
+ strcat(net_str, "5G");
+ }
+ }
+ return net_str;
+}
+
/*
*
* 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]
@@ -168,7 +212,7 @@
int ch;
char out_bin[128] = {0};
#ifdef MBTK_DEV_INFO_VERSION_2
- while((ch = getopt(argc, argv, "a:b:c:d:e:f:g:h:o:"))!= -1){
+ while((ch = getopt(argc, argv, "a:b:c:d:e:f:g:h:i:o:"))!= -1){
#else
while((ch = getopt(argc, argv, "a:b:c:d:e:f:g:o:"))!= -1){
#endif
@@ -208,6 +252,10 @@
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;
+ 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;
} else if(strcmp(optarg, "eu") == 0) {
item_modem.band_area = MBTK_MODEM_BAND_AREA_EU;
item_modem.band_gsm = MBTK_BAND_EU_GSM_DEFAULT;
@@ -215,6 +263,10 @@
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;
+ 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;
} else if(strcmp(optarg, "sa") == 0) {
item_modem.band_area = MBTK_MODEM_BAND_AREA_SA;
item_modem.band_gsm = MBTK_BAND_SA_GSM_DEFAULT;
@@ -222,6 +274,10 @@
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;
+ 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;
} else {
item_modem.band_area = MBTK_MODEM_BAND_AREA_ALL;
item_modem.band_gsm = MBTK_BAND_ALL_GSM_DEFAULT;
@@ -229,6 +285,10 @@
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;
+ 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;
printf("Set to default band.\n");
}
break;
@@ -237,6 +297,11 @@
item_modem.net_pref = (uint32)atoi(optarg);
printf("Set net_pref to %d success.\n", item_modem.net_pref);
break;
+ case 'i':
+ item_modem.net_support = (uint32)atoi(optarg);
+ printf("Set net_support to %d(%s) success.\n", item_modem.net_support,
+ net_support_str_get(item_modem.net_support));
+ break;
#endif
case 'g':
if(strlen(optarg) > 0)