This adds the required read/set commands for runtime configuration. Even
while currently no parameters are specified, the commands are made
available.
Signed-off-by: Marcel Holtmann <[email protected]>
---
net/bluetooth/mgmt.c | 7 +++++++
net/bluetooth/mgmt_config.c | 18 ++++++++++++++++++
net/bluetooth/mgmt_config.h | 6 ++++++
3 files changed, 31 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 99fbfd467d04..ecfdfc4df486 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -114,6 +114,8 @@ static const u16 mgmt_commands[] = {
MGMT_OP_SET_EXP_FEATURE,
MGMT_OP_READ_DEF_SYSTEM_CONFIG,
MGMT_OP_SET_DEF_SYSTEM_CONFIG,
+ MGMT_OP_READ_DEF_RUNTIME_CONFIG,
+ MGMT_OP_SET_DEF_RUNTIME_CONFIG,
};
static const u16 mgmt_events[] = {
@@ -166,6 +168,7 @@ static const u16 mgmt_untrusted_commands[] = {
MGMT_OP_READ_SECURITY_INFO,
MGMT_OP_READ_EXP_FEATURES_INFO,
MGMT_OP_READ_DEF_SYSTEM_CONFIG,
+ MGMT_OP_READ_DEF_RUNTIME_CONFIG,
};
static const u16 mgmt_untrusted_events[] = {
@@ -7305,6 +7308,10 @@ static const struct hci_mgmt_handler mgmt_handlers[] = {
HCI_MGMT_UNTRUSTED },
{ set_def_system_config, MGMT_SET_DEF_SYSTEM_CONFIG_SIZE,
HCI_MGMT_VAR_LEN },
+ { read_def_runtime_config, MGMT_READ_DEF_RUNTIME_CONFIG_SIZE,
+ HCI_MGMT_UNTRUSTED },
+ { set_def_runtime_config, MGMT_SET_DEF_RUNTIME_CONFIG_SIZE,
+ HCI_MGMT_VAR_LEN },
};
void mgmt_index_added(struct hci_dev *hdev)
diff --git a/net/bluetooth/mgmt_config.c b/net/bluetooth/mgmt_config.c
index f6dfbe93542c..8e7ad2a51dbb 100644
--- a/net/bluetooth/mgmt_config.c
+++ b/net/bluetooth/mgmt_config.c
@@ -251,3 +251,21 @@ int set_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
MGMT_OP_SET_DEF_SYSTEM_CONFIG,
MGMT_STATUS_SUCCESS);
}
+
+int read_def_runtime_config(struct sock *sk, struct hci_dev *hdev, void *data,
+ u16 data_len)
+{
+ bt_dev_dbg(hdev, "sock %p", sk);
+
+ return mgmt_cmd_complete(sk, hdev->id,
+ MGMT_OP_READ_DEF_RUNTIME_CONFIG, 0, NULL, 0);
+}
+
+int set_def_runtime_config(struct sock *sk, struct hci_dev *hdev, void *data,
+ u16 data_len)
+{
+ bt_dev_dbg(hdev, "sock %p", sk);
+
+ return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEF_SYSTEM_CONFIG,
+ MGMT_STATUS_INVALID_PARAMS);
+}
diff --git a/net/bluetooth/mgmt_config.h b/net/bluetooth/mgmt_config.h
index 51da6e63b1a0..a4965f107891 100644
--- a/net/bluetooth/mgmt_config.h
+++ b/net/bluetooth/mgmt_config.h
@@ -9,3 +9,9 @@ int read_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
int set_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
u16 data_len);
+
+int read_def_runtime_config(struct sock *sk, struct hci_dev *hdev, void *data,
+ u16 data_len);
+
+int set_def_runtime_config(struct sock *sk, struct hci_dev *hdev, void *data,
+ u16 data_len);
--
2.26.2
Hi Marcel,
On Wed, Jun 17, 2020 at 6:42 AM Marcel Holtmann <[email protected]> wrote:
>
> This adds the required read/set commands for runtime configuration. Even
> while currently no parameters are specified, the commands are made
> available.
>
Reviewed-by: Alain Michaud <[email protected]>
> Signed-off-by: Marcel Holtmann <[email protected]>
> ---
> net/bluetooth/mgmt.c | 7 +++++++
> net/bluetooth/mgmt_config.c | 18 ++++++++++++++++++
> net/bluetooth/mgmt_config.h | 6 ++++++
> 3 files changed, 31 insertions(+)
>
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 99fbfd467d04..ecfdfc4df486 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -114,6 +114,8 @@ static const u16 mgmt_commands[] = {
> MGMT_OP_SET_EXP_FEATURE,
> MGMT_OP_READ_DEF_SYSTEM_CONFIG,
> MGMT_OP_SET_DEF_SYSTEM_CONFIG,
> + MGMT_OP_READ_DEF_RUNTIME_CONFIG,
> + MGMT_OP_SET_DEF_RUNTIME_CONFIG,
> };
>
> static const u16 mgmt_events[] = {
> @@ -166,6 +168,7 @@ static const u16 mgmt_untrusted_commands[] = {
> MGMT_OP_READ_SECURITY_INFO,
> MGMT_OP_READ_EXP_FEATURES_INFO,
> MGMT_OP_READ_DEF_SYSTEM_CONFIG,
> + MGMT_OP_READ_DEF_RUNTIME_CONFIG,
> };
>
> static const u16 mgmt_untrusted_events[] = {
> @@ -7305,6 +7308,10 @@ static const struct hci_mgmt_handler mgmt_handlers[] = {
> HCI_MGMT_UNTRUSTED },
> { set_def_system_config, MGMT_SET_DEF_SYSTEM_CONFIG_SIZE,
> HCI_MGMT_VAR_LEN },
> + { read_def_runtime_config, MGMT_READ_DEF_RUNTIME_CONFIG_SIZE,
> + HCI_MGMT_UNTRUSTED },
> + { set_def_runtime_config, MGMT_SET_DEF_RUNTIME_CONFIG_SIZE,
> + HCI_MGMT_VAR_LEN },
> };
>
> void mgmt_index_added(struct hci_dev *hdev)
> diff --git a/net/bluetooth/mgmt_config.c b/net/bluetooth/mgmt_config.c
> index f6dfbe93542c..8e7ad2a51dbb 100644
> --- a/net/bluetooth/mgmt_config.c
> +++ b/net/bluetooth/mgmt_config.c
> @@ -251,3 +251,21 @@ int set_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
> MGMT_OP_SET_DEF_SYSTEM_CONFIG,
> MGMT_STATUS_SUCCESS);
> }
> +
> +int read_def_runtime_config(struct sock *sk, struct hci_dev *hdev, void *data,
> + u16 data_len)
> +{
> + bt_dev_dbg(hdev, "sock %p", sk);
> +
> + return mgmt_cmd_complete(sk, hdev->id,
> + MGMT_OP_READ_DEF_RUNTIME_CONFIG, 0, NULL, 0);
> +}
> +
> +int set_def_runtime_config(struct sock *sk, struct hci_dev *hdev, void *data,
> + u16 data_len)
> +{
> + bt_dev_dbg(hdev, "sock %p", sk);
> +
> + return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEF_SYSTEM_CONFIG,
> + MGMT_STATUS_INVALID_PARAMS);
> +}
> diff --git a/net/bluetooth/mgmt_config.h b/net/bluetooth/mgmt_config.h
> index 51da6e63b1a0..a4965f107891 100644
> --- a/net/bluetooth/mgmt_config.h
> +++ b/net/bluetooth/mgmt_config.h
> @@ -9,3 +9,9 @@ int read_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
>
> int set_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
> u16 data_len);
> +
> +int read_def_runtime_config(struct sock *sk, struct hci_dev *hdev, void *data,
> + u16 data_len);
> +
> +int set_def_runtime_config(struct sock *sk, struct hci_dev *hdev, void *data,
> + u16 data_len);
> --
> 2.26.2
>