static void he910_remove(struct ofono_modem *modem) { struct he910_data *data = ofono_modem_get_data(modem); DBG("%p", modem); ofono_modem_set_data(modem, NULL); /* Cleanup after hot-unplug */ g_at_chat_unref(data->chat); g_at_chat_unref(data->modem); g_free(data); }
static void caif_init(gboolean ok, GAtResult *result, gpointer data) { GAtChat *chat = data; g_print("caif_init: %d\n", ok); if (ok == FALSE) { g_at_chat_unref(chat); g_main_loop_quit(mainloop); return; } g_at_chat_unref(chat); g_main_loop_quit(mainloop); }
static void telit_remove(struct ofono_modem *modem) { struct telit_data *data = ofono_modem_get_data(modem); DBG("%p", modem); bluetooth_sap_client_unregister(modem); ofono_modem_set_data(modem, NULL); /* Cleanup after hot-unplug */ g_at_chat_unref(data->chat); g_at_chat_unref(data->modem); g_free(data); }
void dundee_device_disconnect(const struct dundee_error *error, struct dundee_device *device) { if (device == NULL) return; DBG("%s", device->path); g_at_chat_unref(device->chat); device->chat = NULL; if (device->pending == NULL) return; if (error->type != DUNDEE_ERROR_TYPE_NO_ERROR) { __ofono_dbus_pending_reply(&device->pending, __dundee_error_failed(device->pending)); goto out; } __ofono_dbus_pending_reply(&device->pending, dbus_message_new_method_return(device->pending)); out: device->pending = NULL; }
static int hfp_disable(struct ofono_modem *modem) { struct hfp *hfp = ofono_modem_get_data(modem); struct hfp_slc_info *info = &hfp->info; GIOChannel *channel; int fd; DBG("%p", modem); /* * Instead of triggering two round trips to BlueZ (DisconnectProfile, * RequestDisconnection) simply kill the connection on the RFCOMM fd * we already have. But for this we have to call shutdown(). */ channel = g_at_chat_get_channel(info->chat); fd = g_io_channel_unix_get_fd(channel); shutdown(fd, SHUT_RDWR); ofono_handsfree_card_remove(hfp->card); hfp->card = NULL; g_at_chat_unref(info->chat); info->chat = NULL; return 0; }
static void shutdown_device(struct ifx_data *data) { int i, fd; DBG(""); if (data->dlc_init_source > 0) { g_source_remove(data->dlc_init_source); data->dlc_init_source = 0; } for (i = 0; i < NUM_DLC; i++) { if (data->dlcs[i] == NULL) continue; g_at_chat_unref(data->dlcs[i]); data->dlcs[i] = NULL; } if (data->mux) { g_at_mux_shutdown(data->mux); g_at_mux_unref(data->mux); data->mux = NULL; goto done; } fd = g_io_channel_unix_get_fd(data->device); if (ioctl(fd, TIOCSETD, &data->saved_ldisc) < 0) ofono_warn("Failed to restore line discipline"); done: g_io_channel_unref(data->device); data->device = NULL; }
static void mux_setup_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct mux_setup_data *msd = user_data; GIOFlags flags; GIOChannel *channel; GAtMux *mux = NULL; if (!ok) goto error; channel = g_at_chat_get_channel(msd->chat); channel = g_io_channel_ref(channel); g_at_chat_unref(msd->chat); msd->chat = NULL; flags = g_io_channel_get_flags(channel) | G_IO_FLAG_NONBLOCK; g_io_channel_set_flags(channel, flags, NULL); g_io_channel_set_encoding(channel, NULL, NULL); g_io_channel_set_buffered(channel, FALSE); if (msd->mode == 0) mux = g_at_mux_new_gsm0710_basic(channel, msd->frame_size); else mux = g_at_mux_new_gsm0710_advanced(channel, msd->frame_size); g_io_channel_unref(channel); error: msd->func(mux, msd->user); if (msd->destroy) msd->destroy(msd->user); }
static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_modem *modem = user_data; struct telit_data *data = ofono_modem_get_data(modem); DBG("%p", modem); if (!ok) { g_at_chat_unref(data->chat); data->chat = NULL; ofono_modem_set_powered(modem, FALSE); return; } ofono_modem_set_powered(modem, TRUE); /* Enable sim state notification */ g_at_chat_send(data->chat, "AT#QSS=1", none_prefix, NULL, NULL, NULL); /* Follow sim state */ g_at_chat_register(data->chat, "#QSS:", telit_qss_notify, FALSE, modem, NULL); /* Query current sim state */ g_at_chat_send(data->chat, "AT#QSS?", qss_prefix, telit_qss_cb, modem, NULL); }
static int he910_enable(struct ofono_modem *modem) { struct he910_data *data = ofono_modem_get_data(modem); DBG("%p", modem); data->modem = open_device(modem, "Modem", "Modem: "); if (data->modem == NULL) return -EINVAL; data->chat = open_device(modem, "Aux", "Aux: "); if (data->chat == NULL) { g_at_chat_unref(data->modem); data->modem = NULL; return -EIO; } g_at_chat_set_slave(data->modem, data->chat); /* * Disable command echo and * enable the Extended Error Result Codes */ g_at_chat_send(data->chat, "ATE0 +CMEE=1", none_prefix, NULL, NULL, NULL); /* Set phone functionality */ g_at_chat_send(data->chat, "AT+CFUN=1", none_prefix, cfun_enable_cb, modem, NULL); return -EINPROGRESS; }
static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_modem *modem = user_data; struct he910_data *data = ofono_modem_get_data(modem); DBG("%p", modem); if (!ok) { g_at_chat_unref(data->chat); data->chat = NULL; g_at_chat_unref(data->modem); data->modem = NULL; ofono_modem_set_powered(modem, FALSE); return; } /* * Switch data carrier detect signal off. * When the DCD is disabled the modem does not hangup anymore * after the data connection. */ g_at_chat_send(data->chat, "AT&C0", NULL, NULL, NULL, NULL); data->have_sim = FALSE; data->sms_phonebook_added = FALSE; ofono_modem_set_powered(modem, TRUE); /* * Tell the modem not to automatically initiate auto-attach * proceedures on its own. */ g_at_chat_send(data->chat, "AT#AUTOATT=0", none_prefix, NULL, NULL, NULL); /* Follow sim state */ g_at_chat_register(data->chat, "#QSS:", he910_qss_notify, FALSE, modem, NULL); /* Enable sim state notification */ g_at_chat_send(data->chat, "AT#QSS=2", none_prefix, NULL, NULL, NULL); g_at_chat_send(data->chat, "AT#QSS?", qss_prefix, qss_query_cb, modem, NULL); }
static void at_devinfo_remove(struct ofono_devinfo *info) { GAtChat *chat = ofono_devinfo_get_data(info); ofono_devinfo_set_data(info, NULL); g_at_chat_unref(chat); }
static void huawei_cdma_netreg_remove(struct ofono_cdma_netreg *netreg) { GAtChat *chat = ofono_cdma_netreg_get_data(netreg); ofono_cdma_netreg_set_data(netreg, NULL); g_at_chat_unref(chat); }
static void ste_radio_settings_remove(struct ofono_radio_settings *rs) { struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs); ofono_radio_settings_set_data(rs, NULL); g_at_chat_unref(rsd->chat); g_free(rsd); }
static void ifx_ctm_remove(struct ofono_ctm *ctm) { struct ctm_data *ctmd = ofono_ctm_get_data(ctm); ofono_ctm_set_data(ctm, NULL); g_at_chat_unref(ctmd->chat); g_free(ctmd); }
static void hfp_siri_remove(struct ofono_siri *siri) { struct siri_data *sd = ofono_siri_get_data(siri); ofono_siri_set_data(siri, NULL); g_at_chat_unref(sd->chat); g_free(sd); }
static void hso_gprs_context_remove(struct ofono_gprs_context *gc) { struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc); ofono_gprs_context_set_data(gc, NULL); g_at_chat_unref(gcd->chat); g_free(gcd); }
static void at_gprs_remove(struct ofono_gprs *gprs) { struct gprs_data *gd = ofono_gprs_get_data(gprs); ofono_gprs_set_data(gprs, NULL); g_at_chat_unref(gd->chat); g_free(gd); }
static void telit_location_reporting_remove(struct ofono_location_reporting *lr) { struct gps_data *gd = ofono_location_reporting_get_data(lr); ofono_location_reporting_set_data(lr, NULL); g_at_chat_unref(gd->chat); g_free(gd); }
static void msd_free(gpointer user_data) { struct mux_setup_data *msd = user_data; if (msd->chat) g_at_chat_unref(msd->chat); g_free(msd); }
static void at_sim_auth_remove(struct ofono_sim_auth *sa) { struct sim_auth_data *sad = ofono_sim_auth_get_data(sa); ofono_sim_auth_set_data(sa, NULL); g_at_chat_unref(sad->chat); g_free(sad); }
static void huawei_audio_settings_remove(struct ofono_audio_settings *as) { struct audio_settings_data *asd = ofono_audio_settings_get_data(as); ofono_audio_settings_set_data(as, NULL); g_at_chat_unref(asd->chat); g_free(asd); }
static void cdma_voicecall_remove(struct ofono_cdma_voicecall *vc) { struct voicecall_data *vd = ofono_cdma_voicecall_get_data(vc); ofono_cdma_voicecall_set_data(vc, NULL); g_at_chat_unref(vd->chat); g_free(vd); }
static int localhfp_disable(struct ofono_modem *modem) { struct hfp_slc_info *info = ofono_modem_get_data(modem); g_at_chat_unref(info->chat); info->chat = NULL; return 0; }
static void hfp_disconnected_cb(gpointer user_data) { struct ofono_modem *modem = user_data; struct hfp_data *data = ofono_modem_get_data(modem); ofono_modem_set_powered(modem, FALSE); g_at_chat_unref(data->info.chat); data->info.chat = NULL; }
static void slc_failed(gpointer userdata) { struct ofono_modem *modem = userdata; struct hfp_slc_info *info = ofono_modem_get_data(modem); ofono_modem_set_powered(modem, FALSE); g_at_chat_unref(info->chat); info->chat = NULL; }
static void phonesim_ctm_remove(struct ofono_ctm *ctm) { GAtChat *chat = ofono_ctm_get_data(ctm); DBG(""); ofono_ctm_set_data(ctm, NULL); g_at_chat_unref(chat); }
static void hfp_netreg_remove(struct ofono_netreg *netreg) { struct netreg_data *nd = ofono_netreg_get_data(netreg); if (nd->register_source != 0) g_source_remove(nd->register_source); ofono_netreg_set_data(netreg, NULL); g_at_chat_unref(nd->chat); g_free(nd); }
static int atgen_disable(struct ofono_modem *modem) { GAtChat *chat = ofono_modem_get_data(modem); DBG("%p", modem); ofono_modem_set_data(modem, NULL); g_at_chat_unref(chat); return 0; }
static void at_netreg_remove(struct ofono_netreg *netreg) { struct netreg_data *nd = ofono_netreg_get_data(netreg); if (nd->nitz_timeout) g_source_remove(nd->nitz_timeout); ofono_netreg_set_data(netreg, NULL); g_at_chat_unref(nd->chat); g_free(nd); }
static void phonesim_context_remove(struct ofono_gprs_context *gc) { struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc); DBG(""); ofono_gprs_context_set_data(gc, NULL); g_at_chat_unref(gcd->chat); g_free(gcd->interface); g_free(gcd); }