Hi Ravi, On Tue, Jan 7, 2014 at 2:31 PM, Ravi kumar Veeramally <ravikumar.veeramally@xxxxxxxxxxxxxxx> wrote: > Listen for incoming connections and accept it. Create bnep interface > add it to bridge and notify control and connection state information > through HAL. Remove the device on disconnect request. If android > settings UI does not have bluetooth tethering enabled it immediately > sends disconnect signal. > --- > android/pan.c | 192 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 190 insertions(+), 2 deletions(-) > > diff --git a/android/pan.c b/android/pan.c > index 93078ba..0eef284 100644 > --- a/android/pan.c > +++ b/android/pan.c > @@ -63,12 +63,17 @@ struct pan_device { > uint8_t role; > GIOChannel *io; > struct bnep *session; > + guint watch; > }; > > static struct { > uint32_t record_id; > + guint watch; > + GIOChannel *io; > } nap_dev = { > .record_id = 0, > + .watch = 0, > + .io = NULL, > }; > > static int device_cmp(gconstpointer s, gconstpointer user_data) > @@ -81,13 +86,21 @@ static int device_cmp(gconstpointer s, gconstpointer user_data) > > static void pan_device_free(struct pan_device *dev) > { > + if (dev->watch > 0) { > + bnep_server_delete(BNEP_BRIDGE, dev->iface, &dev->dst); > + g_source_remove(dev->watch); > + dev->watch = 0; Usually it is not necessary to assign anything to struct members when you are freeing the whole struct since its memory gonna be freed anyway. -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html