Bluetooth: host: Add bt_configure_data_path for vendor data path
Implemented host function for configuring vendor specific data path for use with ISO, and fixed passing of path ID in setup. Signed-off-by: Morten Priess <mtpr@oticon.com>
This commit is contained in:
parent
3f6737f688
commit
06900485ec
3 changed files with 57 additions and 8 deletions
|
@ -2169,6 +2169,23 @@ void bt_foreach_bond(uint8_t id, void (*func)(const struct bt_bond_info *info,
|
||||||
void *user_data),
|
void *user_data),
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
|
/** @brief Configure vendor data path
|
||||||
|
*
|
||||||
|
* Request the Controller to configure the data transport path in a given direction between
|
||||||
|
* the Controller and the Host.
|
||||||
|
*
|
||||||
|
* @param dir Direction to be configured, BT_HCI_DATAPATH_DIR_HOST_TO_CTLR or
|
||||||
|
* BT_HCI_DATAPATH_DIR_CTLR_TO_HOST
|
||||||
|
* @param id Vendor specific logical transport channel ID, range
|
||||||
|
* [BT_HCI_DATAPATH_ID_VS..BT_HCI_DATAPATH_ID_VS_END]
|
||||||
|
* @param vs_config_len Length of additional vendor specific configuration data
|
||||||
|
* @param vs_config Pointer to additional vendor specific configuration data
|
||||||
|
*
|
||||||
|
* @return 0 in case of success or negative value in case of error.
|
||||||
|
*/
|
||||||
|
int bt_configure_data_path(uint8_t dir, uint8_t id, uint8_t vs_config_len,
|
||||||
|
const uint8_t *vs_config);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3801,3 +3801,40 @@ void bt_data_parse(struct net_buf_simple *ad,
|
||||||
net_buf_simple_pull(ad, len - 1);
|
net_buf_simple_pull(ad, len - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bt_configure_data_path(uint8_t dir, uint8_t id, uint8_t vs_config_len,
|
||||||
|
const uint8_t *vs_config)
|
||||||
|
{
|
||||||
|
struct bt_hci_rp_configure_data_path *rp;
|
||||||
|
struct bt_hci_cp_configure_data_path *cp;
|
||||||
|
struct net_buf *rsp;
|
||||||
|
struct net_buf *buf;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
buf = bt_hci_cmd_create(BT_HCI_OP_CONFIGURE_DATA_PATH, sizeof(*cp) +
|
||||||
|
vs_config_len);
|
||||||
|
if (!buf) {
|
||||||
|
return -ENOBUFS;
|
||||||
|
}
|
||||||
|
|
||||||
|
cp = net_buf_add(buf, sizeof(*cp));
|
||||||
|
cp->data_path_dir = dir;
|
||||||
|
cp->data_path_id = id;
|
||||||
|
cp->vs_config_len = vs_config_len;
|
||||||
|
if (vs_config_len) {
|
||||||
|
(void)memcpy(cp->vs_config, vs_config, vs_config_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
err = bt_hci_cmd_send_sync(BT_HCI_OP_CONFIGURE_DATA_PATH, buf, &rsp);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
rp = (void *)rsp->data;
|
||||||
|
if (rp->status) {
|
||||||
|
err = -EIO;
|
||||||
|
}
|
||||||
|
net_buf_unref(rsp);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
|
@ -292,15 +292,10 @@ static int bt_iso_setup_data_path(struct bt_conn *iso)
|
||||||
rx_qos = chan->qos->rx;
|
rx_qos = chan->qos->rx;
|
||||||
|
|
||||||
in_path.path = tx_qos && tx_qos->path ? tx_qos->path : &default_path;
|
in_path.path = tx_qos && tx_qos->path ? tx_qos->path : &default_path;
|
||||||
|
in_path.pid = tx_qos ? tx_qos->path->pid : BT_ISO_DATA_PATH_DISABLED;
|
||||||
|
|
||||||
out_path.path = rx_qos && rx_qos->path ? rx_qos->path : &default_path;
|
out_path.path = rx_qos && rx_qos->path ? rx_qos->path : &default_path;
|
||||||
|
out_path.pid = rx_qos ? rx_qos->path->pid : BT_ISO_DATA_PATH_DISABLED;
|
||||||
if (!tx_qos) {
|
|
||||||
in_path.pid = BT_ISO_DATA_PATH_DISABLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!rx_qos) {
|
|
||||||
out_path.pid = BT_ISO_DATA_PATH_DISABLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iso->iso.is_bis) {
|
if (iso->iso.is_bis) {
|
||||||
/* Only set one data path for BIS as per the spec */
|
/* Only set one data path for BIS as per the spec */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue