Skip to content

Commit 314e074

Browse files
jhedbergolivier-le-sage
authored andcommitted
[nrf fromtree] Bluetooth: samples: Use bt_hci_cmd_alloc()
Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg <[email protected]> (cherry picked from commit 187ec70)
1 parent 643fd50 commit 314e074

File tree

2 files changed

+4
-6
lines changed
  • samples/bluetooth

2 files changed

+4
-6
lines changed

samples/bluetooth/hci_pwr_ctrl/src/main.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static void read_conn_rssi(uint16_t handle, int8_t *rssi)
5757

5858
int err;
5959

60-
buf = bt_hci_cmd_create(BT_HCI_OP_READ_RSSI, sizeof(*cp));
60+
buf = bt_hci_cmd_alloc(K_FOREVER);
6161
if (!buf) {
6262
printk("Unable to allocate command buffer\n");
6363
return;
@@ -86,8 +86,7 @@ static void set_tx_power(uint8_t handle_type, uint16_t handle, int8_t tx_pwr_lvl
8686
struct net_buf *buf, *rsp = NULL;
8787
int err;
8888

89-
buf = bt_hci_cmd_create(BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL,
90-
sizeof(*cp));
89+
buf = bt_hci_cmd_alloc(K_FOREVER);
9190
if (!buf) {
9291
printk("Unable to allocate command buffer\n");
9392
return;
@@ -119,8 +118,7 @@ static void get_tx_power(uint8_t handle_type, uint16_t handle, int8_t *tx_pwr_lv
119118
int err;
120119

121120
*tx_pwr_lvl = 0xFF;
122-
buf = bt_hci_cmd_create(BT_HCI_OP_VS_READ_TX_POWER_LEVEL,
123-
sizeof(*cp));
121+
buf = bt_hci_cmd_alloc(K_FOREVER);
124122
if (!buf) {
125123
printk("Unable to allocate command buffer\n");
126124
return;

samples/bluetooth/hci_vs_scan_req/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static void enable_legacy_adv_scan_request_event(bool enable)
6565
struct net_buf *buf;
6666
int err;
6767

68-
buf = bt_hci_cmd_create(BT_HCI_OP_VS_SET_SCAN_REQ_REPORTS, sizeof(*cp));
68+
buf = bt_hci_cmd_alloc(K_FOREVER);
6969
if (!buf) {
7070
printk("%s: Unable to allocate HCI command buffer\n", __func__);
7171
return;

0 commit comments

Comments
 (0)