Hi Marcel,
quoted
It's observed that sometimes the setup handler is called twice when Bluetooth daemon is running in
background. We will rebase to latest commit on bluetooth-next tree and test again. If the issue is
gone with the latest code in -next tree we will remove the setup_done flag.
that is a bug. It should only be ever called once. Could this be due to RFKILL issue we had? Please
re-test with Johan's patches applied and check if it makes a difference. Otherwise please send some
logs since we want to get this fixed.
Amitkumar Karwar has tested it with latest code on bluetooth-next tree but the result is the same.
Apparently two threads race to call hci_dev_open(). If the thread from hci_sock calls hci_dev_open earlier, it ends up not updating HCI_SETUP hdev flag in hci_power_on(). This results that the setup handler gets called again when user brings up the interface later.
Attached are the debug logs and the patch used to generate them.
I checked the bluetooth-next tree, the following two patches (by Johan) are not present in this tree.
bf54303 Bluetooth: Fix rfkill functionality during the HCI setup stage
5e13036 Bluetooth: Introduce a new HCI_RFKILLED flag
They are in bluetooth.git tree. So, I'm not certain if Amitkumar has applied them manually or not. Anyway we will re-test with Johan's patches applied and confirm if they fix the race or not.
Thanks,
Bing