mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
Bluetooth: mgmt: Add idle_timeout to configurable system parameters
While the configurable system parameters allow controlling the SNIFF mode parameters, they do not include the idle_timeout parameter responsible for enabling SNIFF mode. Add the idle_timeout parameter to allow controlling the idle timeout of BR/EDR connections. Signed-off-by: Stefan Sørensen <ssorensen@roku.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
committed by
Luiz Augusto von Dentz
parent
4bb091013a
commit
48fea7d4b3
@@ -11,6 +11,12 @@
|
||||
#include "mgmt_util.h"
|
||||
#include "mgmt_config.h"
|
||||
|
||||
#define HDEV_PARAM_U32(_param_name_) \
|
||||
struct {\
|
||||
struct mgmt_tlv_hdr entry; \
|
||||
__le32 value; \
|
||||
} __packed _param_name_
|
||||
|
||||
#define HDEV_PARAM_U16(_param_name_) \
|
||||
struct {\
|
||||
struct mgmt_tlv_hdr entry; \
|
||||
@@ -29,6 +35,12 @@
|
||||
cpu_to_le16(hdev->_param_name_) \
|
||||
}
|
||||
|
||||
#define TLV_SET_U32(_param_code_, _param_name_) \
|
||||
{ \
|
||||
{ cpu_to_le16(_param_code_), sizeof(__u32) }, \
|
||||
cpu_to_le32(hdev->_param_name_) \
|
||||
}
|
||||
|
||||
#define TLV_SET_U8(_param_code_, _param_name_) \
|
||||
{ \
|
||||
{ cpu_to_le16(_param_code_), sizeof(__u8) }, \
|
||||
@@ -78,6 +90,7 @@ int read_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
HDEV_PARAM_U16(advmon_allowlist_duration);
|
||||
HDEV_PARAM_U16(advmon_no_filter_duration);
|
||||
HDEV_PARAM_U8(enable_advmon_interleave_scan);
|
||||
HDEV_PARAM_U32(idle_timeout);
|
||||
} __packed rp = {
|
||||
TLV_SET_U16(0x0000, def_page_scan_type),
|
||||
TLV_SET_U16(0x0001, def_page_scan_int),
|
||||
@@ -111,6 +124,7 @@ int read_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
TLV_SET_U16(0x001d, advmon_allowlist_duration),
|
||||
TLV_SET_U16(0x001e, advmon_no_filter_duration),
|
||||
TLV_SET_U8(0x001f, enable_advmon_interleave_scan),
|
||||
TLV_SET_U32(0x0020, idle_timeout),
|
||||
};
|
||||
|
||||
bt_dev_dbg(hdev, "sock %p", sk);
|
||||
@@ -122,6 +136,7 @@ int read_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
}
|
||||
|
||||
#define TO_TLV(x) ((struct mgmt_tlv *)(x))
|
||||
#define TLV_GET_LE32(tlv) le32_to_cpu(*((__le32 *)(TO_TLV(tlv)->value)))
|
||||
#define TLV_GET_LE16(tlv) le16_to_cpu(*((__le16 *)(TO_TLV(tlv)->value)))
|
||||
#define TLV_GET_U8(tlv) (*((__u8 *)(TO_TLV(tlv)->value)))
|
||||
|
||||
@@ -191,6 +206,9 @@ int set_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
case 0x001f:
|
||||
exp_type_len = sizeof(u8);
|
||||
break;
|
||||
case 0x0020:
|
||||
exp_type_len = sizeof(u32);
|
||||
break;
|
||||
default:
|
||||
exp_type_len = 0;
|
||||
bt_dev_warn(hdev, "unsupported parameter %u", type);
|
||||
@@ -314,6 +332,9 @@ int set_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
case 0x0001f:
|
||||
hdev->enable_advmon_interleave_scan = TLV_GET_U8(buffer);
|
||||
break;
|
||||
case 0x00020:
|
||||
hdev->idle_timeout = TLV_GET_LE32(buffer);
|
||||
break;
|
||||
default:
|
||||
bt_dev_warn(hdev, "unsupported parameter %u", type);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user