aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-02-19 22:52:13 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2014-02-20 01:28:04 -0500
commit7a4cd51dec96b42d899ed7b2207c9ef810534451 (patch)
tree53934edd8af19042e45321e4a78c260cfab063a7 /net/bluetooth/hci_core.c
parentb32bba6ced5696593a6bae5fdc69dc79c0a97ef5 (diff)
Bluetooth: Track the current configured random address
For Bluetooth controllers with LE support, track the value of the currently configured random address. It is important to know what the current random address is to avoid unneeded attempts to set a new address. This will become important when introducing the LE privacy support in the future. In addition expose the current configured random address via debugfs for debugging purposes. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index b25a36c3064b..877330b4876f 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -548,6 +548,29 @@ static int sniff_max_interval_get(void *data, u64 *val)
548DEFINE_SIMPLE_ATTRIBUTE(sniff_max_interval_fops, sniff_max_interval_get, 548DEFINE_SIMPLE_ATTRIBUTE(sniff_max_interval_fops, sniff_max_interval_get,
549 sniff_max_interval_set, "%llu\n"); 549 sniff_max_interval_set, "%llu\n");
550 550
551static int random_address_show(struct seq_file *f, void *p)
552{
553 struct hci_dev *hdev = f->private;
554
555 hci_dev_lock(hdev);
556 seq_printf(f, "%pMR\n", &hdev->random_addr);
557 hci_dev_unlock(hdev);
558
559 return 0;
560}
561
562static int random_address_open(struct inode *inode, struct file *file)
563{
564 return single_open(file, random_address_show, inode->i_private);
565}
566
567static const struct file_operations random_address_fops = {
568 .open = random_address_open,
569 .read = seq_read,
570 .llseek = seq_lseek,
571 .release = single_release,
572};
573
551static int static_address_show(struct seq_file *f, void *p) 574static int static_address_show(struct seq_file *f, void *p)
552{ 575{
553 struct hci_dev *hdev = f->private; 576 struct hci_dev *hdev = f->private;
@@ -1557,6 +1580,8 @@ static int __hci_init(struct hci_dev *hdev)
1557 } 1580 }
1558 1581
1559 if (lmp_le_capable(hdev)) { 1582 if (lmp_le_capable(hdev)) {
1583 debugfs_create_file("random_address", 0444, hdev->debugfs,
1584 hdev, &random_address_fops);
1560 debugfs_create_file("static_address", 0444, hdev->debugfs, 1585 debugfs_create_file("static_address", 0444, hdev->debugfs,
1561 hdev, &static_address_fops); 1586 hdev, &static_address_fops);
1562 1587
@@ -2205,6 +2230,7 @@ static int hci_dev_do_close(struct hci_dev *hdev)
2205 2230
2206 memset(hdev->eir, 0, sizeof(hdev->eir)); 2231 memset(hdev->eir, 0, sizeof(hdev->eir));
2207 memset(hdev->dev_class, 0, sizeof(hdev->dev_class)); 2232 memset(hdev->dev_class, 0, sizeof(hdev->dev_class));
2233 bacpy(&hdev->random_addr, BDADDR_ANY);
2208 2234
2209 hci_req_unlock(hdev); 2235 hci_req_unlock(hdev);
2210 2236