From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 1/4] shared/gatt-client: Use parent debug_callback if not set on clone
Date: Thu, 5 Jan 2023 14:09:41 -0800 [thread overview]
Message-ID: <20230105220944.2373424-1-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If clone don't have a dedicated callback set use its parent so users of
bt_gatt_client_clone don't have to keep setting the same callback for
all clone instances.
---
src/shared/gatt-client.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index cb2e64b6cc6b..4aa5d7d92957 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -38,7 +38,8 @@
#define GATT_SVC_UUID 0x1801
#define SVC_CHNGD_UUID 0x2a05
#define DBG(_client, _format, arg...) \
- gatt_log(_client, "%s:%s() " _format, __FILE__, __func__, ## arg)
+ gatt_log(_client, "[%p] %s:%s() " _format, _client, __FILE__, \
+ __func__, ## arg)
struct ready_cb {
bt_gatt_client_callback_t callback;
@@ -357,15 +358,28 @@ static void discovery_op_free(struct discovery_op *op)
static bool read_db_hash(struct discovery_op *op);
+static void gatt_log_va(struct bt_gatt_client *client, const char *format,
+ va_list va)
+{
+ if (!client || !format)
+ return;
+
+ if (client->debug_callback)
+ util_debug_va(client->debug_callback, client->debug_data,
+ format, va);
+ else
+ gatt_log_va(client->parent, format, va);
+}
+
static void gatt_log(struct bt_gatt_client *client, const char *format, ...)
{
va_list ap;
- if (!client || !format || !client->debug_callback)
+ if (!client || !format)
return;
va_start(ap, format);
- util_debug_va(client->debug_callback, client->debug_data, format, ap);
+ gatt_log_va(client, format, ap);
va_end(ap);
}
--
2.37.3
next reply other threads:[~2023-01-05 22:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 22:09 Luiz Augusto von Dentz [this message]
2023-01-05 22:09 ` [PATCH BlueZ 2/4] shared/gatt-client: Allow registering with NULL callback Luiz Augusto von Dentz
2023-01-05 22:09 ` [PATCH BlueZ 3/4] attrib: Introduce g_attrib_attach_client Luiz Augusto von Dentz
2023-01-05 22:09 ` [PATCH BlueZ 4/4] hog-lib: Fix not handling BT_ATT_OP_HANDLE_NFY_MULT Luiz Augusto von Dentz
2023-01-06 0:03 ` [BlueZ,1/4] shared/gatt-client: Use parent debug_callback if not set on clone bluez.test.bot
2023-01-06 0:11 ` Luiz Augusto von Dentz
2023-01-06 20:00 ` [PATCH BlueZ 1/4] " patchwork-bot+bluetooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230105220944.2373424-1-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox