From: Szymon Janc <szymon.janc@tieto.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Szymon Janc <szymon.janc@gmail.com>
Subject: [PATCH 5/5] android: Use adapter index in mgmt functions
Date: Thu, 24 Oct 2013 10:36:53 +0200 [thread overview]
Message-ID: <1382603813-9157-5-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1382603813-9157-1-git-send-email-szymon.janc@tieto.com>
From: Szymon Janc <szymon.janc@gmail.com>
Instead of hardcoding index 0 use real index of adapter. This fix
using invalid index if adapter ID happens to be different than 0.
This should not happen on Android but is possible while testing on
Linux PC.
---
android/adapter.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/android/adapter.c b/android/adapter.c
index 0305ccb..532f964 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -170,14 +170,16 @@ static void mgmt_dev_class_changed_event(uint16_t index, uint16_t length,
static void register_mgmt_handlers(void)
{
- mgmt_register(adapter->mgmt, MGMT_EV_NEW_SETTINGS, 0,
+ mgmt_register(adapter->mgmt, MGMT_EV_NEW_SETTINGS, adapter->index,
new_settings_callback, NULL, NULL);
mgmt_register(adapter->mgmt, MGMT_EV_CLASS_OF_DEV_CHANGED,
- 0, mgmt_dev_class_changed_event, NULL, NULL);
+ adapter->index, mgmt_dev_class_changed_event,
+ NULL, NULL);
mgmt_register(adapter->mgmt, MGMT_EV_LOCAL_NAME_CHANGED,
- 0, mgmt_local_name_changed_event, NULL, NULL);
+ adapter->index, mgmt_local_name_changed_event,
+ NULL, NULL);
}
static void load_link_keys_complete(uint8_t status, uint16_t length,
@@ -216,7 +218,7 @@ static void load_link_keys(GSList *keys)
cp->debug_keys = 0;
cp->key_count = htobs(key_len);
- mgmt_send(adapter->mgmt, MGMT_OP_LOAD_LINK_KEYS, 0, len,
+ mgmt_send(adapter->mgmt, MGMT_OP_LOAD_LINK_KEYS, adapter->index, len,
cp, load_link_keys_complete, NULL, NULL);
g_free(cp);
--
1.8.4
prev parent reply other threads:[~2013-10-24 8:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-24 8:36 [PATCH 1/5] android: Start command watch after notify channel is connected Szymon Janc
2013-10-24 8:36 ` [PATCH 2/5] android: Fix bt_adapter_init Szymon Janc
2013-10-24 8:36 ` [PATCH 3/5] android: Remove not needed adapter parameter from bt_adapter_ready Szymon Janc
2013-10-24 8:36 ` [PATCH 4/5] android: Use default adapter in adapter functions Szymon Janc
2013-10-24 8:36 ` Szymon Janc [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=1382603813-9157-5-git-send-email-szymon.janc@tieto.com \
--to=szymon.janc@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=szymon.janc@gmail.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