[Spirit FM] mikereidis:
http://www.mediafire.com/file/qzpbd5iezfm167k/FMRadio_v2017.zip

v2.0.17 finally adds support for a customisable audio routing mechanism. There are no other changes, so if audio is working OK for you, you can ignore this version.

If audio is NOT working for you, this version may not provide a fix in and of itself. Once the information is learned to route FM audio on your device, and perhaps a utility is created, this provides the framework to allow that custom solution to be integrated with the app. At some point, these custom solutions might be integrated into the app.

There IS a utility named "ssd" (Sound Set Device) included that should provide a possible solution for devices with msm7x30 (eg HTC Legend, LG P500), and devices with qsd8k / 8250 (eg HTC HD2).

Here's the help output for "ssd":

For msm7x30 (eg HTC Legend, LG P500)

1 9 = FM Headset

1 11 = FM Speaker

For qsd8k / 8250 (eg HTC HD2)

2 1 = Start FM

2 2 = Stop FM

2 3 = Set mid volume

2 4 = FM Headset

2 5 = FM Speaker

2 6 = Headset mic input

So, for example, to turn on the FM speaker on many devices you can use the command "adb shell ssd 1 11". If you get the error "Device or resource busy" you can ensure the radio is on and tuned to a good channel and then run from the adb shell "killall mediaserver ; adb shell ssd 1 11". If the speaker works briefly then we have a really annoying problem to solve, or you can switch to a ROM which doesn't do this.

There are 4 functions supported by the audio routing mechanism:

- Enable: Called on power up

- Disable: Called on power down

- Speaker: To route FM audio to the speaker.

- Headset: To route FM audio to the headset.

At this time there is no solution for problems caused by audio notifications "stealing" the audio routing. I have some ideas how this might be done for a later revision. But for now, you'd just have to disable those notifications, or manually re-select speaker or headset.

The Zip file contains two directories: a sprt.test directory filled with some of my test files, and a sprt directory set up for the HTC HD2 and similar devices. This command will put it in the right place:

adb push sprt /sdcard/sprt

There's a LOT of functionality in that directory now, but it's late and I'm just going to document the bare minimum. But DO leave all those "custom" files there or the customization of that directory and sub-directories will be lost/disabled.

The contents are setup for qsd8k / 8250 (eg HTC HD2). See farther down for more.

The file /sdcard/sprt/opt/aud/enable/post_su is executed as SU on power up and contains:

ssd 2 1

The file /sdcard/sprt/opt/aud/disable/post_su is executed as SU on power down and contains:

ssd 2 2

The file /sdcard/sprt/opt/aud/headset/post_su is executed as SU on headset selection and contains:

ssd 2 4

The file /sdcard/sprt/opt/aud/speaker/post_su is executed as SU on speaker selection and contains:

ssd 2 5

For msm7x30 (eg HTC Legend, LG P500) you can delete the /sdcard/sprt/opt/aud/enable/post_su and /sdcard/sprt/opt/aud/disable/post_su files.

Then enter in /sdcard/sprt/opt/aud/headset/post_su :

ssd 1 9

Then enter in /sdcard/sprt/opt/aud/speaker/post_su :

ssd 1 11

For stock and some stock derived HTC ROMs you could use:

/sdcard/sprt/opt/aud/enable/post_su

echo Nothing Needed Here

/sdcard/sprt/opt/aud/disable/post_su

echo disable > /sys/class/htc_accessory/fm/flag

/sdcard/sprt/opt/aud/headset/post_su

echo fm_headset > /sys/class/htc_accessory/fm/flag

/sdcard/sprt/opt/aud/speaker/post_su

echo fm_speaker > /sys/class/htc_accessory/fm/flag