-
Notifications
You must be signed in to change notification settings - Fork 582
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
Expose transport and phy configuration for connection (Android 10 connection issue) #646
Comments
At some point — yes. Unfortunately I do have limited time and it is not top priority right now. Could you shed a bit more light on your exact case? Have you tried to investigate this bug? Get HCI logs from your device? |
My case is a bit peculiar. I've got two devices on BT 4.2. They've got two modes, first is public undirected advertising for connection with an unknown central. Second is directed advertising with resolvable private address for reconnection with a bonded central. After bonding to two devices and doing few successful connections/disconnections it bricks all future connections. After this phone can't connect and times out after 30s with Gatt error 133. It happens only when there are multiple bonded devices and only on Android 10, only thing that helps is clearing list of bonded devices. Solution from first comment works only until I try to connect with different config, so let's say RxAndroidBle default. After which connection is bricked even for LE_CODED and Transport_auto config. About the solution itself, setting phy to le_coded and transport to auto. My devices do not support BT5 so phone can't use 2M or le_coded for actual connection. In the HCI logs all connections are done with phy set to 1M no matter what was set in the API call (::connectGatt). But by some reason this is the only way I can connect to my devices. From the bt device point of view, when the connection is bricked on particular phone. Bt device doesn't see any incoming connections when phone is trying to create one. @dariuszseweryn a bit long description but case is complex. Anyway it looks like a bug deep in the bt layer that was introduced in Android 10 |
More info the issue. Actual event of scanning is corrupting future connections to bonded devices. After bonding I can connect freely to multiple devices, given that I turned off scanning after the bonding. Then after disconnecting from the devies and turning on scanning for a moment and turning it off I can no longer connect to my devices. It seems that scanning event corrupts some internal data for bonded devices. |
😲 |
I'm not an expert in low level BLE communication but I haven't seen anything out of ordinary in HCI logs. If you're interested in the topic I'd be more than happy to share the logs. Also found out that it's not only about the scanning. What actually corrupts the connection is successfuly scanning devices from the bonded list. I can't reproduce the error If I'm turning off the devices during scanning events |
Please do. Having logs with a successful connection after bonding, re-scan and unsuccessful connection could be interesting to find out what may be happening there |
Here are logs and thank you!
Just in case also attached full logcat logs with filtering on bluetooth stack. |
I've prepared similar log package from Android 9 where this problem doesn't occur. Differences I found after comparision:
Additionally before scanning that corrupts connection Pixel adds the device to White List with type @dariuszseweryn Do you think it might be the actual problem that Android 10 doesn't correctly recognizes address type when scanning and then caches that address type in bond information? Or do you think it's just differences between manufacturers or system version in logging information? bt_snoop_android_9.log |
|
You're right, the device won't always pop up in the scans, maybe it's scanned with true random address and is interpreted by something up in the stack. But still after the scanning it's added to white list with Scanning itself is not full story, if I successfuly scan the devices, then turn off bt for a while and try to connect to them without doing second scan ( |
This is a well-known bug of Android. I have briefly mentioned about it on Wiki
I have been looking on frames between 4531 and 6017. First one is the last moment the peripheral is added to white list with |
Was doing some tests with single bonded device and managed to recreate the issue only on one device, which is new for my case. Checked the logs after connecting without scanning and type address added to the whitelist is actually Here are logs with successful connecting without scanning. You can find adding to white list in frame 186 What's interesting is that in logs with corrupted single device connection scanning returns correct address type |
@dariuszseweryn problem has been fixed from the bluetooth device perspective. I think it's really interesting case. Straight after bonding device didn't update it's address type immidiately to correct type (random static) but kept the incorrect (public) one. Address itself was correct. These are white list operation with bug:
These are white list operation with fixed address type:
Here're logs with solution if you're interested: What is most interesting about it, is that this situation is tolerated by all iOS versions and Android version until 10. It appears that they dramatically changed how addresses are handled under the hood. |
Hey,
Android 10 introduced problems with connecting to multiple BLE devices for me. Linked topics may be related:
https://stackoverflow.com/questions/58299507/android-10-ble-connection-issue
https://issuetracker.google.com/issues/141188862
I managed to find solution by forcing this config on connection:
But RxAndroidBle don't exposes possibility to set
transport
andphy
. Have you considered exposing those settings?The text was updated successfully, but these errors were encountered: