Skip to content

Commit 7f65aa8

Browse files
carlescufiAnas Nashif
authored andcommitted
Bluetooth: controller: Implement Write BD_ADDR VS cmd
Implement the Zephyr VS command that allows a Host to write a public Bluetooth Address to the Controller in order to allow Hosts to provide their own public Bluetooth addresses. Signed-off-by: Carles Cufi <[email protected]>
1 parent 705fb8e commit 7f65aa8

File tree

1 file changed

+17
-0
lines changed
  • subsys/bluetooth/controller/hci

1 file changed

+17
-0
lines changed

subsys/bluetooth/controller/hci/hci.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,6 +1674,8 @@ static void vs_read_supported_commands(struct net_buf *buf,
16741674
/* Set Version Information, Supported Commands, Supported Features. */
16751675
rp->commands[0] |= BIT(0) | BIT(1) | BIT(2);
16761676
#if defined(CONFIG_BT_CTLR_HCI_VS_EXT)
1677+
/* Write BD_ADDR */
1678+
rp->commands[0] |= BIT(5);
16771679
/* Read Static Addresses, Read Key Hierarchy Roots */
16781680
rp->commands[1] |= BIT(0) | BIT(1);
16791681
#endif /* CONFIG_BT_CTLR_HCI_VS_EXT */
@@ -1691,6 +1693,17 @@ static void vs_read_supported_features(struct net_buf *buf,
16911693
}
16921694

16931695
#if defined(CONFIG_BT_CTLR_HCI_VS_EXT)
1696+
static void vs_write_bd_addr(struct net_buf *buf, struct net_buf **evt)
1697+
{
1698+
struct bt_hci_cp_vs_write_bd_addr *cmd = (void *)buf->data;
1699+
struct bt_hci_evt_cc_status *ccst;
1700+
1701+
ll_addr_set(0, &cmd->bdaddr.val[0]);
1702+
1703+
ccst = cmd_complete(evt, sizeof(*ccst));
1704+
ccst->status = 0x00;
1705+
}
1706+
16941707
static void vs_read_static_addrs(struct net_buf *buf, struct net_buf **evt)
16951708
{
16961709
struct bt_hci_rp_vs_read_static_addrs *rp;
@@ -1796,6 +1809,10 @@ static int vendor_cmd_handle(u16_t ocf, struct net_buf *cmd,
17961809
break;
17971810

17981811
#if defined(CONFIG_BT_CTLR_HCI_VS_EXT)
1812+
case BT_OCF(BT_HCI_OP_VS_WRITE_BD_ADDR):
1813+
vs_write_bd_addr(cmd, evt);
1814+
break;
1815+
17991816
case BT_OCF(BT_HCI_OP_VS_READ_STATIC_ADDRS):
18001817
vs_read_static_addrs(cmd, evt);
18011818
break;

0 commit comments

Comments
 (0)