Skip to content

Commit 7c2cc5b

Browse files
committed
Bluetooth: Add proper definitions for scan interval and window
This adds proper definitions for scan interval and window and then make use of them instead their values. Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 2efbac8 commit 7c2cc5b

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

include/net/bluetooth/hci_core.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,8 +2235,22 @@ void hci_mgmt_chan_unregister(struct hci_mgmt_chan *c);
22352235
/* These LE scan and inquiry parameters were chosen according to LE General
22362236
* Discovery Procedure specification.
22372237
*/
2238-
#define DISCOV_LE_SCAN_WIN 0x12
2239-
#define DISCOV_LE_SCAN_INT 0x12
2238+
#define DISCOV_LE_SCAN_WIN 0x0012 /* 11.25 msec */
2239+
#define DISCOV_LE_SCAN_INT 0x0012 /* 11.25 msec */
2240+
#define DISCOV_LE_SCAN_INT_FAST 0x0060 /* 60 msec */
2241+
#define DISCOV_LE_SCAN_WIN_FAST 0x0030 /* 30 msec */
2242+
#define DISCOV_LE_SCAN_INT_CONN 0x0060 /* 60 msec */
2243+
#define DISCOV_LE_SCAN_WIN_CONN 0x0060 /* 60 msec */
2244+
#define DISCOV_LE_SCAN_INT_SLOW1 0x0800 /* 1.28 sec */
2245+
#define DISCOV_LE_SCAN_WIN_SLOW1 0x0012 /* 11.25 msec */
2246+
#define DISCOV_LE_SCAN_INT_SLOW2 0x1000 /* 2.56 sec */
2247+
#define DISCOV_LE_SCAN_WIN_SLOW2 0x0024 /* 22.5 msec */
2248+
#define DISCOV_CODED_SCAN_INT_FAST 0x0120 /* 180 msec */
2249+
#define DISCOV_CODED_SCAN_WIN_FAST 0x0090 /* 90 msec */
2250+
#define DISCOV_CODED_SCAN_INT_SLOW1 0x1800 /* 3.84 sec */
2251+
#define DISCOV_CODED_SCAN_WIN_SLOW1 0x0036 /* 33.75 msec */
2252+
#define DISCOV_CODED_SCAN_INT_SLOW2 0x3000 /* 7.68 sec */
2253+
#define DISCOV_CODED_SCAN_WIN_SLOW2 0x006c /* 67.5 msec */
22402254
#define DISCOV_LE_TIMEOUT 10240 /* msec */
22412255
#define DISCOV_INTERLEAVED_TIMEOUT 5120 /* msec */
22422256
#define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04

net/bluetooth/hci_core.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2523,16 +2523,16 @@ struct hci_dev *hci_alloc_dev_priv(int sizeof_priv)
25232523
hdev->le_adv_channel_map = 0x07;
25242524
hdev->le_adv_min_interval = 0x0800;
25252525
hdev->le_adv_max_interval = 0x0800;
2526-
hdev->le_scan_interval = 0x0060;
2527-
hdev->le_scan_window = 0x0030;
2528-
hdev->le_scan_int_suspend = 0x0400;
2529-
hdev->le_scan_window_suspend = 0x0012;
2526+
hdev->le_scan_interval = DISCOV_LE_SCAN_INT_FAST;
2527+
hdev->le_scan_window = DISCOV_LE_SCAN_WIN_FAST;
2528+
hdev->le_scan_int_suspend = DISCOV_LE_SCAN_INT_SLOW1;
2529+
hdev->le_scan_window_suspend = DISCOV_LE_SCAN_WIN_SLOW1;
25302530
hdev->le_scan_int_discovery = DISCOV_LE_SCAN_INT;
25312531
hdev->le_scan_window_discovery = DISCOV_LE_SCAN_WIN;
2532-
hdev->le_scan_int_adv_monitor = 0x0060;
2533-
hdev->le_scan_window_adv_monitor = 0x0030;
2534-
hdev->le_scan_int_connect = 0x0060;
2535-
hdev->le_scan_window_connect = 0x0060;
2532+
hdev->le_scan_int_adv_monitor = DISCOV_LE_SCAN_INT_FAST;
2533+
hdev->le_scan_window_adv_monitor = DISCOV_LE_SCAN_WIN_FAST;
2534+
hdev->le_scan_int_connect = DISCOV_LE_SCAN_INT_CONN;
2535+
hdev->le_scan_window_connect = DISCOV_LE_SCAN_WIN_CONN;
25362536
hdev->le_conn_min_interval = 0x0018;
25372537
hdev->le_conn_max_interval = 0x0028;
25382538
hdev->le_conn_latency = 0x0000;

0 commit comments

Comments
 (0)