From 07b028e5f210a857e43e7025bd60b79b1052d1ff Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 14 Mar 2015 16:53:22 -0700 Subject: [PATCH] tools: Handle controller bus information from extended index events --- tools/btmgmt.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tools/btmgmt.c b/tools/btmgmt.c index c9d733fc8..a4d5088f7 100644 --- a/tools/btmgmt.c +++ b/tools/btmgmt.c @@ -239,6 +239,22 @@ static void unconf_index_removed(uint16_t index, uint16_t len, print("hci%u removed (unconfigured)", index); } +static void ext_index_added(uint16_t index, uint16_t len, + const void *param, void *user_data) +{ + const struct mgmt_ev_ext_index_added *ev = param; + + print("hci%u added (type %u bus %u)", index, ev->type, ev->bus); +} + +static void ext_index_removed(uint16_t index, uint16_t len, + const void *param, void *user_data) +{ + const struct mgmt_ev_ext_index_removed *ev = param; + + print("hci%u removed (type %u bus %u)", index, ev->type, ev->bus); +} + static const char *options_str[] = { "external", "public-address", @@ -1370,10 +1386,12 @@ static void ext_index_rsp(uint8_t status, uint16_t len, const void *param, pending_index++; break; case 0x02: - print("hci%u:\tAMP controller", index); + print("hci%u:\tAMP controller (%u)", index, + rp->entry[i].bus); break; default: - print("hci%u:\t0x%02x", index, rp->entry[i].type); + print("hci%u:\tType %u controller (%u)", index, + rp->entry[i].type, rp->entry[i].bus); break; } } @@ -3530,7 +3548,10 @@ static void register_mgmt_callbacks(struct mgmt *mgmt, uint16_t index) unconf_index_removed, NULL, NULL); mgmt_register(mgmt, MGMT_EV_NEW_CONFIG_OPTIONS, index, new_config_options, NULL, NULL); - + mgmt_register(mgmt, MGMT_EV_EXT_INDEX_ADDED, index, + ext_index_added, NULL, NULL); + mgmt_register(mgmt, MGMT_EV_EXT_INDEX_REMOVED, index, + ext_index_removed, NULL, NULL); } static void cmd_select(struct mgmt *mgmt, uint16_t index, -- 2.47.3