BluetoothLibraryPatcher - Fix bluetooth pairings loss [Android 11/10/Pie/Oreo/Nougat]

Search This thread

Zotyoo

Member
Jul 11, 2015
22
5
Can you help which file to back up .bak? I think you're making some changes to this file. I can save this file with Root Explorer. and attach it to you. You type what the command line would do, and I put it in its old place. Reboot and you're done. If you want to modify an xml file, you can do so without any problems. It is not used continuously by the operating system, it only reads data from it on reboot. You know for sure which file, what text you are looking for, and what action you are taking on it. I'll come to you with a beer minimum! Please solve it! You know for sure what needs to change and where. If I know that, I'll fix it. Thanks!

Edit: You wrote to type "su" first, then enter, then the other commands, and enter again. The su command, followed by enter, typed this text:
:data/data/command.termux/filmes/home #
So I could only copy the second command after that. I don't think so.
Oh man! I do not know what found the phone! He figured out this morning that he was connected to the clock. And it hasn't been restarted since I wrote it. Maybe the operation still took place? I do not know! Now he's mated for some reason. Thank you so much for dealing with this so much! I'm coming for a beer! Thanks! You are cool!
 
  • Like
Reactions: 3arthur6

JakunTech1010

Senior Member
Jun 5, 2018
159
72
Ho Chi Minh city
I'm using OneUI 2.5 on Samsung A70
I have a Galaxy Fit e
I've flashed Bluetooth Library Flasher through TWRP. It said it sucessfully flashed
But when I turn on airplane mode or reboot, it still lost
My Fit e then reset
I tried using terminal, but got this:
a70q:/ $ su
a70q:/ # mount -o remount,rw /vendor
/vendor/etc/vintf` && [ ! -z $i ] && cp --preserve=all $i $i.bak && sed -i '/<.*security.wsm.*/,/<hal format="hidl">/d' $i
mount -o remount,ro /vendora70q:/ # i=`grep -lr 'security.wsm' /vendor/etc/vintf` && [ ! -z $i ] && cp --preserve=all $i--preserve=all $i $i.bak && sed -i '/<.*security.wsm.*/,/<hal format="hidl">/d' $i <
cp: /vendor/etc/vintf/manifest.xml.bak.bak.bak setxattr(security.selinux=u:eek:bject_r:vendor_configs_file:s0): Bad file descriptor
cp: /vendor/etc/vintf/manifest.xml.bak.bak.bak: Bad file descriptor
1|a70q:/ # mount -o remount,ro /vendor
a70q:/ #
Please help, what did I done wrong?
 

aymeric106

Member
Mar 5, 2011
20
3
Thank you so much ... been fighting for days to get my Gear S3 watch to connect after updating my S20 to OneUI 3.0.
I found your module by mystake in Magisk.
Aymeric
 

Muantemama

Member
Aug 25, 2012
11
3


Bluetooth Library Patcher





This patch/module attends to avoid bluetooth pairings loss after reboot on rooted samsung devices.





It handles most of samsung devices on android Nougat, Oreo, Pie, 10 and 11.


This patch is NOT applicable with an aosp rom, only samsung stock/based.


In case installation fails, please upload here the BluetoothLibPatcher-files.tar created in your internal storage.




To fix Galaxy Wearable pairing issue, as the modifcations aren't applicable through Magisk :

Either go to twrp flashable zip

Or you can directly execute these commands from a terminal app :

Code:
su
mount -o remount,rw /vendor
i=`grep -lr 'security.wsm' /vendor/etc/vintf` && [ ! -z $i ] && cp --preserve=all $i $i.bak && sed -i '/<.*security.wsm.*/,/<hal format="hidl">/d' $i
mount -o remount,ro /vendor



• Link :

- TWRP zip : BluetoothLibraryPatcher_2.2.3.zip
- Mega
- GDrive

- Magisk module : Bluetooth Library Patcher module from Magisk Manager


• Credits : @topjohnwu for magisk and magiskboot used here for its easy-to-use hexpatcher


• Source & changelogs : Github BluetoothLibraryPatcher
Thank you so much...problem solved
 

TenzoSRx

Senior Member
Aug 10, 2014
137
27
Kingston
I've noticed on occasion where my phone will randomly reboot everytime I go on the home screen, I have to turn the Bluetooth off before I come off the lockscreeen for the phone to not soft reboot. Can you look into this when you have the chance...I'll try to roll back to an earlier version so see if this ails my issue down some
 

jsjs123456

New member
Mar 3, 2021
4
1
[Installation is successful, but pairing is lost after reboot.]

Hi, I've got a s9+ running TGY G9650ZHU7ETJ5 (Android 10, One UI 2.1), installed magisk 22.0 and rooted.

I installed the module from magisk; from the log messages, everything is OK. This a take a screenshot in the attachment as BluetoothLibraryPatcher-installation-20210303103702.jpg.

Just that after reboot, bluetooth pairing info is still lost. Actually I believe I've installed it twice and for the second time it still reports successful installation instead of something like "your system is already patched". So there may be something wrong down there.

Tried BluetoothLibraryPatcher_magisk_beta2.zip and the same.

I've collected all files in the phone I know that may be relevant; see the attachment s9+-TGY-G9650ZHU7ETJ5.zip.

Thanks for your work and patience.
 

Attachments

  • s9+-TGY-G9650ZHU7ETJ5.zip
    247.2 KB · Views: 5
  • BluetoothLibraryPatcher-installation-20210303103702.jpg
    BluetoothLibraryPatcher-installation-20210303103702.jpg
    87.9 KB · Views: 15
  • Like
Reactions: JuanGS

DjLeleX

Member
Dec 18, 2016
30
10
Venice
Hi,
I have a problem with the Galaxy Fit 2 which disconnects after entering airplane mode, turning off bluetooth or rebooting the device. I've flashed the .zip file from the recovery successfully, and even runned the terminal command with success, but the problem is still here. It's a pain because everytime it disconnects I have to reset the Galaxy Fit 2 in order to connect it again to the phone.
It's strange as my phone doesn't lose the connection to my Galaxy Buds or my Bose Soundlink III, but only with my Galaxy Fit 2.

My current setup is an S10+ (G975F) on Android 11 (OneUi 3.1) latest version available (FUBD).
The Galaxy Wereable app is updated to the latest version, and also the Galaxy Fit 2 is updated. I used the official latest version of the .zip twrp flashable file.
I hope there could be an easy fix in the near future.

Thanks for you work and the effort you put in this thing
Cheers,
DJLeleX
 

3arthur6

Senior Member
Sep 15, 2011
447
887
I've noticed on occasion where my phone will randomly reboot everytime I go on the home screen

Woo sure it happen only with the module? Did you try to disable it, reboot, and check if it still happen?

[Installation is successful, but pairing is lost after reboot.]

Humm oops your subBuffer.log clearly shows the patch didn't worked correctly..
Can you upload here /system/lib64/libbluetooth.so?

I have a problem with the Galaxy Fit 2 which disconnects after entering airplane mode, turning off bluetooth or rebooting the device.

What returns this command from a terminal app?
su -c grep -r 'wsm' /vendor/etc/vintf
You should also try the multidisabler thanks to @ianmacd
 
  • Like
Reactions: DjLeleX

TenzoSRx

Senior Member
Aug 10, 2014
137
27
Kingston
Woo sure it happen only with the module? Did you try to disable it, reboot, and check if it still happen?



Humm oops your subBuffer.log clearly shows the patch didn't worked correctly..
Can you upload here /system/lib64/libbluetooth.so?



What returns this command from a terminal app?
su -c grep -r 'wsm' /vendor/etc/vintf
You should also try the multidisabler thanks to @ianmacd
I resorted to using 1.8 so far no issues
 
  • Like
Reactions: 3arthur6

DjLeleX

Member
Dec 18, 2016
30
10
Venice
What returns this command from a terminal app?
su -c grep -r 'wsm' /vendor/etc/vintf
You should also try the multidisabler thanks to @ianmacd

I've already flashes the multidisabler by ianmacd, but not with the _btfix in the name, as in his guide it says it's deprecated (at least that's what I understood reading his information) and we should use your libbluetooth patcher.

The command has no output in the terminal app (I use termux):
Screenshot_20210305-204339_Termux.jpg

Thanks for your fast answer and for your time.
 

3arthur6

Senior Member
Sep 15, 2011
447
887
I've already flashes the multidisabler by ianmacd, but not with the _btfix in the name, as in his guide it says it's deprecated (at least that's what I understood reading his information) and we should use your libbluetooth patcher.

The command has no output in the terminal app

Humm..
No need for _btfix, his disabler delete some unused security services for a rooted device. One of them, wsm, is known to break gear watch pairing. But if you already do it.. And no output from the command shows you already stopped this service.
Sorry to tell this but I think you should try a fresh clean install (factory reset), as other people with same device have managed to get it working.
 

DjLeleX

Member
Dec 18, 2016
30
10
Venice
Humm..
No need for _btfix, his disabler delete some unused security services for a rooted device. One of them, wsm, is known to break gear watch pairing. But if you already do it.. And no output from the command shows you already stopped this service.
Sorry to tell this but I think you should try a fresh clean install (factory reset), as other people with same device have managed to get it working.
I've already clean flashed the rom, the fact is that I can do the first pairing with the Galaxy Fit 2, but when I turn on airplane mode, reboot my device or turn off bluetooth, it disappear from my device in the Galaxy Wereable app, so I have to pair it again. And to pair again the Galaxy Fit I need to reset it, doing so I lose the tracking data of the watch (steps, hours slept, heart rate, etc) if not previously synced with s health. Yeah, I can sync before reboot so I don't lose anything, but what if my phone reboot overnight, like yesterday, I can't sync the hours slept and the heart rate and stuff, because the Galaxy Fit 2 is unpaired since the reboot, so I lose that data. And obvliusly it's a bit annoying having to pair the watch again every time I turn airplane mode on, or reboot the device.
Maybe the problem is in the Galaxy Wereable app, which can't keep the pairing across reboot and airplane mode.
I can send you my system files, if you tell me which one do you need to look into.
Anyway, I really appreciate your work,
Best regards,
DJLeleX
 

Vuska

Senior Member
Jul 26, 2010
1,676
417
Bandung
I also really dont understand...😔

already flashed bluetoothlibpatcher v2.2.3 from magisk...
also do terminal command from page #1.

my rom also patch with MultiDisabler 3.1 for sir Ian.

but if i reboot my phone or activating flight mode.... still need to repairing my bluetooth earphone or my Huawei watch gt2.
tomorrow i my Samsung Watch active 2 coming.... and i see friend here also has same problem and his samsung watch need to reset 😱

im using Android 10 Samsung G9750 (snapdragon).

What next i could check sir ?

please help...

Screenshot_20210306-192645.jpg


Magisk module only showing that....
and i cant find the log file in internal storage..
 
Last edited:

3arthur6

Senior Member
Sep 15, 2011
447
887
I've already clean flashed the rom

Ok. At this point I'm not sure what can be done.. Isn't there some threads on xda about that? I will make more searches..

Magisk module only showing that....

Whoops it seems there is an issue during installation..
Could you install again the module, when backup the magisk log (by clicking the floppy disk like in your screenshot) and upload it here?
 
  • Love
Reactions: Vuska

Vuska

Senior Member
Jul 26, 2010
1,676
417
Bandung
Whoops it seems there is an issue during installation..
Could you install again the module, when backup the magisk log (by clicking the floppy disk like in your screenshot) and upload it here?

Thank you, sir... finally after your guide to click that floppy disk like icon, i read the log and found that module script cannot create folder because there is a file with filename exactly same with folder that want to create.
So i rename that file, and re flash the module...

Voila... it success and try it with connect my earphone.... flight mode... connect again without repairing... same if i reboot my device, my bluetooth pairing not lost anymore.

Thank you..
 
  • Like
Reactions: 3arthur6

jsjs123456

New member
Mar 3, 2021
4
1
@3arthur6 Hi, here is my libbluetooth.so. Thanks for your time.
I examined this libbluetooth.so with methods suggested in hexpatch.sh, discovered that I already have the patch s/88000054691180522925c81a69000037e0030032/04000014691180522925c81a69000037e0031f2a/ . Then I compared the dump with the original file from ROM and confirmed that this is exactly the one-and-only change.
I got this via multidisabler when I rooted the device in the first place, as I can remember.
Now the problem is instead how I still got the loss-of-pairing problem after the patch. :D
Probably my ROM version is too "recent" and got new "features"?

Device is S9+ with Android 10 and ROM TGY-G9650ZHU7ETJ5_ALL.
 
Last edited:

bigpotato107

Member
Apr 25, 2011
36
2
I need this fix for rooted S21 as my buds pair flawlessly but my gear s2 will not. I USED THIS ON MY S20 worked like a charm

su
mount -o remount,rw /vendor
cp --preserve=all /vendor/etc/vintf/manifest.xml /vendor/etc/vintf/manifest.xml.bak
sed -i '/<.*security.wsm.*/,/<hal format="hidl">/d' /vendor/etc/vintf/manifest.xml
mount -o remount,ro /vendor

but on S21 it crashes my phone and have to factory reset have not tried this yet
su
mount -o remount,rw /vendor
i=`grep -lr 'security.wsm' /vendor/etc/vintf` && [ ! -z $i ] && [ $i != *.bak ] && cp --preserve=all $i $i.bak && sed -i '/<.*security.wsm.*/,/<hal format="hidl">/d' $i
mount -o remount,ro /vendor
would this work on the S21??
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    Done again but not working 😔

    Ahaha sorry dude.. again I pushed some crap on github.. you can look the latest commit
    It should be ok now. Hoping for your feedback will be good
    2
    I tried just now with the new zip file, it stills give me the same error.

    Sorry again.. I will look deeper on it.

    Im having the same problem. Were you able to fix it?

    You probably need to extend your vendor sub partition under the super partition and/or make it writable.
    I will ask for more infos on how to do that and probably add a guide here for S21 users.
    2
    Ahaha sorry dude.. again I pushed some crap on github.. you can look the latest commit
    It should be ok now. Hoping for your feedback will be good
    Perfect !

    Many thanks ;)
    photo_2021-04-02_18-54-17.jpg
    photo_2021-04-02_18-54-09.jpg
    2
    Please support my device Samsung Galaxy Tab A 10.1 (SM T510)

    Try it again. I just pushed an update which should handle your device

    It is imposible to patch S9 G960FXXUFFUC6 new base from march 31, 2021 fw update.

    I just saw your issue in github.
    It seems samsung makes more and more changes on the bluetooth library since few months..
    I will take a look asap.

    Hey @3arthur6 what's the latest changes on the build pushed today on magisk?

    Unfortunately not.. And I couldn't find relevant informations on your bluetooth logs.
    I could not explain your situation..
    Magisk module will never fix the gear watch issue. And no need for zip + magisk module.
    1
    but I can't install the zip from recovery

    Whoops try to download the zip again, I just silently updated it in line with magisk module samsung phones detection. It should be fine now

    I would like to understand how you got the /vendor folder to be writable.

    As I understand, the vendor partition is entirely full. @afaneh92 recovery seems to repartition the super partition containing system, vendor and some others to give some more space on vendor one.

    Ps. I assume I need to reapply this after every single update?

    Happy to hear it helps!
    Theoretically a script checks at each boot and reinstall the module if needed (ota or something). But a second reboot is needed in this case
  • 43


    Bluetooth Library Patcher





    This patch/module attends to avoid bluetooth pairings loss after reboot on rooted samsung devices.





    It handles most of samsung devices on android Nougat, Oreo, Pie, 10 and 11.


    This patch is NOT applicable with an aosp rom, only samsung stock/based.


    In case installation fails, please upload here the BluetoothLibPatcher-files.tar created in your internal storage.




    To fix Galaxy Wearable pairing issue, as the modifcations aren't applicable through Magisk :

    Either go to twrp flashable zip


    S21 serie owner need the twrp zip (for vendor partition resizing), terminal commands below could brick your device

    Or you can directly execute these commands from a terminal app, one line after another, then reboot :
    Code:
    su
    mount -o remount,rw /vendor
    i=`grep -lr 'security.wsm' /vendor/etc/vintf` && [ ! -z $i ] && [ $i != *.bak ] && cp --preserve=all $i $i.bak && sed -i '/<.*security.wsm.*/,/<hal format="hidl">/d' $i
    mount -o remount,ro /vendor



    • Link :

    - TWRP zip : BluetoothLibraryPatcher_2.2.4.zip
    - Mega
    - GDrive

    - Magisk module : Bluetooth Library Patcher module from Magisk Manager


    • Credits :

    - @topjohnwu for magisk and magiskboot used here for its easy-to-use hexpatcher
    - @afaneh92 for the vendor resizing script needed with S21 serie


    • Source & changelogs : Github BluetoothLibraryPatcher
    5
    Libbluetooth patcher

    Thanks a ton for this, i'm gonna test it right away. You da mvp! :highfive:
    LE: Works as expected on BSKO and S10+, thanks again!!!!!
    5
    Just added a magisk module :good:
    It works flawlessly on my N9 and does the same stuff as the twrp zip. So should works with all others devices.
    4

    That module really only works for Pie and earlier. It does, however, currently contain a hack, based on byte strings found by the author of this module, that allows libluetooth.so to be patched for Android 10 on S10 and N10 series devices, but this was added to allow an easy transition to Android 10 for users of those devices and will be removed in the next version.

    Users of Android 10 should really use this module, as it is more comprehensive and supports many more models of device.
    3
    Hello! I trying to install this for my S10e (G970F), but getting a library not supported error. I've attached the libbluetooth.so and build.prop if it's any help. Thanks!

    Hey
    Give it a new try, it should be fixed
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone