summaryrefslogtreecommitdiff
path: root/tools/btmgmt.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2020-04-02 13:45:41 +0200
committerMarcel Holtmann <marcel@holtmann.org>2020-04-02 13:45:41 +0200
commit35a22bb989aa0856332c07bea568d1b5679297d4 (patch)
tree53e805bbd468ad8433ea8bfdaeaa44048ee07735 /tools/btmgmt.c
parentde5aa22b1c7310515bdc8bde64343eea6a36d6c1 (diff)
downloadbluez-35a22bb989aa0856332c07bea568d1b5679297d4.tar.gz
tools: Fix command for reading extended controller information
Diffstat (limited to 'tools/btmgmt.c')
-rw-r--r--tools/btmgmt.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 5da70ea2c..e40dbd199 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -1401,7 +1401,7 @@ static void ext_index_rsp(uint8_t status, uint16_t len, const void *param,
void *user_data)
{
const struct mgmt_rp_read_ext_index_list *rp = param;
- uint16_t count, index_filter = PTR_TO_UINT(user_data);
+ uint16_t count;
unsigned int i;
if (status != 0) {
@@ -1430,9 +1430,6 @@ static void ext_index_rsp(uint8_t status, uint16_t len, const void *param,
uint16_t index = le16_to_cpu(rp->entry[i].index);
char *busstr = hci_bustostr(rp->entry[i].bus);
- if (index_filter != MGMT_INDEX_NONE && index_filter != index)
- continue;
-
switch (rp->entry[i].type) {
case 0x00:
print("Primary controller (hci%u,%s)", index, busstr);
@@ -1471,13 +1468,23 @@ static void ext_index_rsp(uint8_t status, uint16_t len, const void *param,
bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
-static void cmd_extinfo(
- int argc, char **argv)
+static void cmd_extinfo(int argc, char **argv)
{
- if (!mgmt_send(mgmt, MGMT_OP_READ_EXT_INDEX_LIST,
- MGMT_INDEX_NONE, 0, NULL,
- ext_index_rsp, UINT_TO_PTR(index), NULL)) {
- error("Unable to send ext_index_list cmd");
+ if (mgmt_index == MGMT_INDEX_NONE) {
+ if (!mgmt_send(mgmt, MGMT_OP_READ_EXT_INDEX_LIST,
+ MGMT_INDEX_NONE, 0, NULL,
+ ext_index_rsp, mgmt, NULL)) {
+ error("Unable to send ext_index_list cmd");
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+ }
+
+ return;
+ }
+
+ if (!mgmt_send(mgmt, MGMT_OP_READ_EXT_INFO, mgmt_index, 0, NULL,
+ ext_info_rsp,
+ UINT_TO_PTR(mgmt_index), NULL)) {
+ error("Unable to send ext_read_info cmd");
return bt_shell_noninteractive_quit(EXIT_FAILURE);
}
}