Bluetooth: Add framework for Extended Controller Information
Subsystems (2)
Marcel Holtmann
maintainerRFC 1/1 Bluetooth: Add framework for Extended Controller Information
--- include/net/bluetooth/hci.h | 1 + include/net/bluetooth/mgmt.h | 18 +++++++++++++ net/bluetooth/mgmt.c | 62 ++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 79 insertions(+), 2 deletions(-)
include/net/bluetooth/hci.h +1 -0
@@ -208,6 +208,7 @@ enum {HCI_MGMT_INDEX_EVENTS ,HCI_MGMT_UNCONF_INDEX_EVENTS ,HCI_MGMT_EXT_INDEX_EVENTS , +HCI_MGMT_EXT_INFO_EVENTS ,HCI_MGMT_OPTION_EVENTS ,HCI_MGMT_SETTING_EVENTS , HCI_MGMT_DEV_CLASS_EVENTS,
include/net/bluetooth/mgmt.h +18 -0
@@ -586,6 +586,18 @@ struct mgmt_rp_get_adv_size_info {#define MGMT_OP_START_LIMITED_DISCOVERY 0x0041 +#define MGMT_OP_READ_EXT_INFO 0x0042 +#define MGMT_READ_EXT_INFO_SIZE 0 +struct mgmt_rp_read_ext_info { +bdaddr_t bdaddr; +__u8 version; +__le16 manufacturer; +__le32 supported_settings; +__le32 current_settings; +__le16 eir_len; +__u8 eir[0 ]; +} __packed; +#define MGMT_EV_CMD_COMPLETE 0x0001struct mgmt_ev_cmd_complete {__le16 opcode;
@@ -800,3 +812,9 @@ struct mgmt_ev_advertising_added {struct mgmt_ev_advertising_removed {__u8 instance; } __packed; + +#define MGMT_EV_EXT_INFO_CHANGED 0x0025 +struct mgmt_ev_ext_info_changed { +__le16 eir_len; +__u8 eir[0 ]; +} __packed;
net/bluetooth/mgmt.c +60 -2
127 lines not on this page · raw message
Signature · 1 line
2.7.4
Marcel Holtmann
maintainerHi,
Quoted 102 lines
Signed-off-by Marcel Holtmann <[email protected]>---
include/net/bluetooth/hci.h | 1 + include/net/bluetooth/mgmt.h | 18 +++++++++++++ net/bluetooth/mgmt.c | 62 ++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 79 insertions(+), 2 deletions(-)include/net/bluetooth/hci.h +1
-0@@ -208,6 +208,7 @@ enum {HCI_MGMT_INDEX_EVENTS ,HCI_MGMT_UNCONF_INDEX_EVENTS ,HCI_MGMT_EXT_INDEX_EVENTS , +HCI_MGMT_EXT_INFO_EVENTS ,HCI_MGMT_OPTION_EVENTS ,HCI_MGMT_SETTING_EVENTS , HCI_MGMT_DEV_CLASS_EVENTS,include/net/bluetooth/mgmt.h +18
-0@@ -586,6 +586,18 @@ struct mgmt_rp_get_adv_size_info {#define MGMT_OP_START_LIMITED_DISCOVERY 0x0041 +#define MGMT_OP_READ_EXT_INFO 0x0042 +#define MGMT_READ_EXT_INFO_SIZE 0 +struct mgmt_rp_read_ext_info { +bdaddr_t bdaddr; +__u8 version; +__le16 manufacturer; +__le32 supported_settings; +__le32 current_settings; +__le16 eir_len; +__u8 eir[0 ]; +} __packed; +#define MGMT_EV_CMD_COMPLETE 0x0001struct mgmt_ev_cmd_complete {__le16 opcode;@@ -800,3 +812,9 @@ struct mgmt_ev_advertising_added {struct mgmt_ev_advertising_removed {__u8 instance; } __packed; + +#define MGMT_EV_EXT_INFO_CHANGED 0x0025 +struct mgmt_ev_ext_info_changed { +__le16 eir_len; +__u8 eir[0 ]; +} __packed;net/bluetooth/mgmt.c +14
-0@@ -104,6 +104,7 @@ static const u16 mgmt_commands[] = {MGMT_OP_REMOVE_ADVERTISING ,MGMT_OP_GET_ADV_SIZE_INFO ,MGMT_OP_START_LIMITED_DISCOVERY , + MGMT_OP_READ_EXT_INFO, }; static const u16 mgmt_events[] = {@@ -141,6 +142,7 @@ static const u16 mgmt_events[] = {MGMT_EV_LOCAL_OOB_DATA_UPDATED ,MGMT_EV_ADVERTISING_ADDED ,MGMT_EV_ADVERTISING_REMOVED , + MGMT_EV_EXT_INFO_CHANGED, }; static const u16 mgmt_untrusted_commands[] = {@@ -149,6 +151,7 @@ static const u16 mgmt_untrusted_commands[] = {MGMT_OP_READ_UNCONF_INDEX_LIST ,MGMT_OP_READ_CONFIG_INFO ,MGMT_OP_READ_EXT_INDEX_LIST , + MGMT_OP_READ_EXT_INFO, }; static const u16 mgmt_untrusted_events[] = {@@ -162,6 +165,7 @@ static const u16 mgmt_untrusted_events[] = {MGMT_EV_NEW_CONFIG_OPTIONS ,MGMT_EV_EXT_INDEX_ADDED ,MGMT_EV_EXT_INDEX_REMOVED , + MGMT_EV_EXT_INFO_CHANGED, };#define CACHE_TIMEOUT msecs_to_jiffies(2 * 1000)@@ -862,6 +866,52 @@ static int read_controller_info(struct sock *sk, struct hci_dev *hdev, sizeof(rp)); } +static int read_ext_controller_info (struct sock *sk,struct hci_dev *hdev, +void *data,u16 data_len) +{ +struct mgmt_rp_read_ext_info rp; + +BT_DBG ("sock %p %s" , sk, hdev->name); + +hci_dev_lock (hdev); + +memset (&rp,0 ,sizeof (rp));
net/bluetooth/mgmt.c static int read_controller_info(struct sock *sk, struct hci_dev *hdev, · line 888
Quoted 10 lines
net/bluetooth/mgmt.c +10
-0+ +bacpy (&rp.bdaddr, &hdev->bdaddr); + + rp.version = hdev->hci_ver; + rp.manufacturer =cpu_to_le16 (hdev->manufacturer); + + rp.supported_settings =cpu_to_le32 (get_supported_settings (hdev)); + rp.current_settings =cpu_to_le32 (get_current_settings (hdev)); + + rp.eir_len =cpu_to_le16 (0 );
this patch is functionally complete from its logic and event handling point of view. However it is missing the EIR_Data field to be filled in. At minimum it should contain Class of Device, Complete Local Name and Short Local Name EIR fields so it matches for the Read Controller Information currently returns.
I just ran out of time and it would be great if someone can pick this up. Extra bonus points for adding the Device ID fields and the LE Address (aka identity address) into it. And yes, the LE Address might differ depending on LE only mode of operation and Set Static Address setting.
Regards
Marcel