static void bind_query_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct slc_establish_data *sed = user_data; struct hfp_slc_info *info = sed->info; GAtResultIter iter; int hf_indicator; int enabled; unsigned int i; if (!ok) goto error; g_at_result_iter_init(&iter, result); while (g_at_result_iter_next(&iter, "+BIND:")) { if (!g_at_result_iter_next_number(&iter, &hf_indicator)) goto error; if (!g_at_result_iter_next_number(&iter, &enabled)) goto error; ofono_info("AG wants indicator %d %s", hf_indicator, enabled ? "enabled" : "disabled"); for (i = 0; i < info->num_hf_indicators; i++) { if (info->hf_indicators[i] != hf_indicator) continue; info->hf_indicator_active_map |= enabled << i; } ofono_info("Active map: %02x", info->hf_indicator_active_map); } slc_established(sed); return; error: slc_failed(sed); }
static gboolean reconnect_rild(gpointer user_data) { struct ofono_modem *modem = (struct ofono_modem *) user_data; struct mtk_data *md = ofono_modem_get_data(modem); ofono_info("[slot %d] trying to reconnect", md->slot); if (create_gril(modem) < 0) return TRUE; /* Reconnected: do not call this again */ return FALSE; }
static void mbm_erinfo_notify(GAtResult *result, gpointer user_data) { struct ofono_netreg *netreg = user_data; struct netreg_data *nd = ofono_netreg_get_data(netreg); GAtResultIter iter; int mode, gsm, umts; g_at_result_iter_init(&iter, result); if (g_at_result_iter_next(&iter, "*ERINFO:") == FALSE) return; if (g_at_result_iter_next_number(&iter, &mode) == FALSE) return; if (g_at_result_iter_next_number(&iter, &gsm) == FALSE) return; /* * According to MBM the ERINFO unsolicited response does not contain * the mode parameter, however at least the MD300 does report it. So * we handle both 2 and 3 argument versions */ if (g_at_result_iter_next_number(&iter, &umts) == FALSE) { gsm = mode; umts = gsm; } ofono_info("network capability: GSM %d UMTS %d", gsm, umts); /* Convert to tech values from 27.007 */ switch (gsm) { case 1: /* GSM */ nd->tech = ACCESS_TECHNOLOGY_GSM; break; case 2: /* EDGE */ nd->tech = ACCESS_TECHNOLOGY_GSM_EGPRS; break; default: nd->tech = -1; } switch (umts) { case 1: /* UMTS */ nd->tech = ACCESS_TECHNOLOGY_UTRAN; break; case 2: /* UMTS + HSDPA */ nd->tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA; break; } }
static void mux_setup_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_modem *modem = user_data; struct ifx_data *data = ofono_modem_get_data(modem); int fd; DBG(""); if (data->mux_init_timeout > 0) { g_source_remove(data->mux_init_timeout); data->mux_init_timeout = 0; } g_at_chat_unref(data->dlcs[AUX_DLC]); data->dlcs[AUX_DLC] = NULL; if (!ok) goto error; if (data->mux_ldisc < 0) { ofono_info("Using internal multiplexer"); setup_internal_mux(modem); return; } fd = g_io_channel_unix_get_fd(data->device); if (ioctl(fd, TIOCGETD, &data->saved_ldisc) < 0) { ofono_error("Failed to get current line discipline"); goto error; } if (ioctl(fd, TIOCSETD, &data->mux_ldisc) < 0) { ofono_error("Failed to set multiplexer line discipline"); goto error; } data->dlc_poll_count = 0; data->dlc_poll_source = g_timeout_add_seconds(1, dlc_ready_check, modem); return; error: data->saved_ldisc = -1; g_io_channel_unref(data->device); data->device = NULL; ofono_modem_set_powered(modem, FALSE); }
static void ril_connected(struct ril_msg *message, gpointer user_data) { struct ofono_modem *modem = (struct ofono_modem *) user_data; struct ril_data *ril = ofono_modem_get_data(modem); ofono_info("[UNSOL]< %s", ril_unsol_request_to_string(message->req)); /* TODO: need a disconnect function to restart things! */ ril->connected = TRUE; DBG("calling set_powered(TRUE)"); ofono_modem_set_powered(modem, TRUE); }
static int hfp_hf_probe(const char *device, const char *dev_addr, const char *adapter_addr, const char *alias) { struct ofono_modem *modem; struct hfp_data *data; char buf[256]; /* We already have this device in our hash, ignore */ if (g_hash_table_lookup(modem_hash, device) != NULL) return -EALREADY; ofono_info("Using device: %s, devaddr: %s, adapter: %s", device, dev_addr, adapter_addr); strcpy(buf, "hfp/"); bluetooth_create_path(dev_addr, adapter_addr, buf + 4, sizeof(buf) - 4); modem = ofono_modem_create(buf, "hfp"); if (modem == NULL) return -ENOMEM; data = g_try_new0(struct hfp_data, 1); if (data == NULL) goto free; data->handsfree_path = g_strdup(device); if (data->handsfree_path == NULL) goto free; data->handsfree_address = g_strdup(dev_addr); if (data->handsfree_address == NULL) goto free; ofono_modem_set_data(modem, data); ofono_modem_set_name(modem, alias); ofono_modem_register(modem); g_hash_table_insert(modem_hash, g_strdup(device), modem); return 0; free: if (data != NULL) g_free(data->handsfree_path); g_free(data); ofono_modem_remove(modem); return -ENOMEM; }
static void ril_rat_mode_cb(struct ril_msg *message, gpointer user_data) { DBG(""); struct cb_data *cbd = user_data; ofono_radio_settings_rat_mode_query_cb_t cb = cbd->cb; struct parcel rilp; int mode = OFONO_RADIO_ACCESS_MODE_ANY; int pref; if (message->error == RIL_E_SUCCESS) { ril_util_init_parcel(message, &rilp); /* first item in int[] is len so let's skip that */ parcel_r_int32(&rilp); pref = parcel_r_int32(&rilp); switch (pref) { case PREF_NET_TYPE_LTE_ONLY: mode = OFONO_RADIO_ACCESS_MODE_LTE; case PREF_NET_TYPE_GSM_ONLY: mode = OFONO_RADIO_ACCESS_MODE_GSM; break; case PREF_NET_TYPE_GSM_WCDMA_AUTO:/* according to UI design */ if (!cb) ril_force_rat_mode(cbd->user, pref); case PREF_NET_TYPE_WCDMA: case PREF_NET_TYPE_GSM_WCDMA: /* according to UI design */ mode = OFONO_RADIO_ACCESS_MODE_UMTS; break; case PREF_NET_TYPE_LTE_CDMA_EVDO: case PREF_NET_TYPE_LTE_GSM_WCDMA: case PREF_NET_TYPE_LTE_CMDA_EVDO_GSM_WCDMA: if (!cb) ril_force_rat_mode(cbd->user, pref); break; case PREF_NET_TYPE_CDMA_EVDO_AUTO: case PREF_NET_TYPE_CDMA_ONLY: case PREF_NET_TYPE_EVDO_ONLY: case PREF_NET_TYPE_GSM_WCDMA_CDMA_EVDO_AUTO: default: break; } ofono_info("rat mode %d (ril %d)", mode, pref); if (cb) CALLBACK_WITH_SUCCESS(cb, mode, cbd->data); } else { if (cb) CALLBACK_WITH_FAILURE(cb, -1, cbd->data); ofono_error("rat mode query failed"); } }
static void at_c0_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_cdma_connman *cm = user_data; DBG("ok %d", ok); if (ok == FALSE) { ofono_info("Unable to configure circuit 109"); ofono_cdma_connman_remove(cm); return; } ofono_cdma_connman_register(cm); }
static void ppp_connect(const char *interface, const char *local, const char *remote, const char *dns1, const char *dns2, gpointer user_data) { struct ofono_cdma_connman *cm = user_data; struct connman_data *cd = ofono_cdma_connman_get_data(cm); const char *dns[3]; DBG(""); dns[0] = dns1; dns[1] = dns2; dns[2] = 0; ofono_info("IP: %s", local); ofono_info("DNS: %s, %s", dns1, dns2); cd->state = STATE_ACTIVE; CALLBACK_WITH_SUCCESS(cd->up_cb, interface, TRUE, local, STATIC_IP_NETMASK, NULL, dns, cd->cb_data); }
static void slc_established(gpointer userdata) { struct ofono_modem *modem = userdata; struct hfp_data *data = ofono_modem_get_data(modem); DBusMessage *msg; ofono_modem_set_powered(modem, TRUE); msg = dbus_message_new_method_return(data->slc_msg); g_dbus_send_message(connection, msg); dbus_message_unref(data->slc_msg); data->slc_msg = NULL; ofono_info("Service level connection established"); }
static void ril_registration(struct ofono_call_forwarding *cf, int type, int cls, const struct ofono_phone_number *number, int time, ofono_call_forwarding_set_cb_t cb, void *data) { struct forw_data *fd = ofono_call_forwarding_get_data(cf); struct cb_data *cbd = cb_data_new(cb, data); struct parcel rilp; int ret = 0; ofono_info("cf registration"); parcel_init(&rilp); parcel_w_int32(&rilp, CF_ACTION_REGISTRATION); parcel_w_int32(&rilp, type); /* * Modem seems to respond with error to all queries * or settings made with bearer class * BEARER_CLASS_DEFAULT. Design decision: If given * class is BEARER_CLASS_DEFAULT let's map it to * SERVICE_CLASS_NONE as with it e.g. ./send-ussd '*21*<phone_number>#' * returns cls:53 i.e. 1+4+16+32 as service class. */ if (cls == BEARER_CLASS_DEFAULT) cls = SERVICE_CLASS_NONE; parcel_w_int32(&rilp, cls); parcel_w_int32(&rilp, number->type); parcel_w_string(&rilp, (char *) number->number); parcel_w_int32(&rilp, time); ret = g_ril_send(fd->ril, RIL_REQUEST_SET_CALL_FORWARD, rilp.data, rilp.size, ril_set_forward_cb, cbd, g_free); /* In case of error free cbd and return the cb with failure */ if (ret <= 0) { ofono_error("CF registration failed"); g_free(cbd); CALLBACK_WITH_FAILURE(cb, data); } }
static void ril_radio_state_changed(struct ril_msg *message, gpointer user_data) { struct ofono_modem *modem = user_data; struct ril_data *ril = ofono_modem_get_data(modem); int radio_state = g_ril_unsol_parse_radio_state_changed(ril->modem, message); if (radio_state != ril->radio_state) { ofono_info("%s: state: %s ril->ofono_online: %d", __func__, ril_radio_state_to_string(radio_state), ril->ofono_online); ril->radio_state = radio_state; switch (radio_state) { case RADIO_STATE_ON: if (ril->voice == NULL) ril->voice = ofono_voicecall_create(modem, 0, RILMODEM, ril->modem); send_get_sim_status(modem); break; case RADIO_STATE_UNAVAILABLE: case RADIO_STATE_OFF: /* * If radio powers off asychronously, then * assert, and let upstart re-start the stack. */ if (ril->ofono_online) { ofono_error("%s: radio self-powered off!", __func__); g_assert(FALSE); } break; default: /* Malformed parcel; no radio state == broken rild */ g_assert(FALSE); } } }
static void ifx_xhomezr_notify(GAtResult *result, gpointer user_data) { //struct ofono_netreg *netreg = user_data; const char *label; GAtResultIter iter; g_at_result_iter_init(&iter, result); if (!g_at_result_iter_next(&iter, "+XHOMEZR:")) return; if (!g_at_result_iter_next_string(&iter, &label)) return; ofono_info("Home zone: %s", label); }
static gboolean connect_rild(gpointer user_data) { struct ofono_modem *modem = (struct ofono_modem *) user_data; ofono_info("%s: Connecting %p to rild...", __func__, modem); if (create_gril(modem) < 0) { DBG("Connecting %p to rild failed, retry timer continues...", modem); return TRUE; } return FALSE; }
static void switch_finish_cb(struct ril_msg *message, gpointer user_data) { struct radio_data *rd = user_data; struct switch_data *sd = rd->switch_d; struct radio_data *rd1 = sd->rd_1; struct radio_data *rd2 = sd->rd_2; struct reply_radio_capability *caps; sd->pending_msgs--; if (message->error != RIL_E_SUCCESS) { ofono_error("%s: error %s", __func__, ril_error_to_string(message->error)); return; } caps = g_ril_reply_parse_get_radio_capability(rd->ril, message); if (caps == NULL) { ofono_error("%s: parse error", __func__); return; } if (sd->pending_msgs != 0) return; ofono_info("Switching radio caps between slots - FINISH"); set_preferred_network(rd1, sd->cbd, sd->mode_to_switch); /* * If the complementary slot does not support anymore its current * technology, we change it to the best possible among available ones. */ if ((rd2->rat_mode & rd2->available_rats) == 0) { struct cb_data *cbd = cb_data_new(set_preferred_cb, rd2, rd2->radio_settings); set_preferred_network(rd2, cbd, get_best_available_tech(rd2->available_rats)); } rd1->switch_d = NULL; rd2->switch_d = NULL; g_free(sd); g_free(caps); }
static gboolean connect_rild(gpointer user_data) { struct ofono_modem *modem = (struct ofono_modem *) user_data; struct ril_data *rd = ofono_modem_get_data(modem); ofono_info("Trying to reconnect to rild..."); if (rd->rild_connect_retries++ < RILD_MAX_CONNECT_RETRIES) { if (create_gril(modem) < 0) return TRUE; } else { ofono_error("Failed to connect to rild."); return TRUE; } return FALSE; }
static gboolean connect_rild(gpointer user_data) { struct ofono_modem *modem = (struct ofono_modem *) user_data; struct mtk_data *md = ofono_modem_get_data(modem); ofono_info("Trying to reconnect to slot %d...", md->slot); if (md->rild_connect_retries++ < RILD_MAX_CONNECT_RETRIES) { if (create_gril(modem) < 0) return TRUE; } else { ofono_error("Exiting, can't connect to rild."); exit(0); } return FALSE; }
static void slc_established(gpointer userdata) { struct ofono_modem *modem = userdata; struct hfp *hfp = ofono_modem_get_data(modem); DBusMessage *msg; ofono_modem_set_powered(modem, TRUE); msg = dbus_message_new_method_return(hfp->msg); g_dbus_send_message(ofono_dbus_get_connection(), msg); dbus_message_unref(hfp->msg); hfp->msg = NULL; ofono_info("Service level connection established"); ofono_handsfree_card_register(hfp->card); }
void ril_set_rat_mode(struct ofono_radio_settings *rs, enum ofono_radio_access_mode mode, ofono_radio_settings_rat_mode_set_cb_t cb, void *data) { struct radio_data *rd = ofono_radio_settings_get_data(rs); struct cb_data *cbd = cb_data_new(cb, data, rs); struct switch_data *sd = NULL; if (rd->switch_d != NULL) goto error; if ((rd->available_rats & mode) == 0) { if (g_ril_get_version(rd->ril) < 11) goto error; /* Check if we can switch rats with other slot */ sd = g_malloc0(sizeof (*sd)); sd->rd_1 = rd; sd->mode_to_switch = mode; sd->cbd = cbd; __ofono_modem_foreach(get_rs_with_mode, sd); if (sd->rd_2 == NULL) goto error; ofono_info("Switching radio caps between slots - START"); sd->rd_1->switch_d = sd; sd->rd_2->switch_d = sd; switch_caps(sd); } else { set_preferred_network(rd, cbd, mode); } return; error: ofono_error("%s: unable to set rat mode", __func__); g_free(sd); g_free(cbd); CALLBACK_WITH_FAILURE(cb, data); }
static void ril_set_rat_mode(struct ofono_radio_settings *rs, enum ofono_radio_access_mode mode, ofono_radio_settings_rat_mode_set_cb_t cb, void *data) { struct radio_data *rd = ofono_radio_settings_get_data(rs); struct cb_data *cbd = cb_data_new(cb, data); struct parcel rilp; int pref = rd->ratmode; int ret = 0; ofono_info("setting rat mode"); parcel_init(&rilp); parcel_w_int32(&rilp, 1); /* Number of params */ switch (mode) { case OFONO_RADIO_ACCESS_MODE_GSM: pref = PREF_NET_TYPE_GSM_ONLY; break; case OFONO_RADIO_ACCESS_MODE_UMTS: pref = PREF_NET_TYPE_GSM_WCDMA_AUTO; /* according to UI design */ break; case OFONO_RADIO_ACCESS_MODE_LTE: pref = PREF_NET_TYPE_LTE_ONLY; default: break; } parcel_w_int32(&rilp, pref); ret = g_ril_send(rd->ril, RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, rilp.data, rilp.size, ril_set_rat_cb, cbd, g_free); parcel_free(&rilp); if (ret <= 0) { ofono_error("unable to set rat mode"); g_free(cbd); CALLBACK_WITH_FAILURE(cb, data); } }
static int example_provision_get_settings(const char *mcc, const char *mnc, const char *spn, const char *imsi, const char *gid1, struct ofono_gprs_provision_data **settings, int *count) { ofono_debug("Provisioning..."); *count = 0; *settings = NULL; ofono_info("Provisioning for MCC %s, MNC %s, SPN '%s', IMSI '%s', " "GID1 '%s'", mcc, mnc, spn, imsi, gid1); if (strcmp(mcc, "246") != 0 || strcmp(mnc, "81") != 0 || g_strcmp0(spn, "oFono") != 0) return -ENOENT; ofono_debug("Creating example settings for phonesim"); *settings = g_try_new0(struct ofono_gprs_provision_data, 2); if (*settings == NULL) return -ENOMEM; *count = 2; /* Internet context settings */ (*settings)[0].proto = OFONO_GPRS_PROTO_IP; (*settings)[0].type = OFONO_GPRS_CONTEXT_TYPE_INTERNET; (*settings)[0].name = g_strdup("Phonesim Internet"); (*settings)[0].apn = g_strdup("internetapn"); /* MMS context settings */ (*settings)[1].proto = OFONO_GPRS_PROTO_IP; (*settings)[1].type = OFONO_GPRS_CONTEXT_TYPE_MMS; (*settings)[1].name = g_strdup("Phonesim MMS"); (*settings)[1].apn = g_strdup("mmsapn"); (*settings)[1].username = g_strdup("mmsuser"); (*settings)[1].password = g_strdup("mmspass"); (*settings)[1].message_proxy = g_strdup("10.11.12.13:8080"); (*settings)[1].message_center = g_strdup("http://mms.example.com:8000"); return 0; }
static void ril_query_rat_mode(struct ofono_radio_settings *rs, ofono_radio_settings_rat_mode_query_cb_t cb, void *data){ DBG(""); struct radio_data *rd = ofono_radio_settings_get_data(rs); struct cb_data *cbd = cb_data_new(cb, data); int ret = 0; ofono_info("rat mode query"); ret = g_ril_send(rd->ril, RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, NULL, 0, ril_rat_mode_cb, cbd, g_free); /* In case of error free cbd and return the cb with failure */ if (ret <= 0) { ofono_error("unable to send rat mode query"); g_free(cbd); CALLBACK_WITH_FAILURE(cb, -1, data); } }
static gboolean mtk_connected(gpointer user_data) { struct ofono_modem *modem = (struct ofono_modem *) user_data; struct mtk_data *md = ofono_modem_get_data(modem); ofono_info("[slot %d] CONNECTED", md->slot); DBG("calling set_powered(TRUE)"); if (!ofono_modem_get_powered(modem)) ofono_modem_set_powered(modem, TRUE); create_atoms_on_connection(modem); if (md->pending_cb) md->pending_cb(md->pending_cbd); /* Call the function just once */ return FALSE; }
static void switch_fw(struct ofono_modem *modem, int fw_type) { struct mtk_data *md = ofono_modem_get_data(modem); struct parcel rilp; ofono_info("Switching modem FW from %s to %s", fw_type_to_str(md->fw_type), fw_type_to_str(fw_type)); md->trm_pending = TRUE; set_fw_type(modem, fw_type); g_mtk_request_store_modem_type(md->ril, fw_type, &rilp); if (g_ril_send(md->ril, MTK_RIL_REQUEST_STORE_MODEM_TYPE, &rilp, store_type_cb, modem, NULL) == 0) { ofono_error("%s: failure sending request", __func__); md->trm_pending = FALSE; } }
static void lastcause_cb(struct ril_msg *message, gpointer user_data) { struct lastcause_req *reqdata = user_data; struct ofono_voicecall *vc = reqdata->vc; int id = reqdata->id; enum ofono_disconnect_reason reason = OFONO_DISCONNECT_REASON_ERROR; int last_cause = CALL_FAIL_ERROR_UNSPECIFIED; struct parcel rilp; ril_util_init_parcel(message, &rilp); if (parcel_r_int32(&rilp) > 0) last_cause = parcel_r_int32(&rilp); ofono_info("Call %d ended with RIL cause %d", id, last_cause); if (last_cause == CALL_FAIL_NORMAL || last_cause == CALL_FAIL_BUSY) { reason = OFONO_DISCONNECT_REASON_REMOTE_HANGUP; } ofono_voicecall_disconnected(vc, id, reason, NULL); }
static int create_gril(struct ofono_modem *modem) { struct ril_data *rd = ofono_modem_get_data(modem); int slot_id = ofono_modem_get_integer(modem, "Slot"); ofono_info("Using %s as socket for slot %d.", RILD_CMD_SOCKET[slot_id], slot_id); /* RIL expects user radio to connect to the socket */ rd->ril = g_ril_new_with_ucred(RILD_CMD_SOCKET[slot_id], OFONO_RIL_VENDOR_AOSP, RADIO_UID, RADIO_GID); /* NOTE: Since AT modems open a tty, and then call * g_at_chat_new(), they're able to return -EIO if * the first fails, and -ENOMEM if the second fails. * in our case, we already return -EIO if the ril_new * fails. If this is important, we can create a ril_socket * abstraction... ( probaby not a bad idea ). */ if (rd->ril == NULL) { ofono_error("g_ril_new() failed to create modem!"); return -EIO; } g_ril_set_slot(rd->ril, slot_id); if (getenv("OFONO_RIL_TRACE")) g_ril_set_trace(rd->ril, TRUE); if (getenv("OFONO_RIL_HEX_TRACE")) g_ril_set_debugf(rd->ril, ril_debug, GRIL_HEX_PREFIX[slot_id]); g_ril_register(rd->ril, RIL_UNSOL_RIL_CONNECTED, ril_connected, modem); g_ril_register(rd->ril, RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, ril_radio_state_changed, modem); return 0; }
static void bind_support_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct slc_establish_data *sed = user_data; struct hfp_slc_info *info = sed->info; GAtResultIter iter; int hf_indicator; if (!ok) goto error; g_at_result_iter_init(&iter, result); if (!g_at_result_iter_next(&iter, "+BIND:")) goto error; if (!g_at_result_iter_open_list(&iter)) goto error; while (g_at_result_iter_next_number(&iter, &hf_indicator)) { if (info->num_hf_indicators >= 20) goto error; ofono_info("AG supports the following HF indicator: %d", hf_indicator); info->hf_indicators[info->num_hf_indicators] = hf_indicator; info->num_hf_indicators += 1; } if (!g_at_result_iter_close_list(&iter)) goto error; slc_establish_data_ref(sed); g_at_chat_send(info->chat, "AT+BIND?", bind_prefix, bind_query_cb, sed, slc_establish_data_unref); return; error: slc_failed(sed); }
static void at_cgdata_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_gprs_context *gc = user_data; struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc); if (!ok) { struct ofono_error error; ofono_info("Unable to enter data state"); gcd->active_context = 0; gcd->state = STATE_IDLE; decode_at_error(&error, g_at_result_final_response(result)); gcd->up_cb(&error, NULL, 0, NULL, NULL, NULL, NULL, gcd->cb_data); return; } setup_ppp(gc); }
static void atd_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_cdma_connman *cm = user_data; struct connman_data *cd = ofono_cdma_connman_get_data(cm); DBG("ok %d", ok); if (ok == FALSE) { struct ofono_error error; ofono_info("Unable to enter data state"); cd->state = STATE_IDLE; decode_at_error(&error, g_at_result_final_response(result)); cd->up_cb(&error, NULL, 0, NULL, NULL, NULL, NULL, cd->cb_data); return; } setup_ppp(cm); }
static void ril_creg_cb(struct ril_msg *message, gpointer user_data) { struct cb_data *cbd = user_data; ofono_netreg_status_cb_t cb = cbd->cb; struct netreg_data *nd = cbd->user; struct ofono_error error; int status, lac, ci, tech; DBG(""); if (message->error != RIL_E_SUCCESS) { decode_ril_error(&error, "FAIL"); ofono_error("Failed to pull registration state"); cb(&error, -1, -1, -1, -1, cbd->data); return; } decode_ril_error(&error, "OK"); if (ril_util_parse_reg(nd->ril, message, &status, &lac, &ci, &tech, NULL) == FALSE) { CALLBACK_WITH_FAILURE(cb, -1, -1, -1, -1, cbd->data); return; } DBG("voice registration status is %d", status); if (status > 10) status = status - 10; if (status == NETWORK_REGISTRATION_STATUS_ROAMING) status = check_if_really_roaming(status); ofono_info("voice registration status is %d", status); nd->tech = tech; cb(&error, status, lac, ci, tech, cbd->data); }