Bluetooth: Provide defaults for LE advertising interval
authorGeorg Lukas <georg@op-co.de>
Sat, 26 Jul 2014 11:59:57 +0000 (13:59 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 26 Jul 2014 17:05:09 +0000 (19:05 +0200)
Store the default values for minimum and maximum advertising interval
with all the other controller defaults. These vaules are sent to the
adapter whenever advertising is (re)enabled.

Signed-off-by: Georg Lukas <georg@op-co.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_core.c
net/bluetooth/mgmt.c

index 747a0c3d9947a986891cbddbe8ce2d88e7881e95..b5d5af3aa469961af36b30b0aea2da1d4e959bac 100644 (file)
@@ -203,6 +203,8 @@ struct hci_dev {
        __u16           page_scan_window;
        __u8            page_scan_type;
        __u8            le_adv_channel_map;
+       __u16           le_adv_min_interval;
+       __u16           le_adv_max_interval;
        __u8            le_scan_type;
        __u16           le_scan_interval;
        __u16           le_scan_window;
index 2e2961a3cf6ff27e0c0c959749054fe6761ea9cf..475d6003ed15fba621bfbbc449ac4bddda00b394 100644 (file)
@@ -3923,6 +3923,8 @@ struct hci_dev *hci_alloc_dev(void)
        hdev->sniff_min_interval = 80;
 
        hdev->le_adv_channel_map = 0x07;
+       hdev->le_adv_min_interval = 0x0800;
+       hdev->le_adv_max_interval = 0x0800;
        hdev->le_scan_interval = 0x0060;
        hdev->le_scan_window = 0x0030;
        hdev->le_conn_min_interval = 0x0028;
index ccc4653ce658f34a5acf189fa1a99718f574efa5..ff874580d989410b7eac9254dcfcbf6ba1e7a570 100644 (file)
@@ -1086,8 +1086,8 @@ static void enable_advertising(struct hci_request *req)
                return;
 
        memset(&cp, 0, sizeof(cp));
-       cp.min_interval = cpu_to_le16(0x0800);
-       cp.max_interval = cpu_to_le16(0x0800);
+       cp.min_interval = cpu_to_le16(hdev->le_adv_min_interval);
+       cp.max_interval = cpu_to_le16(hdev->le_adv_max_interval);
        cp.type = connectable ? LE_ADV_IND : LE_ADV_NONCONN_IND;
        cp.own_address_type = own_addr_type;
        cp.channel_map = hdev->le_adv_channel_map;