From 74595b14072b11466c2f75af9bfb0951a4689a56 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 25 Jan 2013 11:48:53 +0200 Subject: [PATCH] core: Make device_connect LE return int instead of GIOChannel The IO channel doesn't need external tracking so just return a simple int instead. --- src/device.c | 10 +++++----- src/device.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/device.c b/src/device.c index 4113811be..ea316b717 100644 --- a/src/device.c +++ b/src/device.c @@ -3116,7 +3116,7 @@ static void att_success_cb(gpointer user_data) g_slist_foreach(device->attios, attio_connected, device->attrib); } -GIOChannel *device_connect_le(struct btd_device *dev) +int device_connect_le(struct btd_device *dev) { struct btd_adapter *adapter = dev->adapter; struct att_callbacks *attcb; @@ -3127,7 +3127,7 @@ GIOChannel *device_connect_le(struct btd_device *dev) /* There is one connection attempt going on */ if (dev->att_io) - return NULL; + return -EALREADY; ba2str(&dev->bdaddr, addr); @@ -3168,13 +3168,13 @@ GIOChannel *device_connect_le(struct btd_device *dev) error("ATT bt_io_connect(%s): %s", addr, gerr->message); g_error_free(gerr); g_free(attcb); - return NULL; + return -EIO; } /* Keep this, so we can cancel the connection */ - dev->att_io = g_io_channel_ref(io); + dev->att_io = io; - return io; + return 0; } static void att_browse_error_cb(const GError *gerr, gpointer user_data) diff --git a/src/device.h b/src/device.h index 696632c2b..102f21f9d 100644 --- a/src/device.h +++ b/src/device.h @@ -109,7 +109,7 @@ int device_unblock(struct btd_device *device, gboolean silent, void btd_device_set_pnpid(struct btd_device *device, uint16_t source, uint16_t vendor, uint16_t product, uint16_t version); -GIOChannel *device_connect_le(struct btd_device *dev); +int device_connect_le(struct btd_device *dev); struct btd_profile; -- 2.11.0