Bluetooth: Handle BR/EDR devices during suspend
To handle BR/EDR devices, we first disable page scan and disconnect all connected devices. Once that is complete, we add event filters (for devices that can wake the system) and re-enable page scan. Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
9952d90ea2
commit
4f40afc6c7
5 changed files with 169 additions and 10 deletions
|
|
@ -942,10 +942,14 @@ struct hci_cp_sniff_subrate {
|
|||
#define HCI_OP_RESET 0x0c03
|
||||
|
||||
#define HCI_OP_SET_EVENT_FLT 0x0c05
|
||||
struct hci_cp_set_event_flt {
|
||||
__u8 flt_type;
|
||||
__u8 cond_type;
|
||||
__u8 condition[];
|
||||
#define HCI_SET_EVENT_FLT_SIZE 9
|
||||
struct hci_cp_set_event_filter {
|
||||
__u8 flt_type;
|
||||
__u8 cond_type;
|
||||
struct {
|
||||
bdaddr_t bdaddr;
|
||||
__u8 auto_accept;
|
||||
} __packed addr_conn_flt;
|
||||
} __packed;
|
||||
|
||||
/* Filter types */
|
||||
|
|
@ -959,8 +963,9 @@ struct hci_cp_set_event_flt {
|
|||
#define HCI_CONN_SETUP_ALLOW_BDADDR 0x02
|
||||
|
||||
/* CONN_SETUP Conditions */
|
||||
#define HCI_CONN_SETUP_AUTO_OFF 0x01
|
||||
#define HCI_CONN_SETUP_AUTO_ON 0x02
|
||||
#define HCI_CONN_SETUP_AUTO_OFF 0x01
|
||||
#define HCI_CONN_SETUP_AUTO_ON 0x02
|
||||
#define HCI_CONN_SETUP_AUTO_ON_WITH_RS 0x03
|
||||
|
||||
#define HCI_OP_READ_STORED_LINK_KEY 0x0c0d
|
||||
struct hci_cp_read_stored_link_key {
|
||||
|
|
|
|||
|
|
@ -91,6 +91,10 @@ struct discovery_state {
|
|||
#define SUSPEND_NOTIFIER_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
|
||||
|
||||
enum suspend_tasks {
|
||||
SUSPEND_SCAN_DISABLE,
|
||||
SUSPEND_SCAN_ENABLE,
|
||||
SUSPEND_DISCONNECTING,
|
||||
|
||||
SUSPEND_POWERING_DOWN,
|
||||
|
||||
SUSPEND_PREPARE_NOTIFIER,
|
||||
|
|
@ -99,7 +103,8 @@ enum suspend_tasks {
|
|||
|
||||
enum suspended_state {
|
||||
BT_RUNNING = 0,
|
||||
BT_SUSPENDED,
|
||||
BT_SUSPEND_DISCONNECT,
|
||||
BT_SUSPEND_COMPLETE,
|
||||
};
|
||||
|
||||
struct hci_conn_hash {
|
||||
|
|
@ -409,6 +414,8 @@ struct hci_dev {
|
|||
struct work_struct suspend_prepare;
|
||||
enum suspended_state suspend_state_next;
|
||||
enum suspended_state suspend_state;
|
||||
bool scanning_paused;
|
||||
bool suspended;
|
||||
|
||||
wait_queue_head_t suspend_wait_q;
|
||||
DECLARE_BITMAP(suspend_tasks, __SUSPEND_NUM_TASKS);
|
||||
|
|
@ -418,6 +425,7 @@ struct hci_dev {
|
|||
struct list_head mgmt_pending;
|
||||
struct list_head blacklist;
|
||||
struct list_head whitelist;
|
||||
struct list_head wakeable;
|
||||
struct list_head uuids;
|
||||
struct list_head link_keys;
|
||||
struct list_head long_term_keys;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue