diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index dc356293e3b..d75fbd3150d 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -3352,6 +3352,29 @@ static void le_data_len_change(struct pdu_data *pdu_data, u16_t handle, } #endif /* CONFIG_BT_CTLR_DATA_LENGTH */ +#if defined(CONFIG_BT_REMOTE_VERSION) +void hci_remote_version_info_encode(struct pdu_data *pdu_data, u16_t handle, + struct net_buf *buf) +{ + struct pdu_data_llctrl_version_ind *ver_ind; + struct bt_hci_evt_remote_version_info *ep; + + if (!(event_mask & BT_EVT_MASK_REMOTE_VERSION_INFO)) { + return; + } + + hci_evt_create(buf, BT_HCI_EVT_REMOTE_VERSION_INFO, sizeof(*ep)); + ep = net_buf_add(buf, sizeof(*ep)); + + ver_ind = &pdu_data->llctrl.version_ind; + ep->status = 0x00; + ep->handle = sys_cpu_to_le16(handle); + ep->version = ver_ind->version_number; + ep->manufacturer = ver_ind->company_id; + ep->subversion = ver_ind->sub_version_number; +} +#endif /* CONFIG_BT_REMOTE_VERSION */ + static void encode_data_ctrl(struct node_rx_pdu *node_rx, struct pdu_data *pdu_data, struct net_buf *buf) { @@ -3369,6 +3392,12 @@ static void encode_data_ctrl(struct node_rx_pdu *node_rx, break; #endif /* CONFIG_BT_CTLR_LE_ENC */ +#if defined(CONFIG_BT_REMOTE_VERSION) + case PDU_DATA_LLCTRL_TYPE_VERSION_IND: + hci_remote_version_info_encode(pdu_data, handle, buf); + break; +#endif /* defined(CONFIG_BT_REMOTE_VERSION) */ + case PDU_DATA_LLCTRL_TYPE_FEATURE_RSP: le_remote_feat_complete(0x00, pdu_data, handle, buf); break; @@ -3478,29 +3507,6 @@ void hci_num_cmplt_encode(struct net_buf *buf, u16_t handle, u8_t num) hc->handle = sys_cpu_to_le16(handle); hc->count = sys_cpu_to_le16(num); } - -#if defined(CONFIG_BT_REMOTE_VERSION) -void hci_remote_version_info_encode(struct net_buf *buf, - struct pdu_data *pdu_data, u16_t handle) -{ - struct pdu_data_llctrl_version_ind *ver_ind; - struct bt_hci_evt_remote_version_info *ep; - - if (!(event_mask & BT_EVT_MASK_REMOTE_VERSION_INFO)) { - return; - } - - hci_evt_create(buf, BT_HCI_EVT_REMOTE_VERSION_INFO, sizeof(*ep)); - ep = net_buf_add(buf, sizeof(*ep)); - - ver_ind = &pdu_data->llctrl.version_ind; - ep->status = 0x00; - ep->handle = sys_cpu_to_le16(handle); - ep->version = ver_ind->version_number; - ep->manufacturer = ver_ind->company_id; - ep->subversion = ver_ind->sub_version_number; -} -#endif /* CONFIG_BT_REMOTE_VERSION */ #endif /* CONFIG_BT_CONN */ u8_t hci_get_class(struct node_rx_pdu *node_rx) diff --git a/subsys/bluetooth/controller/hci/hci_driver.c b/subsys/bluetooth/controller/hci/hci_driver.c index b6a45f1734f..439680eb0c9 100644 --- a/subsys/bluetooth/controller/hci/hci_driver.c +++ b/subsys/bluetooth/controller/hci/hci_driver.c @@ -76,27 +76,7 @@ static s32_t hbuf_count; static struct net_buf *process_prio_evt(struct node_rx_pdu *node_rx) { -/* Currently the only event processed */ -#if defined(CONFIG_BT_REMOTE_VERSION) - struct pdu_data *pdu_data = PDU_DATA(node_rx); - struct net_buf *buf; - u16_t handle; - - /* Avoid using hci_get_class() to speed things up */ - if (node_rx->hdr.user_meta == HCI_CLASS_EVT_LLCP) { - - handle = node_rx->hdr.handle; - if (pdu_data->llctrl.opcode == - PDU_DATA_LLCTRL_TYPE_VERSION_IND) { - - buf = bt_buf_get_evt(BT_HCI_EVT_REMOTE_VERSION_INFO, - false, K_FOREVER); - hci_remote_version_info_encode(buf, pdu_data, handle); - return buf; - } - } - -#endif /* CONFIG_BT_CONN */ + /* Currently there are no events processed */ return NULL; } diff --git a/subsys/bluetooth/controller/hci/hci_internal.h b/subsys/bluetooth/controller/hci/hci_internal.h index 7ff6ba89513..fcd22a9fb2e 100644 --- a/subsys/bluetooth/controller/hci/hci_internal.h +++ b/subsys/bluetooth/controller/hci/hci_internal.h @@ -46,8 +46,6 @@ u8_t hci_get_class(struct node_rx_pdu *node_rx); int hci_acl_handle(struct net_buf *acl, struct net_buf **evt); void hci_acl_encode(struct node_rx_pdu *node_rx, struct net_buf *buf); void hci_num_cmplt_encode(struct net_buf *buf, u16_t handle, u8_t num); -void hci_remote_version_info_encode(struct net_buf *buf, - struct pdu_data *pdu_data, u16_t handle); #endif int hci_vendor_cmd_handle(u16_t ocf, struct net_buf *cmd, struct net_buf **evt);