From 84e9bd91181e160d560f60d35d037d900129ae53 Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Fri, 1 Jun 2012 16:11:30 +0200 Subject: [PATCH] bluetooth: Check ownership of device We have two drivers for the CONNMAN_DEVICE_TYPE_BLUETOOTH and therefore check owner ship in probe function. --- plugins/bluetooth.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c index d132870..9e1aaa2 100644 --- a/plugins/bluetooth.c +++ b/plugins/bluetooth.c @@ -885,9 +885,24 @@ static void bluetooth_disconnect(DBusConnection *connection, void *user_data) static int bluetooth_probe(struct connman_device *device) { + GHashTableIter iter; + gpointer key, value; + DBG("device %p", device); - return 0; + if (bluetooth_devices == NULL) + return -ENOTSUP; + + g_hash_table_iter_init(&iter, bluetooth_devices); + + while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) { + struct connman_device *device_pan = value; + + if (device == device_pan) + return 0; + } + + return -ENOTSUP; } static void bluetooth_remove(struct connman_device *device) -- 2.7.4