Bluetooth: Print full controller info upon init

Provide more detailed information about the controller address and
version upon init when debug is enabled.

Change-Id: I5fe9c7c91f95928cb3cc64b801137bb1466e4115
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2016-11-04 15:10:34 +02:00
commit f26007d212
2 changed files with 39 additions and 2 deletions

View file

@ -2786,6 +2786,8 @@ static void read_local_ver_complete(struct net_buf *buf)
bt_dev.hci_version = rp->hci_version;
bt_dev.hci_revision = sys_le16_to_cpu(rp->hci_revision);
bt_dev.lmp_version = rp->lmp_version;
bt_dev.lmp_subversion = sys_le16_to_cpu(rp->lmp_subversion);
bt_dev.manufacturer = sys_le16_to_cpu(rp->manufacturer);
}
@ -3354,6 +3356,40 @@ set_addr:
return 0;
}
#if defined(CONFIG_BLUETOOTH_DEBUG)
static const char *ver_str(uint8_t ver)
{
const char * const str[] = {
"1.0b", "1.1", "1.2", "2.0", "2.1", "3.0", "4.0", "4.1", "4.2",
};
if (ver < ARRAY_SIZE(str)) {
return str[ver];
}
return "unknown";
}
static void show_dev_info(void)
{
char addr[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(&bt_dev.id_addr, addr, sizeof(addr));
BT_INFO("Identity: %s", addr);
BT_INFO("HCI: version %s (0x%02x) revision 0x%04x, manufacturer 0x%04x",
ver_str(bt_dev.hci_version), bt_dev.hci_version,
bt_dev.hci_revision, bt_dev.manufacturer);
BT_INFO("LMP: version %s (0x%02x) subver 0x%04x",
ver_str(bt_dev.lmp_version), bt_dev.lmp_version,
bt_dev.lmp_subversion);
}
#else
static inline void show_dev_info(void)
{
}
#endif /* CONFIG_BLUETOOTH_DEBUG */
static int hci_init(void)
{
int err;
@ -3396,8 +3432,7 @@ static int hci_init(void)
}
}
BT_DBG("HCI ver %u rev %u, manufacturer %u", bt_dev.hci_version,
bt_dev.hci_revision, bt_dev.manufacturer);
show_dev_info();
return 0;
}

View file

@ -81,7 +81,9 @@ struct bt_dev {
/* Controller version & manufacturer information */
uint8_t hci_version;
uint8_t lmp_version;
uint16_t hci_revision;
uint16_t lmp_subversion;
uint16_t manufacturer;
/* LMP features (pages 0, 1, 2) */