summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-08-10 10:39:46 +0200
committerThomas Haller <thaller@redhat.com>2019-08-12 16:07:05 +0200
commit3c9b64652459581adc0bafbc6834fa533f42a13a (patch)
tree8a397d52563b0c756eb81477d4f71dad1269f9ef
parent907ea97088ab095e92cc9586a1682a8e0ed4186b (diff)
downloadNetworkManager-3c9b64652459581adc0bafbc6834fa533f42a13a.tar.gz
bluetooth: drop BlueZ 4 support (2)
-rw-r--r--src/devices/bluetooth/nm-bluez-common.h6
-rw-r--r--src/devices/bluetooth/nm-bluez-device.c222
-rw-r--r--src/devices/bluetooth/nm-bluez-device.h4
-rw-r--r--src/devices/bluetooth/nm-bluez-manager.c88
-rw-r--r--src/devices/bluetooth/nm-bluez5-manager.c3
5 files changed, 88 insertions, 235 deletions
diff --git a/src/devices/bluetooth/nm-bluez-common.h b/src/devices/bluetooth/nm-bluez-common.h
index 956375bb10..c0ab749aab 100644
--- a/src/devices/bluetooth/nm-bluez-common.h
+++ b/src/devices/bluetooth/nm-bluez-common.h
@@ -33,12 +33,6 @@
#define NM_BLUEZ5_NETWORK_INTERFACE "org.bluez.Network1"
#define NM_BLUEZ5_NETWORK_SERVER_INTERFACE "org.bluez.NetworkServer1"
-#define NM_BLUEZ4_MANAGER_INTERFACE "org.bluez.Manager"
-#define NM_BLUEZ4_ADAPTER_INTERFACE "org.bluez.Adapter"
-#define NM_BLUEZ4_DEVICE_INTERFACE "org.bluez.Device"
-#define NM_BLUEZ4_SERIAL_INTERFACE "org.bluez.Serial"
-#define NM_BLUEZ4_NETWORK_INTERFACE "org.bluez.Network"
-
#define NM_BLUEZ_MANAGER_BDADDR_ADDED "bdaddr-added"
#define NM_BLUEZ_MANAGER_NETWORK_SERVER_ADDED "network-server-added"
diff --git a/src/devices/bluetooth/nm-bluez-device.c b/src/devices/bluetooth/nm-bluez-device.c
index fb0a72c40f..657f521ee5 100644
--- a/src/devices/bluetooth/nm-bluez-device.c
+++ b/src/devices/bluetooth/nm-bluez-device.c
@@ -68,8 +68,6 @@ typedef struct {
GDBusProxy *adapter5;
gboolean adapter_powered;
- int bluez_version;
-
gboolean initialized;
gboolean usable;
NMBluetoothCapabilities connection_bt_type;
@@ -266,11 +264,15 @@ check_emit_usable (NMBluezDevice *self)
/* only expect the supported capabilities set. */
nm_assert ((priv->capabilities & ~(NM_BT_CAPABILITY_NAP | NM_BT_CAPABILITY_DUN)) == NM_BT_CAPABILITY_NONE );
- new_usable = ( priv->initialized && priv->capabilities
- && priv->name && priv->paired
- && ( (priv->bluez_version == 4)
- || (priv->bluez_version == 5 && priv->adapter5 && priv->adapter_powered))
- && priv->dbus_connection && priv->address && priv->adapter_address);
+ new_usable = ( priv->initialized
+ && priv->capabilities
+ && priv->name
+ && priv->paired
+ && priv->adapter5
+ && priv->adapter_powered
+ && priv->dbus_connection
+ && priv->address
+ && priv->adapter_address);
if (!new_usable)
goto END;
@@ -455,30 +457,15 @@ nm_bluez_device_disconnect (NMBluezDevice *self)
* connection attempt, we must complete the pending connect request.
* However, we must also ensure that we don't leave a connected device. */
if (priv->connection_bt_type == NM_BT_CAPABILITY_DUN) {
- if (priv->bluez_version == 4) {
- /* Can't pass a NULL interface name through dbus to bluez, so just
- * ignore the disconnect if the interface isn't known.
- */
- if (!priv->b4_iface)
- goto out;
- args = g_variant_new ("(s)", priv->b4_iface),
- dbus_iface = NM_BLUEZ4_SERIAL_INTERFACE;
- } else if (priv->bluez_version == 5) {
#if WITH_BLUEZ5_DUN
- nm_bluez5_dun_cleanup (priv->b5_dun_context);
+ nm_bluez5_dun_cleanup (priv->b5_dun_context);
#endif
- priv->connected = FALSE;
- goto out;
- }
+ priv->connected = FALSE;
+ goto out;
} else if (priv->connection_bt_type == NM_BT_CAPABILITY_NAP) {
- if (priv->bluez_version == 4)
- dbus_iface = NM_BLUEZ4_NETWORK_INTERFACE;
- else if (priv->bluez_version == 5)
- dbus_iface = NM_BLUEZ5_NETWORK_INTERFACE;
- else
- g_assert_not_reached ();
+ dbus_iface = NM_BLUEZ5_NETWORK_INTERFACE;
} else
- g_assert_not_reached ();
+ nm_assert_not_reached ();
g_dbus_connection_call (priv->dbus_connection,
NM_BLUEZ_SERVICE,
@@ -509,8 +496,7 @@ _connect_complete (NMBluezDevice *self,
nm_assert ((device || error) && !(device && error));
- if ( device
- && priv->bluez_version == 5) {
+ if (device) {
priv->connected = TRUE;
_notify (self, PROP_CONNECTED);
}
@@ -606,35 +592,28 @@ nm_bluez_device_connect_async (NMBluezDevice *self,
if (connection_bt_type == NM_BT_CAPABILITY_NAP) {
connect_type = BLUETOOTH_CONNECT_NAP;
- if (priv->bluez_version == 4)
- dbus_iface = NM_BLUEZ4_NETWORK_INTERFACE;
- else if (priv->bluez_version == 5)
- dbus_iface = NM_BLUEZ5_NETWORK_INTERFACE;
+ dbus_iface = NM_BLUEZ5_NETWORK_INTERFACE;
} else if (connection_bt_type == NM_BT_CAPABILITY_DUN) {
connect_type = BLUETOOTH_CONNECT_DUN;
- if (priv->bluez_version == 4)
- dbus_iface = NM_BLUEZ4_SERIAL_INTERFACE;
- else if (priv->bluez_version == 5) {
#if WITH_BLUEZ5_DUN
- if (priv->b5_dun_context == NULL)
- priv->b5_dun_context = nm_bluez5_dun_new (priv->adapter_address, priv->address);
- nm_bluez5_dun_connect (priv->b5_dun_context,
- _connect_cb_bluez5_dun,
- nm_utils_user_data_pack (g_object_ref (self),
- nm_g_object_ref (cancellable),
- callback,
- callback_user_data));
+ if (priv->b5_dun_context == NULL)
+ priv->b5_dun_context = nm_bluez5_dun_new (priv->adapter_address, priv->address);
+ nm_bluez5_dun_connect (priv->b5_dun_context,
+ _connect_cb_bluez5_dun,
+ nm_utils_user_data_pack (g_object_ref (self),
+ nm_g_object_ref (cancellable),
+ callback,
+ callback_user_data));
#else
- if (callback) {
- nm_utils_invoke_on_idle (_connect_cb_bluez5_dun_idle_no_b5,
- nm_utils_user_data_pack (g_object_ref (self),
- callback,
- callback_user_data),
- cancellable);
- }
-#endif
- return;
+ if (callback) {
+ nm_utils_invoke_on_idle (_connect_cb_bluez5_dun_idle_no_b5,
+ nm_utils_user_data_pack (g_object_ref (self),
+ callback,
+ callback_user_data),
+ cancellable);
}
+#endif
+ return;
} else
g_return_if_reached ();
@@ -927,97 +906,39 @@ properties_changed (GDBusProxy *proxy,
}
static void
-bluez4_property_changed (GDBusProxy *proxy,
- const char *property,
- GVariant *v,
- gpointer user_data)
-{
- NMBluezDevice *self = NM_BLUEZ_DEVICE (user_data);
-
- _take_one_variant_property (self, property, v);
- check_emit_usable (self);
-}
-
-static void
-get_properties_cb_4 (GObject *source_object, GAsyncResult *res, gpointer user_data)
-{
- NMBluezDevice *self = NM_BLUEZ_DEVICE (user_data);
- NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self);
- GError *err = NULL;
- GVariant *v_properties, *v_dict;
-
- v_properties = _nm_dbus_proxy_call_finish (priv->proxy, res,
- G_VARIANT_TYPE ("(a{sv})"),
- &err);
- if (!v_properties) {
- g_dbus_error_strip_remote_error (err);
- nm_log_warn (LOGD_BT, "bluez[%s] error getting device properties: %s",
- priv->path, err->message);
- g_error_free (err);
- g_signal_emit (self, signals[INITIALIZED], 0, FALSE);
- goto END;
- }
-
- v_dict = g_variant_get_child_value (v_properties, 0);
- _set_properties (self, v_dict);
- g_variant_unref (v_dict);
- g_variant_unref (v_properties);
-
- /* Check if any connections match this device */
- load_connections (self);
-
- priv->initialized = TRUE;
- g_signal_emit (self, signals[INITIALIZED], 0, TRUE);
-
- check_emit_usable (self);
-
-END:
- g_object_unref (self);
-}
-
-static void
query_properties (NMBluezDevice *self)
{
NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self);
GVariant *v;
- switch (priv->bluez_version) {
- case 4:
- g_dbus_proxy_call (priv->proxy, "GetProperties", NULL, G_DBUS_CALL_FLAGS_NO_AUTO_START, 3000,
- NULL, get_properties_cb_4, g_object_ref (self));
- break;
- case 5:
- g_object_freeze_notify (G_OBJECT (self));
- _take_variant_property_address (self, g_dbus_proxy_get_cached_property (priv->proxy, "Address"));
- _take_variant_property_connected (self, g_dbus_proxy_get_cached_property (priv->proxy, "Connected"));
- _take_variant_property_paired (self, g_dbus_proxy_get_cached_property (priv->proxy, "Paired"));
- _take_variant_property_name (self, g_dbus_proxy_get_cached_property (priv->proxy, "Name"));
- _take_variant_property_uuids (self, g_dbus_proxy_get_cached_property (priv->proxy, "UUIDs"));
- g_object_thaw_notify (G_OBJECT (self));
-
- v = g_dbus_proxy_get_cached_property (priv->proxy, "Adapter");
- if (VARIANT_IS_OF_TYPE_OBJECT_PATH (v)) {
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- NM_BLUEZ_SERVICE,
- g_variant_get_string (v, NULL),
- NM_BLUEZ5_ADAPTER_INTERFACE,
- NULL,
- (GAsyncReadyCallback) adapter5_on_acquired,
- g_object_ref (self));
- g_variant_unref (v);
- } else {
- /* If the Adapter property is unset at this point, we won't try to acquire the adapter later on
- * and the device stays unusable. This should not happen, but if it does, log a debug message. */
- nm_log_dbg (LOGD_BT, "bluez[%s] device has no adapter property and cannot be used.", priv->path);
- }
-
- /* Check if any connections match this device */
- load_connections (self);
+ g_object_freeze_notify (G_OBJECT (self));
+ _take_variant_property_address (self, g_dbus_proxy_get_cached_property (priv->proxy, "Address"));
+ _take_variant_property_connected (self, g_dbus_proxy_get_cached_property (priv->proxy, "Connected"));
+ _take_variant_property_paired (self, g_dbus_proxy_get_cached_property (priv->proxy, "Paired"));
+ _take_variant_property_name (self, g_dbus_proxy_get_cached_property (priv->proxy, "Name"));
+ _take_variant_property_uuids (self, g_dbus_proxy_get_cached_property (priv->proxy, "UUIDs"));
+ g_object_thaw_notify (G_OBJECT (self));
- break;
+ v = g_dbus_proxy_get_cached_property (priv->proxy, "Adapter");
+ if (VARIANT_IS_OF_TYPE_OBJECT_PATH (v)) {
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ NM_BLUEZ_SERVICE,
+ g_variant_get_string (v, NULL),
+ NM_BLUEZ5_ADAPTER_INTERFACE,
+ NULL,
+ (GAsyncReadyCallback) adapter5_on_acquired,
+ g_object_ref (self));
+ g_variant_unref (v);
+ } else {
+ /* If the Adapter property is unset at this point, we won't try to acquire the adapter later on
+ * and the device stays unusable. This should not happen, but if it does, log a debug message. */
+ nm_log_dbg (LOGD_BT, "bluez[%s] device has no adapter property and cannot be used.", priv->path);
}
+
+ /* Check if any connections match this device */
+ load_connections (self);
}
static void
@@ -1035,12 +956,6 @@ on_proxy_acquired (GObject *object, GAsyncResult *res, NMBluezDevice *self)
} else {
g_signal_connect (priv->proxy, "g-properties-changed",
G_CALLBACK (properties_changed), self);
- if (priv->bluez_version == 4) {
- /* Watch for custom Bluez4 PropertyChanged signals */
- _nm_dbus_signal_connect (priv->proxy, "PropertyChanged", G_VARIANT_TYPE ("(sv)"),
- G_CALLBACK (bluez4_property_changed), self);
- }
-
query_properties (self);
}
g_object_unref (self);
@@ -1123,17 +1038,13 @@ nm_bluez_device_init (NMBluezDevice *self)
NMBluezDevice *
nm_bluez_device_new (const char *path,
- const char *adapter_address,
- NMSettings *settings,
- int bluez_version)
+ NMSettings *settings)
{
NMBluezDevice *self;
NMBluezDevicePrivate *priv;
- const char *interface_name = NULL;
g_return_val_if_fail (path != NULL, NULL);
g_return_val_if_fail (NM_IS_SETTINGS (settings), NULL);
- g_return_val_if_fail (bluez_version == 4 || bluez_version == 5, NULL);
self = (NMBluezDevice *) g_object_new (NM_TYPE_BLUEZ_DEVICE,
NM_BLUEZ_DEVICE_PATH, path,
@@ -1145,11 +1056,7 @@ nm_bluez_device_new (const char *path,
priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self);
- priv->bluez_version = bluez_version;
priv->settings = g_object_ref (settings);
- g_return_val_if_fail (bluez_version == 5 || (bluez_version == 4 && adapter_address), NULL);
- if (adapter_address)
- set_adapter_address (self, adapter_address);
g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_ADDED, G_CALLBACK (cp_connection_added), self);
g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_REMOVED, G_CALLBACK (cp_connection_removed), self);
@@ -1160,21 +1067,12 @@ nm_bluez_device_new (const char *path,
(GAsyncReadyCallback) on_bus_acquired,
g_object_ref (self));
- switch (priv->bluez_version) {
- case 4:
- interface_name = NM_BLUEZ4_DEVICE_INTERFACE;
- break;
- case 5:
- interface_name = NM_BLUEZ5_DEVICE_INTERFACE;
- break;
- }
-
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
NM_BLUEZ_SERVICE,
priv->path,
- interface_name,
+ NM_BLUEZ5_DEVICE_INTERFACE,
NULL,
(GAsyncReadyCallback) on_proxy_acquired,
g_object_ref (self));
diff --git a/src/devices/bluetooth/nm-bluez-device.h b/src/devices/bluetooth/nm-bluez-device.h
index e8dd2cedee..93a228cac2 100644
--- a/src/devices/bluetooth/nm-bluez-device.h
+++ b/src/devices/bluetooth/nm-bluez-device.h
@@ -47,9 +47,7 @@ typedef struct _NMBluezDeviceClass NMBluezDeviceClass;
GType nm_bluez_device_get_type (void);
NMBluezDevice *nm_bluez_device_new (const char *path,
- const char *adapter_address,
- NMSettings *settings,
- int bluez_version);
+ NMSettings *settings);
const char *nm_bluez_device_get_path (NMBluezDevice *self);
diff --git a/src/devices/bluetooth/nm-bluez-manager.c b/src/devices/bluetooth/nm-bluez-manager.c
index 9933dbd033..b52fd0ec68 100644
--- a/src/devices/bluetooth/nm-bluez-manager.c
+++ b/src/devices/bluetooth/nm-bluez-manager.c
@@ -45,7 +45,6 @@
#define NM_BLUEZ_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_BLUEZ_MANAGER, NMBluezManagerClass))
typedef struct {
- int bluez_version;
NMSettings *settings;
NMBluez5Manager *manager5;
@@ -182,29 +181,15 @@ manager_network_server_added_cb (GObject *manager,
}
static void
-setup_version_number (NMBluezManager *self, int bluez_version)
-{
- NMBluezManagerPrivate *priv = NM_BLUEZ_MANAGER_GET_PRIVATE (self);
-
- g_return_if_fail (!priv->bluez_version);
-
- _LOGI ("use BlueZ version %d", bluez_version);
-
- priv->bluez_version = bluez_version;
-
- /* Just detected the version. Cleanup the ongoing checking/detection. */
- cleanup_checking (self, TRUE);
-}
-
-static void
setup_bluez5 (NMBluezManager *self)
{
NMBluez5Manager *manager;
NMBluezManagerPrivate *priv = NM_BLUEZ_MANAGER_GET_PRIVATE (self);
- g_return_if_fail (!priv->manager5 && !priv->bluez_version);
+ g_return_if_fail (!priv->manager5);
+
+ cleanup_checking (self, TRUE);
- setup_version_number (self, 5);
priv->manager5 = manager = nm_bluez5_manager_new (priv->settings);
g_signal_connect (manager,
@@ -229,31 +214,27 @@ watch_name_on_appeared (GDBusConnection *connection,
}
static void
-check_bluez_and_try_setup_final_step (NMBluezManager *self, int bluez_version, const char *reason)
+check_bluez_and_try_setup_final_step (NMBluezManager *self, gboolean ready, const char *reason)
{
NMBluezManagerPrivate *priv = NM_BLUEZ_MANAGER_GET_PRIVATE (self);
- g_return_if_fail (!priv->bluez_version);
-
- switch (bluez_version) {
- case 5:
+ if (ready) {
setup_bluez5 (self);
- break;
- default:
- _LOGD ("detecting BlueZ version failed: %s", reason);
-
- /* cancel current attempts to detect the version. */
- cleanup_checking (self, FALSE);
- if (!priv->watch_name_id) {
- priv->watch_name_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
- NM_BLUEZ_SERVICE,
- G_BUS_NAME_WATCHER_FLAGS_NONE,
- watch_name_on_appeared,
- NULL,
- self,
- NULL);
- }
- break;
+ return;
+ }
+
+ _LOGD ("detecting BlueZ version failed: %s", reason);
+
+ /* cancel current attempts to detect the version. */
+ cleanup_checking (self, FALSE);
+ if (!priv->watch_name_id) {
+ priv->watch_name_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
+ NM_BLUEZ_SERVICE,
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ watch_name_on_appeared,
+ NULL,
+ self,
+ NULL);
}
}
@@ -265,9 +246,7 @@ check_bluez_and_try_setup_do_introspect (GObject *source_object,
NMBluezManager *self = async_data_unpack (user_data);
NMBluezManagerPrivate *priv;
GError *error = NULL;
- GVariant *result;
- const char *xml_data;
- int bluez_version = 0;
+ gs_unref_variant GVariant *result = NULL;
const char *reason = NULL;
if (!self)
@@ -277,7 +256,6 @@ check_bluez_and_try_setup_do_introspect (GObject *source_object,
g_return_if_fail (priv->introspect_proxy);
g_return_if_fail (!g_cancellable_is_cancelled (priv->async_cancellable));
- g_return_if_fail (!priv->bluez_version);
g_clear_object (&priv->async_cancellable);
@@ -288,25 +266,13 @@ check_bluez_and_try_setup_do_introspect (GObject *source_object,
g_dbus_error_strip_remote_error (error);
reason2 = g_strdup_printf ("introspect failed with %s", error->message);
- check_bluez_and_try_setup_final_step (self, 0, reason2);
+ check_bluez_and_try_setup_final_step (self, FALSE, reason2);
g_error_free (error);
g_free (reason2);
return;
}
- g_variant_get (result, "(&s)", &xml_data);
-
- /* might not be the best approach to detect the version, but it's good enough in practice. */
- if (strstr (xml_data, "org.freedesktop.DBus.ObjectManager"))
- bluez_version = 5;
- else if (strstr (xml_data, NM_BLUEZ4_MANAGER_INTERFACE))
- bluez_version = 4;
- else
- reason = "unexpected introspect result";
-
- g_variant_unref (result);
-
- check_bluez_and_try_setup_final_step (self, bluez_version, reason);
+ check_bluez_and_try_setup_final_step (self, TRUE, reason);
}
static void
@@ -325,13 +291,13 @@ check_bluez_and_try_setup_on_new_proxy (GObject *source_object,
g_return_if_fail (!priv->introspect_proxy);
g_return_if_fail (!g_cancellable_is_cancelled (priv->async_cancellable));
- g_return_if_fail (!priv->bluez_version);
priv->introspect_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
if (!priv->introspect_proxy) {
char *reason = g_strdup_printf ("bluez error creating dbus proxy: %s", error->message);
- check_bluez_and_try_setup_final_step (self, 0, reason);
+
+ check_bluez_and_try_setup_final_step (self, FALSE, reason);
g_error_free (error);
g_free (reason);
return;
@@ -352,8 +318,6 @@ check_bluez_and_try_setup (NMBluezManager *self)
{
NMBluezManagerPrivate *priv = NM_BLUEZ_MANAGER_GET_PRIVATE (self);
- g_return_if_fail (!priv->bluez_version);
-
/* there should be no ongoing detection. Anyway, cleanup_checking. */
cleanup_checking (self, FALSE);
@@ -425,8 +389,6 @@ dispose (GObject *object)
cleanup_checking (self, TRUE);
- priv->bluez_version = 0;
-
G_OBJECT_CLASS (nm_bluez_manager_parent_class)->dispose (object);
g_clear_object (&priv->settings);
diff --git a/src/devices/bluetooth/nm-bluez5-manager.c b/src/devices/bluetooth/nm-bluez5-manager.c
index 7bcd04e54a..9d8d9a28cf 100644
--- a/src/devices/bluetooth/nm-bluez5-manager.c
+++ b/src/devices/bluetooth/nm-bluez5-manager.c
@@ -69,6 +69,7 @@ G_DEFINE_TYPE (NMBluez5Manager, nm_bluez5_manager, G_TYPE_OBJECT)
#define NM_BLUEZ5_MANAGER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMBluez5Manager, NM_IS_BLUEZ5_MANAGER)
#define NM_BLUEZ5_MANAGER_GET_NETWORK_SERVER_VTABLE(self) (&(self)->network_server_vtable)
+
#define NETWORK_SERVER_VTABLE_GET_NM_BLUEZ5_MANAGER(vtable) \
NM_BLUEZ5_MANAGER(((char *)(vtable)) - offsetof (struct _NMBluez5Manager, network_server_vtable))
@@ -345,7 +346,7 @@ device_added (GDBusProxy *proxy, const char *path, NMBluez5Manager *self)
NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self);
NMBluezDevice *device;
- device = nm_bluez_device_new (path, NULL, priv->settings, 5);
+ device = nm_bluez_device_new (path, priv->settings);
g_signal_connect (device, NM_BLUEZ_DEVICE_INITIALIZED, G_CALLBACK (device_initialized), self);
g_signal_connect (device, "notify::" NM_BLUEZ_DEVICE_USABLE, G_CALLBACK (device_usable), self);
g_hash_table_insert (priv->devices, (gpointer) nm_bluez_device_get_path (device), device);