Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,806,969 Members 37,638 Now Online
XDA Developers Android and Mobile Development Forum

Custom Bluetooth module for Nexus 5 (4.4.3) that works with BMW's ULF car kit

Tip us?
 
S1010
Old
#1  
Junior Member - OP
Thanks Meter 3
Posts: 1
Join Date: Jun 2014
Tutorial Custom Bluetooth module for Nexus 5 (4.4.3) that works with BMW's ULF car kit

Apologies for the links: as I am a new user, I am not allowed to directly link to outside sources. Please replace _ with :// or . (Forum suggestion: use optional pre-publication review for posts from new users that depend strongly on external links.)

INTRODUCTION: My BMW 318 (E46, 2004) had a factory default BMW ULF bluetooth module (early generation) that worked fine with my BB Q10 and all phones up to Android 4.1. From 4.2 onwards, I and many others have been having problems with keeping the Bluetooth connection alive for more than a few seconds. This has been widely reported but never addressed in stock Android. As even the latest OTA upgrade to 4.4.3 didn't solve it, I decided to compile the required Bluetooth kernel module myself.

BACKGROUND: The change from the Bluez to Bluedroid system in Android 4.2 caused the compatibility issues. User 'wulu' at the forums of CyanogenMod reported on how he patched his CM10.2 (and later) to include a patch that solves the issue. I repeated his procedure for stock 4.4.3 for the Nexus 5.
  • Markus Schmidt's problem description & patch: https_github_com/Root-Box/external_bluetooth_bluedroid/commit/97d2f6346bad56299f60cfcd8c45ad893a0da78c
  • Wulu's specifics for Nexus 5 & BMW's ULF for CM: http_forum_cyanogenmod_com/topic/77834-bluetooth-connection-drops-car-kit-bmw/
METHODS:
The following procedure is specifically to compiled the Bluetooth kernel module for the Nexus 5 hardware and the 4.4.3_r1.1 (OTA) release. It should therefore only work for this specific combination. If you want to compile the module yourself, please read the linked pages with Google's excellent instructions: http_source_android_com/source/initializing.html

Here are a couple of notes I made that deal with some specifics for my Mac and the Nexus 5:
  • On Mountain Lion (Mac), I had to use Xcode 5.0.2 to get past a compile error. See instructions here on how to download and use the older 5.0.2 version of Xcode: https_groups_google_com/forum/#!topic/android-building/FPCSo1xKJ4U
  • Do not download the "master" source using the repo command, but download "android-4.4.3_r1.1". The master source has post-OTA changes that make a compiled module incompatible with the OTA release for the Nexus 5. "android-4.4.3_r1.1" was listed on those pages as specifically the version that was used for the OTA 4.4.3 upgrade for the Nexus 5.
  • Setup the environment as instructed and add the three proprietary driver sets listed for the Nexus 5 and 4.4.3 (see "Building for devices" on the Google pages).
  • There is no need to use the full patch. You can make the two small modifications to the bta_ag_sdp.c file using any text editor. Find the file first (find . -name "bta_ag_sdp.c") and commend out the two lines with the minus signs given in wulu's the first post (or Markus Schmidt's patch) by putting a # in front of both lines: #if (p_scb->peer_features == 0), #p_scb->peer_features = p_attr->attr_value.v.u16;.
  • Select the "aosp_hammerhead-userdebug" (=Nexus 5) option with the lunch command, and compile using the make command. I was able to follow the instructions pretty much to the letter without any problems.
After the compilation I had two version of the file, in four locations. They are easily found using the find command (find . -name "bluetooth.default.so" -exec ls -la {} \;). The bigger one (in the symbols subdirectory) is for debugging. The smaller one is the one I used (and which is linked in this message). It was located at "./out/target/product/hammerhead/system/lib/hw/bluetooth.default.so" in my source tree.

After this, it was pretty straightforward. I rooted my Nexus 5, re-installed FX (with paid-for Root add-on, but the free ES File Explorer should also work), uploaded the file via Dropbox and its Save to SD, transferred it to the R/W mounted system directory to replace /system/lib/hw/bluetooth.default.so with it, and restarted my phone. I also modified the config file (/system/etc/bluetooth/auto_pair_devlist.conf) that blacklists BMW components by commenting out most lines, but I am not sure if this is helpful or not.

RESULTS: It seems a little bit less stable than the Bluetooth connection I had with my Blackberry, but it definitely works. I was able to transfer my contacts and to make and receive calls. For anybody with stock KitKat 4.4.3 on the Nexus 5, here is the bluetooth.default.so kernel module: http_s000_tinyupload_com/index.php?file_id=07750725920558658087

DISCUSSION: The compilation procedure can undoubtedly be optimized. I compiled the entire source tree over several hours, just to be sure I didn't miss out on things. Feel free to give tips, but I'm happy that it worked at all.

CONCLUSION: Thanks to wulu's advice in the CM forum thread I was able to compile a patched Bluetooth module for stock Android with KitKat 4.4.3 that works with my BMW 318 (E46, 2004) ULF car kit.
The Following 3 Users Say Thank You to S1010 For This Useful Post: [ Click to Expand ]
 
mnasty
Old
#2  
Junior Member
Thanks Meter 0
Posts: 1
Join Date: Jul 2014
Thatīs great!

Is it possible for you to provide the same for Nexus 5 - 4.4.4 OTA ?
 
ZeroKcm
Old
#3  
Junior Member
Thanks Meter 5
Posts: 18
Join Date: Jun 2013
Quote:
Originally Posted by mnasty View Post
Thatīs great!

Is it possible for you to provide the same for Nexus 5 - 4.4.4 OTA ?
Yes, great job!

Nobody have already done this for 4.4.4 ? I'll do this if I have time.
 
Lethargy
Old
#4  
Lethargy's Avatar
Senior Member
Thanks Meter 1,610
Posts: 2,901
Join Date: Jan 2014
Location: Sydney, Australia
Quote:
Originally Posted by ZeroKcm View Post
Yes, great job!

Nobody have already done this for 4.4.4 ? I'll do this if I have time.
4.4.4 from 4.4.3 is only security fixes, everything else is the same.
Quote:
Originally Posted by kyphur
You ask us to understand your position. Well if you want to benefit from our experience and time then I think it is only fair that you understand our position.
I actively add ignorant people to my ignore list.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes