Re: [RFC PATCH v4 1/5] Bluetooth: Add mgmt op set_wake_capable

From: Marcel Holtmann
Date: Sun Mar 08 2020 - 04:28:52 EST


Hi Abhishek,

> When the system is suspended, only some connected Bluetooth devices
> cause user input that should wake the system (mostly HID devices). Add
> a list to keep track of devices that can wake the system and add
> a management API to let userspace tell the kernel whether a device is
> wake capable or not. For LE devices, the wakeable property is added to
> the connection parameter and can only be modified after calling
> add_device.
>
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@xxxxxxxxxxxx>
> ---
>
> Changes in v4: None
> Changes in v3:
> * Added wakeable property to le_conn_param
> * Use wakeable list for BR/EDR and wakeable property for LE
>
> Changes in v2: None
>
> include/net/bluetooth/hci_core.h | 2 ++
> include/net/bluetooth/mgmt.h | 7 +++++
> net/bluetooth/hci_core.c | 1 +
> net/bluetooth/mgmt.c | 51 ++++++++++++++++++++++++++++++++
> 4 files changed, 61 insertions(+)
>
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index dcc0dc6e2624..9d9ada5bc9d4 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -394,6 +394,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;
> @@ -575,6 +576,7 @@ struct hci_conn_params {
>
> struct hci_conn *conn;
> bool explicit_connect;
> + bool wakeable;
> };

I do not want to commit to the mgmt API just yet. So I would prefer that the two changes above go into the respective BR/EDR and LE patches to enable this feature. And that the mgmt command comes last in this series. Then I can start applying the initial patches and we just have to discuss on how we want to expose this for blueoothd to use.

Regards

Marcel