Hi Shuai, On Wed, Apr 9, 2025 at 5:13 AM Shuai Zhang <quic_shuaz@xxxxxxxxxxx> wrote: > > Dear Paul > > On 4/8/2025 7:51 PM, Shuai Zhang wrote: > > If turning off BT during pairing, "hci_acl_create_conn_sync" has chances > > to be left in cmd_sync_work_list. Then the driver will try to send > > the HCI command of creating connection but failed. > > > > bluetoothctl test step: > > 1. local device pair with remote device > > 2. once pair is complete, local device will immediately perform power off > > 3. powe on local device fail Doesn't look like the real commands to me, can you create an init script out of it? > > Check if the device is not starting up, that means powering off, > > when establishing the ACL link, and cancel early in this case. > > Ok, but if the controller has been powered off, or is in the process, then hci_cmd_sync_cancel_sync shall have been called so commands shall not be pending, or perhaps there are more then one command pending? > Do you have other suggestions? Please let me know. Thanks. > > > Change-Id: I72802f306a20d43282dd374dd33b8cb1a22f48d8 > > Signed-off-by: Shuai Zhang <quic_shuaz@xxxxxxxxxxx> > > --- > > net/bluetooth/hci_sync.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c > > index c553b637c..c4f1c0f30 100644 > > --- a/net/bluetooth/hci_sync.c > > +++ b/net/bluetooth/hci_sync.c > > @@ -6755,7 +6755,7 @@ static int hci_acl_create_conn_sync(struct hci_dev *hdev, void *data) > > struct hci_cp_create_conn cp; > > int err; > > > > - if (!hci_conn_valid(hdev, conn)) > > + if (!hci_conn_valid(hdev, conn)|| !test_bit(HCI_UP, &hdev->flags)) > > return -ECANCELED; > > > > /* Many controllers disallow HCI Create Connection while it is doing > > -- Luiz Augusto von Dentz