[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 13:07:17 +0000 (UTC)
commit 95f13ad6fcaab4f8678857ed351b28ce67aba088
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: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/820
lib/bluetooth-settings-widget.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
---
diff --git a/lib/bluetooth-settings-widget.c b/lib/bluetooth-settings-widget.c
index 2f5b7403..53504e60 100644
--- a/lib/bluetooth-settings-widget.c
+++ b/lib/bluetooth-settings-widget.c
@@ -162,6 +162,17 @@ is_connecting (BluetoothSettingsWidget *self,
bdaddr));
}
+static gboolean
+has_default_adapter (BluetoothSettingsWidget *self)
+{
+ g_autofree char *default_adapter = NULL;
+ BluetoothSettingsWidgetPrivate *priv;
+
+ priv = BLUETOOTH_SETTINGS_WIDGET_GET_PRIVATE (self);
+ g_object_get (priv->client, "default-adapter", &default_adapter, NULL);
+ return (default_adapter != NULL);
+}
+
typedef struct {
char *bdaddr;
BluetoothSettingsWidget *self;
@@ -205,6 +216,9 @@ connect_done (GObject *source_object,
remove_connecting (self, data->bdaddr);
//FIXME show an error if it failed?
+ g_object_set (G_OBJECT (priv->client),
+ "default-adapter-discovering", has_default_adapter (self),
+ NULL);
out:
g_clear_error (&error);
@@ -890,7 +904,8 @@ create_callback (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- BluetoothSettingsWidgetPrivate *priv = BLUETOOTH_SETTINGS_WIDGET_GET_PRIVATE (user_data);
+ BluetoothSettingsWidget *self = user_data;
+ BluetoothSettingsWidgetPrivate *priv = BLUETOOTH_SETTINGS_WIDGET_GET_PRIVATE (self);
SetupConnectData *data;
GError *error = NULL;
gboolean ret;
@@ -930,6 +945,10 @@ create_callback (GObject *source_object,
g_free (dbus_error);
g_error_free (error);
g_free (path);
+
+ g_object_set (G_OBJECT (priv->client),
+ "default-adapter-discovering", has_default_adapter (self),
+ NULL);
return;
}
@@ -1025,6 +1044,7 @@ start_pairing (BluetoothSettingsWidget *self,
g_strdup (g_dbus_proxy_get_object_path (proxy)),
GINT_TO_POINTER (1));
+ g_object_set (G_OBJECT (priv->client), "default-adapter-discovering", FALSE, NULL);
bluetooth_client_setup_device (priv->client,
g_dbus_proxy_get_object_path (proxy),
pair,
@@ -1052,6 +1072,9 @@ switch_connected_state_set (GtkSwitch *button,
data->bdaddr = g_strdup (priv->selected_bdaddr);
data->self = self;
+ g_object_set (G_OBJECT (priv->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]