diff options
author | Andre Guedes <andre.guedes@openbossa.org> | 2012-02-03 15:48:00 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-13 10:01:34 -0500 |
commit | 28b75a89480df99a17c8facd5c33985847d06bb6 (patch) | |
tree | ddb050dd79624ed01e12d1d072f8be646a15815f /include/net/bluetooth/hci_core.h | |
parent | 7ba8b4be38e7c83b2b13333a82a0ecde921a7390 (diff) |
Bluetooth: Add hci_le_scan()
We are not supposed to block in start_discovery() because
start_discovery code is running in write() syscall context
and this would block the write operation on the mgmt socket.
This way, we cannot directly call hci_do_le_scan() to scan
LE devices in start_discovery(). To overcome this issue a
derefered work (hdev->le_scan) was created so we can properly
call hci_do_le_scan().
The helper function hci_le_scan() simply set LE scan parameters
and queue hdev->le_scan work. The work is queued on system_long_wq
since it can sleep for a few seconds in the worst case (timeout).
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'include/net/bluetooth/hci_core.h')
-rw-r--r-- | include/net/bluetooth/hci_core.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 3e70872bffea..7107790817a5 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -126,6 +126,7 @@ struct le_scan_params { | |||
126 | u8 type; | 126 | u8 type; |
127 | u16 interval; | 127 | u16 interval; |
128 | u16 window; | 128 | u16 window; |
129 | int timeout; | ||
129 | }; | 130 | }; |
130 | 131 | ||
131 | #define NUM_REASSEMBLY 4 | 132 | #define NUM_REASSEMBLY 4 |
@@ -269,6 +270,9 @@ struct hci_dev { | |||
269 | 270 | ||
270 | struct delayed_work le_scan_disable; | 271 | struct delayed_work le_scan_disable; |
271 | 272 | ||
273 | struct work_struct le_scan; | ||
274 | struct le_scan_params le_scan_params; | ||
275 | |||
272 | int (*open)(struct hci_dev *hdev); | 276 | int (*open)(struct hci_dev *hdev); |
273 | int (*close)(struct hci_dev *hdev); | 277 | int (*close)(struct hci_dev *hdev); |
274 | int (*flush)(struct hci_dev *hdev); | 278 | int (*flush)(struct hci_dev *hdev); |
@@ -1033,5 +1037,7 @@ void hci_le_ltk_neg_reply(struct hci_conn *conn); | |||
1033 | 1037 | ||
1034 | int hci_do_inquiry(struct hci_dev *hdev, u8 length); | 1038 | int hci_do_inquiry(struct hci_dev *hdev, u8 length); |
1035 | int hci_cancel_inquiry(struct hci_dev *hdev); | 1039 | int hci_cancel_inquiry(struct hci_dev *hdev); |
1040 | int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window, | ||
1041 | int timeout); | ||
1036 | 1042 | ||
1037 | #endif /* __HCI_CORE_H */ | 1043 | #endif /* __HCI_CORE_H */ |