aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-02-20 14:55:56 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2014-02-20 23:20:59 -0500
commit3f959d46a60c20eedf6f228e49d820c5922ec68f (patch)
treeb1e45960308ee0ea484c518acf1056f3a6d0bd89 /net
parentb1765e7afe8710ef4366dc722cc5bd487eb07973 (diff)
Bluetooth: Provide option for changing LE advertising channel map
For testing purposes it is useful to provide an option to change the advertising channel map. So add a debugfs option to allow this. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_core.c31
-rw-r--r--net/bluetooth/mgmt.c2
2 files changed, 32 insertions, 1 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 877330b4876f..67192867c998 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -757,6 +757,34 @@ static int conn_max_interval_get(void *data, u64 *val)
757DEFINE_SIMPLE_ATTRIBUTE(conn_max_interval_fops, conn_max_interval_get, 757DEFINE_SIMPLE_ATTRIBUTE(conn_max_interval_fops, conn_max_interval_get,
758 conn_max_interval_set, "%llu\n"); 758 conn_max_interval_set, "%llu\n");
759 759
760static int adv_channel_map_set(void *data, u64 val)
761{
762 struct hci_dev *hdev = data;
763
764 if (val < 0x01 || val > 0x07)
765 return -EINVAL;
766
767 hci_dev_lock(hdev);
768 hdev->le_adv_channel_map = val;
769 hci_dev_unlock(hdev);
770
771 return 0;
772}
773
774static int adv_channel_map_get(void *data, u64 *val)
775{
776 struct hci_dev *hdev = data;
777
778 hci_dev_lock(hdev);
779 *val = hdev->le_adv_channel_map;
780 hci_dev_unlock(hdev);
781
782 return 0;
783}
784
785DEFINE_SIMPLE_ATTRIBUTE(adv_channel_map_fops, adv_channel_map_get,
786 adv_channel_map_set, "%llu\n");
787
760static ssize_t lowpan_read(struct file *file, char __user *user_buf, 788static ssize_t lowpan_read(struct file *file, char __user *user_buf,
761 size_t count, loff_t *ppos) 789 size_t count, loff_t *ppos)
762{ 790{
@@ -1605,6 +1633,8 @@ static int __hci_init(struct hci_dev *hdev)
1605 hdev, &conn_min_interval_fops); 1633 hdev, &conn_min_interval_fops);
1606 debugfs_create_file("conn_max_interval", 0644, hdev->debugfs, 1634 debugfs_create_file("conn_max_interval", 0644, hdev->debugfs,
1607 hdev, &conn_max_interval_fops); 1635 hdev, &conn_max_interval_fops);
1636 debugfs_create_file("adv_channel_map", 0644, hdev->debugfs,
1637 hdev, &adv_channel_map_fops);
1608 debugfs_create_file("6lowpan", 0644, hdev->debugfs, hdev, 1638 debugfs_create_file("6lowpan", 0644, hdev->debugfs, hdev,
1609 &lowpan_debugfs_fops); 1639 &lowpan_debugfs_fops);
1610 } 1640 }
@@ -3264,6 +3294,7 @@ struct hci_dev *hci_alloc_dev(void)
3264 hdev->sniff_max_interval = 800; 3294 hdev->sniff_max_interval = 800;
3265 hdev->sniff_min_interval = 80; 3295 hdev->sniff_min_interval = 80;
3266 3296
3297 hdev->le_adv_channel_map = 0x07;
3267 hdev->le_scan_interval = 0x0060; 3298 hdev->le_scan_interval = 0x0060;
3268 hdev->le_scan_window = 0x0030; 3299 hdev->le_scan_window = 0x0030;
3269 hdev->le_conn_min_interval = 0x0028; 3300 hdev->le_conn_min_interval = 0x0028;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 5f5e388716ec..12fa6399c796 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1374,7 +1374,7 @@ static void enable_advertising(struct hci_request *req)
1374 cp.max_interval = __constant_cpu_to_le16(0x0800); 1374 cp.max_interval = __constant_cpu_to_le16(0x0800);
1375 cp.type = get_adv_type(hdev); 1375 cp.type = get_adv_type(hdev);
1376 cp.own_address_type = hdev->own_addr_type; 1376 cp.own_address_type = hdev->own_addr_type;
1377 cp.channel_map = 0x07; 1377 cp.channel_map = hdev->le_adv_channel_map;
1378 1378
1379 hci_req_add(req, HCI_OP_LE_SET_ADV_PARAM, sizeof(cp), &cp); 1379 hci_req_add(req, HCI_OP_LE_SET_ADV_PARAM, sizeof(cp), &cp);
1380 1380