-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Directed advertising to Android does not work #14743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Could the issue be related to the central using privacy? Do you have |
Hi @jhedberg , no - it is disabled. |
@carlescufi @cvinayak any thoughts on this issue? |
sure, will enable and retry |
When I enable privacy I cannot create connection. Device either disconnects right after connection or does not even connect. |
@jhedberg Please review priority. |
@pdunaj did you already determine if the devices in question use privacy, i.e. that this is the differentiating factor between "works" and "doesn't work"? @carlescufi @cvinayak I'd really need your input here to understand if this is a controller issue or a host issue. @pdunaj just to get this straight, your test procedure is to pair with these devices and then request a connection to them using |
@pdunaj also, it'd be good if you could produce an HCI trace of what's going on. See https://docs.zephyrproject.org/latest/guides/bluetooth/bluetooth-dev.html#embedded-hci-tracing |
Hi @jhedberg ,
Note: for nrf52840_pca10059 we need to enable I have rechecked with privacy ( |
@jhedberg I will capture traces and try to debug it on Monday. |
@carlescufi @jhedberg The issue here is that the Host will not use IRKs for the peer when BT_PRIVACY is not enabled, meaning peers IRK is not stored with the bond. @pdunaj Enabling BT_PRIVACY should work, it did for me |
@joerchan @jhedberg @pskhansen I think we could split the Host privacy support into two different Kconfig options:
@pdunaj can you verify that enabling |
@carlescufi I don't think we need |
@jhedberg why is that? I think it would make sense to be able to conditionally compile out IRK management and RPA generation and resolution. Simple applications might want to bond and encrypt but not make use of any IRK-related functionality. |
@carlescufi because then you can't properly interop with privacy-enabled devices? Maybe I misunderstand what the second option would do. |
@carlescufi I think I may have misunderstood |
Hi @jhedberg , I checked again and enabling privacy does not work.
You can see in the logs that device is advertising directly to host but there is no connection attempt on the other side.
|
The host device is Samsung Galaxy S8 with Android 9. I tried again with my Moto G5 (Android 8.1) and it worked there but I had to wait for 20 seconds or more before connection was established. Let me check again with Galaxy S, maybe it will work if I wait long enough... |
I retried on Galaxy S8 and direct advertised device is not connected even if I wait over a minute. |
One more comment regarding our app. On mouse we would like to use fast advertising (even directed) which is enabled with |
On Galaxy S8 it finally connected but after over 2 minutes after reset and so far I have seen it only once. |
I run more tests and collected log from HCI code and BLE sniffer. There is nothing unusual happening on the mouse. From the observations I can tell that advertising indeed works but sometimes it takes several minutes before host connects. I showed logs to @joerchan and have some chat offline. The only conclusions are that direct advertising works on Android if privacy is enabled and that it can take even several minutes before device will be connected to by the peer. |
In nRF5 SDK based HID peripherals we solved this by using undirected advertising with whitelist towards centrals that had privacy enabled (typically iOS and Android) and directed advertsing towards windows centrals. It is a while since then and I am not sure how peripiheral privacy will affect this. |
@jhn-nordic we will have to do similar thing or simply use undirected advertising only as long as it is fast enough. |
In order to advertise directed to a privacy enabled central the initiator field of the directed adv packet needs to set to an RPA. To instruct the controller to use an RPA in the initiator field own address type should be set to either 0x02 or 0x03. Since it is not certain that a remote device supports address resolution of the initiator address we add an option to turn this on and give the application the responsibility to check if peer supports this. Fixes zephyrproject-rtos#14743 Signed-off-by: Joakim Andersson <[email protected]>
In order to advertise directed to a privacy enabled central the initiator field of the directed adv packet needs to set to an RPA. To instruct the controller to use an RPA in the initiator field own address type should be set to either 0x02 or 0x03. Since it is not certain that a remote device supports address resolution of the initiator address we add an option to turn this on and give the application the responsibility to check if peer supports this. Fixes #14743 Signed-off-by: Joakim Andersson <[email protected]>
Describe the bug
I bond the device with various host and then use direct advertising to reconnect.
I am able to connect to Windows 7 with Intel drivers and Windows 10. I am also able to connect to Nordic dongle (pca10059) though Zephyr's option scan with identity must be enabled.
I am unable to connect (using the direct advertising) to an Android devices. I have tried Samsung Galaxy S8 (Android 9.0) and Moto G5 (Android 8.1.0).
Maybe the problem is how these device perform scanning?
To Reproduce
Steps to reproduce the behavior:
See description.
Expected behavior
Direct advertising should work.
Impact
showstopper
Screenshots or console output
N/A
Environment (please complete the following information):
ncs zephyr: e7a0e52 (19de7ec upstream)
Additional context
N/A
The text was updated successfully, but these errors were encountered: