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 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); }