static void mtk_query_modem_rats_cb(struct ril_msg *message, gpointer user_data) { struct cb_data *cbd = user_data; struct ofono_radio_settings *rs = cbd->user; struct radio_data *rd = ofono_radio_settings_get_data(rs); ofono_radio_settings_modem_rats_query_cb_t cb = cbd->cb; ofono_bool_t modem_rats[OFONO_RADIO_ACCESS_MODE_LAST] = { FALSE }; int is_3g; if (message->error != RIL_E_SUCCESS) { ofono_error("%s: error %s", __func__, ril_error_to_string(message->error)); CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); return; } is_3g = g_mtk_reply_parse_get_3g_capability(rd->ril, message); if (is_3g < 0) { ofono_error("%s: parse error", __func__); CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); return; } modem_rats[OFONO_RADIO_ACCESS_MODE_GSM] = TRUE; if (is_3g) { modem_rats[OFONO_RADIO_ACCESS_MODE_UMTS] = TRUE; if (getenv("OFONO_RIL_RAT_LTE")) modem_rats[OFONO_RADIO_ACCESS_MODE_LTE] = TRUE; } CALLBACK_WITH_SUCCESS(cb, modem_rats, cbd->data); }
static void mtk_query_available_rats_cb(struct ril_msg *message, gpointer user_data) { struct cb_data *cbd = user_data; struct ofono_radio_settings *rs = cbd->user; struct radio_data *rd = ofono_radio_settings_get_data(rs); ofono_radio_settings_available_rats_query_cb_t cb = cbd->cb; unsigned int available_rats = OFONO_RADIO_ACCESS_MODE_GSM; int slot_3g, is_3g; if (message->error != RIL_E_SUCCESS) { ofono_error("%s: error %s", __func__, ril_error_to_string(message->error)); CALLBACK_WITH_FAILURE(cb, 0, cbd->data); return; } slot_3g = g_mtk_reply_parse_get_3g_capability(rd->ril, message); if (slot_3g < 0) { ofono_error("%s: parse error", __func__); CALLBACK_WITH_FAILURE(cb, 0, cbd->data); return; } is_3g = (g_ril_get_slot(rd->ril) == slot_3g); if (is_3g) { available_rats |= OFONO_RADIO_ACCESS_MODE_UMTS; if (ofono_modem_get_boolean(rd->modem, MODEM_PROP_LTE_CAPABLE)) available_rats |= OFONO_RADIO_ACCESS_MODE_LTE; } CALLBACK_WITH_SUCCESS(cb, available_rats, cbd->data); }
static void query_3g_caps_cb(struct ril_msg *message, gpointer user_data) { struct socket_data *sock = user_data; struct socket_data *sock_for_md_0, *sock_for_md_1; int slot_3g; if (message->error != RIL_E_SUCCESS) { ofono_error("%s: error %s", __func__, ril_error_to_string(message->error)); return; } slot_3g = g_mtk_reply_parse_get_3g_capability(sock->ril, message); /* * The socket at sock_slot_0 always connects to the slot with 3G * capabilities, while sock_slot_1 connects to the slot that is just 2G. * However, the physical slot that owns the 3G capabilities can be * changed dynamically using a RILd request, so the sockets can connect * to different physical slots depending on the current configuration. * We want to keep the relationship between the physical slots and * the modem names in DBus (so /ril_0 and /ril_1 always refer to the * same physical slots), so here we assign the sockets needed by * mtk_data_0 and mtk_data_1 structures to make sure that happens. */ if (slot_3g == MULTISIM_SLOT_0) { sock_for_md_0 = sock_0; sock_for_md_1 = sock_1; mtk_data_0->has_3g = TRUE; mtk_data_1->has_3g = FALSE; } else { sock_for_md_0 = sock_1; sock_for_md_1 = sock_0; mtk_data_0->has_3g = FALSE; mtk_data_1->has_3g = TRUE; } start_slot(mtk_data_0, sock_for_md_0, hex_slot_0); start_slot(mtk_data_1, sock_for_md_1, hex_slot_1); g_free(sock_0); sock_0 = NULL; g_free(sock_1); sock_1 = NULL; }