Esempio n. 1
0
static void input_device_free(struct input_device *idev)
{
	bt_uhid_unref(idev->uhid);
	btd_service_unref(idev->service);
	btd_device_unref(idev->device);
	g_free(idev->path);

	if (idev->ctrl_watch > 0)
		g_source_remove(idev->ctrl_watch);

	if (idev->intr_watch > 0)
		g_source_remove(idev->intr_watch);

	if (idev->sec_watch > 0)
		g_source_remove(idev->sec_watch);

	if (idev->intr_io)
		g_io_channel_unref(idev->intr_io);

	if (idev->ctrl_io)
		g_io_channel_unref(idev->ctrl_io);

	if (idev->req) {
		g_free(idev->req->rd_data);
		g_free(idev->req);
	}

	if (idev->reconnect_timer > 0)
		g_source_remove(idev->reconnect_timer);

	if (idev->report_req_timer > 0)
		g_source_remove(idev->report_req_timer);

	g_free(idev);
}
Esempio n. 2
0
static void input_device_free(struct input_device *idev)
{
    if (idev->dc_id)
        device_remove_disconnect_watch(idev->device, idev->dc_id);

    btd_service_unref(idev->service);
    btd_device_unref(idev->device);
    g_free(idev->name);
    g_free(idev->path);

    if (idev->ctrl_watch > 0)
        g_source_remove(idev->ctrl_watch);

    if (idev->intr_watch > 0)
        g_source_remove(idev->intr_watch);

    if (idev->sec_watch > 0)
        g_source_remove(idev->sec_watch);

    if (idev->intr_io)
        g_io_channel_unref(idev->intr_io);

    if (idev->ctrl_io)
        g_io_channel_unref(idev->ctrl_io);

    if (idev->req) {
        g_free(idev->req->rd_data);
        g_free(idev->req);
    }

    if (idev->reconnect_timer > 0)
        g_source_remove(idev->reconnect_timer);

    g_free(idev);
}
Esempio n. 3
0
static void source_free(struct btd_service *service)
{
	struct source *source = btd_service_get_user_data(service);

	if (source->cb_id)
		avdtp_stream_remove_cb(source->session, source->stream,
					source->cb_id);

	if (source->session)
		avdtp_unref(source->session);

	if (source->connect_id > 0) {
		btd_service_connecting_complete(source->service, -ECANCELED);
		a2dp_cancel(source->connect_id);
		source->connect_id = 0;
	}

	if (source->disconnect_id > 0) {
		btd_service_disconnecting_complete(source->service, -ECANCELED);
		a2dp_cancel(source->disconnect_id);
		source->disconnect_id = 0;
	}

	avdtp_remove_state_cb(source->avdtp_callback_id);
	btd_service_unref(source->service);

	g_free(source);
}
Esempio n. 4
0
File: sink.c Progetto: Thread974/bz
static void sink_free(struct audio_device *dev)
{
	struct sink *sink = dev->sink;

	if (sink->cb_id)
		avdtp_stream_remove_cb(sink->session, sink->stream,
					sink->cb_id);

	if (sink->session)
		avdtp_unref(sink->session);

	if (sink->connect_id > 0) {
		btd_service_connecting_complete(sink->service, -ECANCELED);
		a2dp_cancel(dev, sink->connect_id);
		sink->connect_id = 0;
	}

	if (sink->disconnect_id > 0) {
		btd_service_disconnecting_complete(sink->service, -ECANCELED);
		a2dp_cancel(dev, sink->disconnect_id);
		sink->disconnect_id = 0;
	}

	if (sink->retry_id)
		g_source_remove(sink->retry_id);

	avdtp_remove_state_cb(sink->avdtp_callback_id);
	btd_service_unref(sink->service);

	g_free(sink);
	dev->sink = NULL;
}
Esempio n. 5
0
void service_remove(struct btd_service *service)
{
	change_state(service, BTD_SERVICE_STATE_UNAVAILABLE, 0);
	service->profile->device_remove(service);
	service->device = NULL;
	service->profile = NULL;
	btd_service_unref(service);
}
Esempio n. 6
0
static void path_unregister(void *data)
{
	struct control *control = data;

	DBG("Unregistered interface %s on path %s",  AUDIO_CONTROL_INTERFACE,
						device_get_path(control->dev));

	if (control->session)
		avctp_disconnect(control->session);

	avctp_remove_state_cb(control->avctp_id);

	if (control->target)
		btd_service_unref(control->target);

	if (control->remote)
		btd_service_unref(control->remote);

	devices = g_slist_remove(devices, control);
	g_free(control);
}
Esempio n. 7
0
static void connection_free(void *data)
{
	struct network_conn *nc = data;

	if (nc->dc_id)
		device_remove_disconnect_watch(nc->peer->device, nc->dc_id);

	connection_destroy(NULL, nc);

	if (nc->connect)
		dbus_message_unref(nc->connect);

	btd_service_unref(nc->service);
	g_free(nc);
}