- Forum posts: 3
May 19, 2020, 1:43:06 PM via Website
May 19, 2020 1:43:06 PM via Website
There is a 100 device limit in Android for the maximum number of paired Bluetooth devices. This causes problems for my App used for reading the meter status.
Solutions
Multiple solutions to the problem looks possible.
- Solutions that replace the Bluetooth lib library all require some form of rooting the device.
- Use AOSP and GSI to update system image of device.
Manufacturers use different solutions for partitioning etc. of phones so it’s very hard to create a portable solution even when using GSI.
Replace only the Bluetooth library
Replacing only the lib may be more general, but it also requires rooting and installation of TWRP.Use the ndk to patch/replace the pairing code or try to integrate the App deeper in the stack
There is an interesting old paten for “Centralized Bluetooth Device Pairing”Patch of Bluetooth library
The idea is to just change BTM_SEC_MAX_DEVICE_RECORDS variable. If we can change or override this variable outside in some configuration file and do not build source is more desirable.
If we can just build and replace component which allow it to keep more then 100 paired Bluetooth device is ideal
The below code seems to be culprit as mentioned in this link (
According to the Bluetooth implementation, if there are more than 100 device records the allocation will fail. The responsible BTM_SEC_MAX_DEVICE_RECORDS is defined in bt_target.h:
/* The number of security records for peer devices. */
ifndef BTM_SEC_MAX_DEVICE_RECORDS
define BTM_SEC_MAX_DEVICE_RECORDS 100
endif
This is then used inside btm_dev.c, specifically in BTM_SecAddDevice which returns false after 100 pairings:
/* There is no device record, allocate one.- If we can not find an empty spot for this one, let it fail. */
for (i = 0; i < BTM_SEC_MAX_DEVICE_RECORDS; i++)
- If we can not find an empty spot for this one, let it fail. */
Query
* If I update the #define BTM_SEC_MAX_DEVICE_RECORDS from 100 to lets say 1000, do I need to build the complete GIS image and install.
* Or, can I only update the BT library?
* Or, any other methods?
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.