aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-02-23 15:44:25 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2014-02-24 01:26:02 -0500
commitac345813c4ac5a0e66261e9812f0fe94729c0eb2 (patch)
treeb1d7ffaf3134e93642eb0fd3bfcad3721cd03860 /net/bluetooth
parent7bf32048b1af87942d311ef1620995ffc89c07d8 (diff)
Bluetooth: Expose current identity information in debugfs
When using LE Privacy it is useful to know the local identity address, identity address type and identity resolving key. For debugging purposes add these information to debugfs. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_core.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 1651de959d9c..80462a126ebd 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -579,6 +579,42 @@ static int sniff_max_interval_get(void *data, u64 *val)
579DEFINE_SIMPLE_ATTRIBUTE(sniff_max_interval_fops, sniff_max_interval_get, 579DEFINE_SIMPLE_ATTRIBUTE(sniff_max_interval_fops, sniff_max_interval_get,
580 sniff_max_interval_set, "%llu\n"); 580 sniff_max_interval_set, "%llu\n");
581 581
582static int identity_show(struct seq_file *f, void *p)
583{
584 struct hci_dev *hdev = f->private;
585 bdaddr_t *addr;
586 u8 addr_type;
587
588 hci_dev_lock(hdev);
589
590 if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dev_flags) ||
591 !bacmp(&hdev->bdaddr, BDADDR_ANY)) {
592 addr = &hdev->static_addr;
593 addr_type = ADDR_LE_DEV_RANDOM;
594 } else {
595 addr = &hdev->bdaddr;
596 addr_type = ADDR_LE_DEV_PUBLIC;
597 }
598
599 seq_printf(f, "%pMR (type %u) %*phN\n", addr, addr_type, 16, hdev->irk);
600
601 hci_dev_unlock(hdev);
602
603 return 0;
604}
605
606static int identity_open(struct inode *inode, struct file *file)
607{
608 return single_open(file, identity_show, inode->i_private);
609}
610
611static const struct file_operations identity_fops = {
612 .open = identity_open,
613 .read = seq_read,
614 .llseek = seq_lseek,
615 .release = single_release,
616};
617
582static int random_address_show(struct seq_file *f, void *p) 618static int random_address_show(struct seq_file *f, void *p)
583{ 619{
584 struct hci_dev *hdev = f->private; 620 struct hci_dev *hdev = f->private;
@@ -1624,12 +1660,14 @@ static int __hci_init(struct hci_dev *hdev)
1624 } 1660 }
1625 1661
1626 if (lmp_le_capable(hdev)) { 1662 if (lmp_le_capable(hdev)) {
1663 debugfs_create_file("identity", 0400, hdev->debugfs,
1664 hdev, &identity_fops);
1665 debugfs_create_file("rpa_timeout", 0644, hdev->debugfs,
1666 hdev, &rpa_timeout_fops);
1627 debugfs_create_file("random_address", 0444, hdev->debugfs, 1667 debugfs_create_file("random_address", 0444, hdev->debugfs,
1628 hdev, &random_address_fops); 1668 hdev, &random_address_fops);
1629 debugfs_create_file("static_address", 0444, hdev->debugfs, 1669 debugfs_create_file("static_address", 0444, hdev->debugfs,
1630 hdev, &static_address_fops); 1670 hdev, &static_address_fops);
1631 debugfs_create_file("rpa_timeout", 0644, hdev->debugfs,
1632 hdev, &rpa_timeout_fops);
1633 1671
1634 /* For controllers with a public address, provide a debug 1672 /* For controllers with a public address, provide a debug
1635 * option to force the usage of the configured static 1673 * option to force the usage of the configured static