Fix ril v2 build error.
Change-Id: I81361c5f39f8d9a7a3a7041b9cc7f4241f7ec699
diff --git a/mbtk/include/mbtk/mbtk_device.h b/mbtk/include/mbtk/mbtk_device.h
index 9ea8c0b..1e026b2 100755
--- a/mbtk/include/mbtk/mbtk_device.h
+++ b/mbtk/include/mbtk/mbtk_device.h
@@ -43,6 +43,11 @@
#define MBTK_DEVICE_INFO_ITEM_STR_MODEM "MODEM"
#define MBTK_DEVICE_INFO_ITEM_STR_LOG "LOG"
+#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,
@@ -65,7 +70,7 @@
} mbtk_device_info_header_t;
typedef enum {
- MBTK_REBOOT_FLAG_NORMAL = 0,
+ MBTK_REBOOT_FLAG_NORMAL = 0,
MBTK_REBOOT_FLAG_DOWNLOAD,
MBTK_REBOOT_FLAG_POWER_OFF, //Power off and restart
MBTK_REBOOT_FLAG_HARDWARE, //Hardware restart
diff --git a/mbtk/mbtk_rild_v2/src/main.c b/mbtk/mbtk_rild_v2/src/main.c
index 46758b4..c196470 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;
@@ -769,7 +770,6 @@
{
goto CGREG_EXIT;
}
-
state.tech = (mbtk_radio_technology_enum)tmp_int; // AcT
}
@@ -2790,6 +2790,7 @@
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;
@@ -2824,7 +2825,6 @@
#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;
@@ -2846,6 +2846,39 @@
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)
diff --git a/mbtk/mbtk_rild_v2/src/ril_net.c b/mbtk/mbtk_rild_v2/src/ril_net.c
index 89090be..649fd72 100755
--- a/mbtk/mbtk_rild_v2/src/ril_net.c
+++ b/mbtk/mbtk_rild_v2/src/ril_net.c
@@ -25,6 +25,19 @@
extern ril_band_info_t band_info;
void ril_rsp_pack_send(ATPortType_enum port, int fd, int ril_id, int msg_index, const void* data, int data_len);
+static bool net_support_check(uint32 net_type, uint32 net_flag)
+{
+#ifdef MBTK_DEV_INFO_VERSION_2
+ return (net_type & net_flag);
+#else
+ if(net_flag == MBTK_NET_SUPPORT_5G) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+#endif
+}
+
/*
AT+COPS=?
@@ -268,14 +281,14 @@
log_hex("BAND_SUPPORT", &band_info.band_support, sizeof(mbtk_band_info_t));
log_hex("BAND", band, sizeof(mbtk_band_info_t));
- if(band->gsm_band == 0 && (band_info.net_support & MBTK_NET_SUPPORT_2G)) {
+ if(band->gsm_band == 0 && net_support_check(band_info.net_support, MBTK_NET_SUPPORT_2G)) {
band->gsm_band = band_info.band_support.gsm_band;
}
- if(band->umts_band == 0 && (band_info.net_support & MBTK_NET_SUPPORT_3G)) {
+ if(band->umts_band == 0 && net_support_check(band_info.net_support, MBTK_NET_SUPPORT_3G)) {
band->umts_band = band_info.band_support.umts_band;
}
- if(band_info.net_support & MBTK_NET_SUPPORT_4G) {
+ if(net_support_check(band_info.net_support, MBTK_NET_SUPPORT_4G)) {
if(band->tdlte_band == 0) {
band->tdlte_band = band_info.band_support.tdlte_band;
}
@@ -287,7 +300,7 @@
}
}
- if(band_info.net_support & MBTK_NET_SUPPORT_5G) {
+ if(net_support_check(band_info.net_support, MBTK_NET_SUPPORT_5G)) {
if(band->nr_3_band == 0) {
band->nr_3_band = band_info.band_support.nr_3_band;
}