Does anyone know which module(s) make up the BT stack - I see libbluedroid.so, libbluetooth.so and libbluetoothd.so as well as the bluez-plugin in MIUI
I would try pulling the stack off a ROM that has the FM radio working and slip that into MIUI if I knew which modules are involved.
There are also the daemons:
adb shell "ps | grep -e bt -e blue"
root 263 2 0 0 c0094ce8 00000000 S bluetooth
bluetooth 1216 1 1292 744 c00f1b30 afd0eb0c S /system/bin/dbus-daemon
root 2205 2204 20016 2200 ffffffff afd0ec9c S /system/bin/btld
root 2221 1 1684 900 c00f1b30 afd0eb0c S /system/bin/bluetoothd
app_26 2370 1209 176364 22592 ffffffff afd0ec9c S com.android.bluetooth
system 2378 1209 175268 20856 ffffffff afd0ec9c S com.broadcom.bt.app.system
I'd guess dbus-daemon is generic, and perhaps bluetoothd, and maybe others. The hciattach is generic Bluez (but perhaps with a few mods). The TI equivalent seems to be btipsd, and for Broadcom, either brcm_patchram_plus or btld.
Then there's a few config files including /init*.rc
And perhaps there are some hooks into other parts of Android also...
I wish you luck but if it were easy, the open source Bluez stack would be regularly swapped in. It seems like a job more for ROM "chefs", and even they seem to often be baffled about this.
One nice thing about CM is that AFAICT just about everything is open source, whereas most stock ROMs, and many 3rd party ROMs, seem to use the proprietary TI or Broadcom stacks as binary blobs. What goes on inside btld is largely a mystery, betrayed/laid open in part mostly by the large volume of ascii strings inside.
The TI and Broadcom daemons seem to have LOTS of functions inside them, including many for FM control and monitoring. The HTC FM app seems to use these functions, and thus it is dependent on them; This may be one reason why HTC continues to use them. Nobody wants to re-write an app from "scratch", especially if they will have to maintain two apps/APIs for some time.
The HTC device specific functions are called from code in the android_runtime library. There are enough layers I get dizzy just thinking about them, LOL.
In theory I could rev-engineer the HTC FM APIs and have an app that would likely work on all stock, and many 3rd party, HTC(like) ROMs for all HTC phones. But thats too many undocumented functions to support that could change at any time, or be different on different devices in hard to determine ways.