From 04d548aca9c3b03c74430bb5324cfe57856ba4ca Mon Sep 17 00:00:00 2001 From: David Lechner Date: Thu, 23 Mar 2023 11:31:47 -0500 Subject: [PATCH] drv/bluetooth_stm32_bluenrg: fix wait for status on disconnect 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. --- lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c b/lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c index 84fe5e014..e8f8264a9 100644 --- a/lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c +++ b/lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c @@ -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);