[gnome-bluetooth/wip/hadess/workaround-connect-firmware] settings-widget: Work-around intermittent connection problems
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/wip/hadess/workaround-connect-firmware] settings-widget: Work-around intermittent connection problems
- Date: Wed, 16 Sep 2020 12:41:59 +0000 (UTC)
commit 97fea89a93acb049eee78a4199149423f00ec394
Author: Bastien Nocera <hadess hadess net>
Date: Wed Sep 16 14:07:04 2020 +0200
settings-widget: Work-around intermittent connection problems
Disable discovery during pairing and connect so as to work around broken
firmwares and hardware not being able to correctly connect to remote
devices when the adapter is performing a discovery.
Closes: #820
lib/bluetooth-settings-widget.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/lib/bluetooth-settings-widget.c b/lib/bluetooth-settings-widget.c
index 2f5b7403..e006d10f 100644
--- a/lib/bluetooth-settings-widget.c
+++ b/lib/bluetooth-settings-widget.c
@@ -162,6 +162,14 @@ is_connecting (BluetoothSettingsWidget *self,
bdaddr));
}
+static gboolean
+has_default_adapter (BluetoothSettingsWidget *self)
+{
+ g_autofree char *default_adapter = NULL;
+ g_object_get (priv->client, "default-adapter", &default_adapter, NULL);
+ return (default_adapter != NULL);
+}
+
typedef struct {
char *bdaddr;
BluetoothSettingsWidget *self;
@@ -207,6 +215,10 @@ connect_done (GObject *source_object,
//FIXME show an error if it failed?
out:
+ g_object_set (G_OBJECT (client),
+ "default-adapter-discovering", has_default_adapter (self),
+ NULL);
+
g_clear_error (&error);
g_free (data->bdaddr);
g_free (data);
@@ -930,6 +942,10 @@ create_callback (GObject *source_object,
g_free (dbus_error);
g_error_free (error);
g_free (path);
+
+ g_object_set (G_OBJECT (client),
+ "default-adapter-discovering", has_default_adapter (self),
+ NULL);
return;
}
@@ -1025,6 +1041,7 @@ start_pairing (BluetoothSettingsWidget *self,
g_strdup (g_dbus_proxy_get_object_path (proxy)),
GINT_TO_POINTER (1));
+ g_object_set (G_OBJECT (client), "default-adapter-discovering", FALSE, NULL);
bluetooth_client_setup_device (priv->client,
g_dbus_proxy_get_object_path (proxy),
pair,
@@ -1052,6 +1069,9 @@ switch_connected_state_set (GtkSwitch *button,
data->bdaddr = g_strdup (priv->selected_bdaddr);
data->self = self;
+ g_object_set (G_OBJECT (client),
+ "default-adapter-discovering", has_default_adapter (self),
+ NULL);
bluetooth_client_connect_service (priv->client,
priv->selected_object_path,
gtk_switch_get_active (button),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]