[gnome-bluetooth/wip/hadess/more-debug: 2/3] lib: Add more debug in the discovery code




commit b0022a3e973af21e76fcad853db5c978e73118fb
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Jan 5 16:20:51 2022 +0100

    lib: Add more debug in the discovery code
    
    Add debug output when enabling or disabling discovery.

 lib/bluetooth-client.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index acb5b9b0..e70dd6c1 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -872,9 +872,14 @@ discovery_cb (Adapter1     *adapter,
        else
                ret = adapter1_call_stop_discovery_finish (adapter, res, &error);
        if (!ret) {
-               g_debug ("Error calling %s  on interface org.bluez.Adapter1: %s (%s, %d)",
+               g_debug ("Error calling %s on %s org.bluez.Adapter1: %s (%s, %d)",
                         start_call ? "StartDiscovery()" : "StopDiscovery()",
+                        g_dbus_proxy_get_object_path (G_DBUS_PROXY (adapter)),
                         error->message, g_quark_to_string (error->domain), error->code);
+       } else {
+               g_debug ("Ran %s successfully on %s org.bluez.Adapter1",
+                        start_call ? "StartDiscovery()" : "StopDiscovery()",
+                        g_dbus_proxy_get_object_path (G_DBUS_PROXY (adapter)));
        }
 }
 
@@ -886,8 +891,11 @@ _bluetooth_client_set_default_adapter_discovering (BluetoothClient *client,
        GVariantBuilder builder;
 
        adapter = _bluetooth_client_get_default_adapter (client);
-       if (adapter == NULL)
+       if (adapter == NULL) {
+               g_debug ("%s discovery requested, but no default adapter",
+                        discovering ? "Starting" : "Stopping");
                return;
+       }
 
        if (discovering) {
                g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
@@ -902,13 +910,15 @@ _bluetooth_client_set_default_adapter_discovering (BluetoothClient *client,
 
        client->discovery_started = discovering;
        if (discovering) {
+               g_debug ("Starting discovery on %s", g_dbus_proxy_get_object_path (adapter));
                adapter1_call_start_discovery (ADAPTER1 (adapter),
                                               client->cancellable,
                                               (GAsyncReadyCallback) discovery_cb,
                                               GUINT_TO_POINTER (discovering));
        } else {
-               /* Don't cancel a dicovery stop when the BluetoothClient
+               /* Don't cancel a discovery stop when the BluetoothClient
                 * is finalised, so don't pass a cancellable */
+               g_debug ("Stopping discovery on %s", g_dbus_proxy_get_object_path (adapter));
                adapter1_call_stop_discovery (ADAPTER1 (adapter),
                                              NULL,
                                              (GAsyncReadyCallback) discovery_cb,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]