From: tedd.an@linux.intel.com
To: linux-bluetooth@vger.kernel.org
Cc: Tedd Ho-Jeong An <tedd.an@intel.com>
Subject: [PATCH 3/3] btpclient: Fix gap reset not sending response
Date: Thu, 6 Aug 2020 18:17:03 -0700 [thread overview]
Message-ID: <20200807011703.22087-3-tedd.an@linux.intel.com> (raw)
In-Reply-To: <20200807011703.22087-1-tedd.an@linux.intel.com>
From: Tedd Ho-Jeong An <tedd.an@intel.com>
This patch fixes the GAP reset command to response the default settings
after resetting the stack.
---
tools/btpclient.c | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/tools/btpclient.c b/tools/btpclient.c
index f9c693056..38e326670 100644
--- a/tools/btpclient.c
+++ b/tools/btpclient.c
@@ -521,6 +521,19 @@ static void reset_unreg_agent_reply(struct l_dbus_proxy *proxy,
ag.registered = false;
}
+static void update_current_settings(struct btp_adapter *adapter,
+ uint32_t new_settings)
+{
+ struct btp_new_settings_ev ev;
+
+ adapter->current_settings = new_settings;
+
+ ev.current_settings = L_CPU_TO_LE32(adapter->current_settings);
+
+ btp_send(btp, BTP_GAP_SERVICE, BTP_EV_GAP_NEW_SETTINGS, adapter->index,
+ sizeof(ev), &ev);
+}
+
static void btp_gap_reset(uint8_t index, const void *param, uint16_t length,
void *user_data)
{
@@ -528,6 +541,7 @@ static void btp_gap_reset(uint8_t index, const void *param, uint16_t length,
const struct l_queue_entry *entry;
uint8_t status;
bool prop;
+ uint32_t default_settings;
if (!adapter) {
status = BTP_ERROR_INVALID_INDEX;
@@ -570,10 +584,13 @@ static void btp_gap_reset(uint8_t index, const void *param, uint16_t length,
goto failed;
}
- adapter->current_settings = adapter->default_settings;
+ default_settings = adapter->default_settings;
+
+ update_current_settings(adapter, default_settings);
/* TODO for we assume all went well */
- btp_send(btp, BTP_GAP_SERVICE, BTP_OP_GAP_RESET, index, 0, NULL);
+ btp_send(btp, BTP_GAP_SERVICE, BTP_OP_GAP_RESET, index,
+ sizeof(default_settings), &default_settings);
return;
failed:
@@ -644,19 +661,6 @@ failed:
btp_send_error(btp, BTP_GAP_SERVICE, index, status);
}
-static void update_current_settings(struct btp_adapter *adapter,
- uint32_t new_settings)
-{
- struct btp_new_settings_ev ev;
-
- adapter->current_settings = new_settings;
-
- ev.current_settings = L_CPU_TO_LE32(adapter->current_settings);
-
- btp_send(btp, BTP_GAP_SERVICE, BTP_EV_GAP_NEW_SETTINGS, adapter->index,
- sizeof(ev), &ev);
-}
-
static void btp_gap_set_connectable(uint8_t index, const void *param,
uint16_t length, void *user_data)
{
--
2.25.4
prev parent reply other threads:[~2020-08-07 1:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-07 1:17 [PATCH 1/3] btp: Update connect event structure tedd.an
2020-08-07 1:17 ` [PATCH 2/3] tools/btpclientctl: Add btpclient test application tedd.an
2020-08-07 1:17 ` tedd.an [this message]
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=20200807011703.22087-3-tedd.an@linux.intel.com \
--to=tedd.an@linux.intel.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=tedd.an@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).