diff options
author | Szymon Janc <ext.szymon.janc@tieto.com> | 2016-09-16 16:14:25 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2016-10-16 09:00:57 +0300 |
commit | 7d4c746093f3ebae2a9df17ab6cc68c9b88b68eb (patch) | |
tree | 3a3d3fc63d207be6792f95ae325cc51d4bc2b393 /net | |
parent | d84397a27c5db14c58abc1cdc418aa8d6b1bfc61 (diff) |
Bluetooth: L2CAP: Build fixed channels mask on runtime
Build Information Response with fixed channels mask based on
registered channels.
Change-Id: I47bd3255bd000d3721c77a34c6ea84bbb888630d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/l2cap_br.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/net/bluetooth/l2cap_br.c b/net/bluetooth/l2cap_br.c index 56a916930..1d72d61e0 100644 --- a/net/bluetooth/l2cap_br.c +++ b/net/bluetooth/l2cap_br.c @@ -480,13 +480,17 @@ done: return err; } -static bool br_sc_supported(void) +static uint8_t get_fixed_channels_mask(void) { -#if defined(CONFIG_BLUETOOTH_SMP_FORCE_BREDR) - return true; -#else - return BT_FEAT_SC(bt_dev.features); -#endif /* CONFIG_BLUETOOTH_SMP_FORCE_BREDR */ + struct bt_l2cap_fixed_chan *fchan; + uint8_t mask = 0; + + /* this needs to be enhanced if AMP Test Manager support is added */ + for (fchan = br_fixed_channels; fchan; fchan = fchan->_next) { + mask |= BIT(fchan->cid); + } + + return mask; } static int l2cap_br_info_req(struct bt_l2cap_br *l2cap, uint8_t ident, @@ -531,13 +535,7 @@ static int l2cap_br_info_req(struct bt_l2cap_br *l2cap, uint8_t ident, rsp->result = sys_cpu_to_le16(BT_L2CAP_INFO_SUCCESS); /* fixed channel mask protocol data is 8 octets wide */ memset(net_buf_add(rsp_buf, 8), 0, 8); - /* signaling channel is mandatory on BR/EDR transport */ - rsp->data[0] = BIT(BT_L2CAP_CID_BR_SIG); - - /* Add SMP channel if SC are supported */ - if (br_sc_supported()) { - rsp->data[0] |= BIT(BT_L2CAP_CID_BR_SMP); - } + rsp->data[0] = get_fixed_channels_mask(); hdr_info->len = sys_cpu_to_le16(sizeof(*rsp) + 8); break; |