bluetooth: Check ownership of device
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Fri, 1 Jun 2012 14:11:30 +0000 (16:11 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 4 Jun 2012 13:21:01 +0000 (16:21 +0300)
We have two drivers for the CONNMAN_DEVICE_TYPE_BLUETOOTH and therefore
check owner ship in probe function.

plugins/bluetooth.c

index d132870..9e1aaa2 100644 (file)
@@ -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)