Skip to content

Commit

Permalink
drv/bluetooth_stm32_bluenrg: fix wait for status on disconnect
Browse files Browse the repository at this point in the history
When we send a disconnect command (GAP Terminate), the controller
responds with a command status event rather than a command complete
event.

This fixes Bluetooth comms locking up until something else triggers
a command complete event.
  • Loading branch information
dlech committed Mar 23, 2023
1 parent 63fecd6 commit 04d548a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ static PT_THREAD(disconnect_remote_task(struct pt *pt, pbio_task_t *task)) {

PT_WAIT_WHILE(pt, write_xfer_size);
aci_gap_terminate_begin(remote_handle, HCI_OE_USER_ENDED_CONNECTION);
PT_WAIT_UNTIL(pt, hci_command_complete);
PT_WAIT_UNTIL(pt, hci_command_status);
aci_gap_terminate_end();

PT_WAIT_UNTIL(pt, remote_handle == 0);
Expand Down

0 comments on commit 04d548a

Please sign in to comment.