yashsingh1/xdaforums huggingface dataset:
[Spirit FM] mikereidis:
Folks:

I'm very happy with, and very much appreciate the reception my app has gotten.

But I have some decisions to make on how to allocate my time. I'm just one person, trying to do a task that Google rejected a year or so ago, due to lack of developer resources. (LOL.) And my life has been on hold the last several months so I need to spend a bit less time on this.

I spent much of today loading a new stock ROM on my DHD and trying, once again, to find some way of accessing HCI, but was again unsuccessful. So that's a full workday gone with no real results.

On my Legend, it took me 3 weeks to "reverse engineer" the audio routing issues, but I imagine I could do it faster now with the knowledge gained.

My point is that research and "reverse engineering" can be done, but it can take a LONG and indeterminate amount of time.

So I feel that I should probably concentrate on fixing and improving the basic app itself, and ask for "community support" in figuring out the requirements for operating on all the combinations of devices and ROMs. The lifecycle of smartphones is so short, I find it amazing; what 6-12 months ? At least there are many similarities between the generations.

I can try to provide some tools and documentation on what is required. I could create an API that simple drivers could be created for. I contrast simple with the elaborate Android FM API being created by SonyEricsson. BTW, I'll be happy to support that API just as soon as there is an Android phone supporting that API that I can beg, borrow or otherwise acquire.

Version 1 of my app had a relatively simple API provided by such shell script files as "on", "off", "tune", "volume set" etc. I could create a similar working API with working examples.

I'm happy to get your input on this, but I think most with an unsupported phone will likely want me to support that phone, and others will want specific features or improvements since their phone/ROM combo is working now.

I COULD freeze my app as it is now, with known and unknown bugs, and certain UI ugly spots, and a lack of certain features. I COULD spend the rest of my life trying to make various phone/ROM combos work and I'd never be finished.

But I think the approach I outline is better overall. Ask your ROM provider or other technically knowledgeable people how FM could be supported, as it is on those "other" phones.
[Spirit FM] Hotshot205:
Might have to check this app out
[Spirit FM] mikereidis:
A stock HTC ROM ? No it would very likely NOT work. Stock HTC ROMs don't have hcitool, nor any easy way I know of to access HCI.

If anyone could tell me how to access HCI on stock HTC ROMs the number of phones my app could work on would increase dramatically. The Wildfire has a Broadcom FM chip, which I DO support, but it also has a proprietary Broadcom BT stack, with, AFAICT, no Bluez library HCI support.
[Spirit FM] nibras_reeza:
I doubt it's the lack of signal. There are some stations where I live which are pretty strong. I don't get static even.

I will try the news update from y'day.
[Spirit FM] Talbes:
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.
[Spirit FM] mikereidis:
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.
[Spirit FM] 4silvertooth:
I confirm working of this FM on LG optimus one cm7. Beta 6.3 gingerbread 2.3.3 as before some one said its not working.

I can hear radio now with spoon fork as antenna with one spoke little inside headset plug. The RDS is not working though.. but may be we don't have RDS here.
[Spirit FM] mikereidis:
Version Sept. 11 is now on the Market: https://market.android.com/details?id=com.mikersmicros.fm

Relative to last mediafire Sept. 9 release:

- Fixed seek and background volume control for Galaxy 5 series devices.

- Debug VolPoke Off setting name changed to "Debug BCM 20780". Check/enable this on devices with BCM20780. May hang until enabled and power cycled.

Relative to last Market Aug. 31 release:

- Google ads removed. Please buy the Unlocker to support development.

- Headset/antenna required by default. Settings -> User Interface -> Antenna = Optional to disable.

- Broadcom Stereo blends to Mono with weak signals.

- Galaxy S speaker mode disabled with SamsungCM7.

- New Samsung Audio Methods for stock/derived ROMs.

- Support for BCM20780 devices such as Galaxy 5 series

enabled with Settings -> Debug -> BCM 20780. May hang until enabled and power cycled.

Please support continued development by purchasing the Unlocker: https://market.android.com/details?id=com.mikersmicros.fm_unlock

Paid customer requests and support have priority.

Thanks !
[Spirit FM] boran1:
View attachment sprt_debug.rar

Hi Mikey,

Since today I am using a unlocked Spirit FM radio without sound :-) It's just supporting Mikes unique project/application.

Here debug Spirit.

See please my early message.

Grt.
[Spirit FM] tzrchallenge:
I'll give it a try on a Nexus One
[Spirit FM] mikereidis:
I'll look at the file.
[Spirit FM] mikereidis:
New Sept 11b version is now on Market.

I fixed (hopefully) a crash/FC that happened on some devices.

I also re-enabled SamsungCM7 speaker support. A person running MIUI reported some new audio problem.
[Spirit FM] denzel09:
Thanks mike. No sound yet,, ;)

Go go go!!
[Spirit FM] Marsou77:
Test again on LG Optimus 2X running MiUi and it works fine, but no sound ... fuuuuu :(
[Spirit FM] mikereidis:
Yeah, I know it's frustrating... You could try setting the new Debug setting: "Debug BCM 20780". And then reboot and try all the Audio Methods. Try with BT on at start, as well as BT off.

I bought a new Samsung Galaxy S today. It has the same wonderful WM8994 audio chip. And I know what inputs are used for FM thanks to the schematic.

Now I just need a way to send the appropriate commands to the audio chip. I want to be cautious though, given the concerns about possible speaker issues.

If MIUI had libaudio code that set the FM audio path, then my app could use that. AFAIK though, the MIUI FM app doesn't run on this device, and libaudio is thus unlikely to have this support. Unless they are using the stock LG libaudio or similar...

If anyone can point me to a copy of the the stock LG FM app for Optimus 2X I could look at that.

Is there voodoo sound for O 2X on MIUI ? If there's a /sys/devices/virtual/misc/voodoo_sound/wm8994_write pseudo-file I could write commands there.

Beyond all that, I have the experimental Broadcom BT headset Audio Method sfu_sdcs_bt. It works on both my Broadcom phones, but nobody but me has reported it working.
[Spirit FM] mikereidis:
Thanks for the 2 logs. The biggest problem is that the sound drivers don't seem to support FM audio. You have /dev/msm_snd and this is the output:

m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 0 name: HANDSET

m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 1 name: SPEAKER

m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 2 name: HEADSET

m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 3 name: BT

m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 44 name: BT_EC_OFF

m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 10 name: HEADSET_AND_SPEAKER

m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 256 name: CURRENT

You need entries in that list like "FM", "FM_HEADSET" or "FM_SPEAKER" etc.

AFAICT your phone hardware supports FM. But the ROM audio library and kernel audio driver need to support switching on an FM audio path. If your ROM developer can add FM audio path support then we could enable it.

A digital audio solution would avoid ROM code changes. There is an experimental Audio Method "sfu_sdcs_bt" that can send low quality audio to a BT headset. In BT settings you would have to pair and connect. Then run my app with "sfu_sdcs_bt".

But nobody else has reported this working yet and I don't know if higher quality can be obtained.
[Spirit FM] mikereidis:
:)

See my posts on the GT-S5570 CM7 thread:

http://xdaforums.com/showpost.php?p=17492176&postcount=2353

http://xdaforums.com/showpost.php?p=17493642&postcount=2354
[Spirit FM] FadeFx:
Hi Mike, tested your app again after some days and have the problem of 'no sound in calls after spirit-fm' seamingly fixed by either you, latest fugumod or nightly 104... thanx for that if it was you... and if not to whom ever it was and to u for exciting app...

Edit: btw, there is some strange ticking audio while using your app, i remember the same occurred on older stock Samsung roms, and was fixed by some dev here, not sure if it was a kernel issue and fixed in speedmod kernel, or some other fix but i am sure it was connected to RDS...

----------------------------------------

tapatalked
[Spirit FM] mikereidis:
Great !

I have a Galaxy S again, so I'll be able to keep a closer eye on the latest CM nightlies.

I also want to get rid of this kluge that requires constantly sending silence audio files to the media player. The CM app does speaker/headset OK so I'll figure it out.
[Spirit FM] FadeFx:
Edited my last post while you answered...

----------------------------------------

tapatalked
[Spirit FM] mikereidis:
Why do you think it was connected to RDS ?

I don't hear any ticking, but my ears aren't the best. I'm on cm_galaxysmtd_full-104. What's the frequency of the ticking ?

AFAICT, the CM7 stock kernel has the same FM audio issues as the early Samsung kernels:

- Mono audio (one channel to both sides)

- Very limited frequency response (voice quality).

For both of these issues the SamsungCM7 audio method sends commands to the audio chip to fix.

So if early Samsung kernels had a ticking problem, yes I think there's a good chance the CM7 kernel has the same issue.

SamsungCM7 also (temporarily, as a workaround) continuously loops a silence audio file, every 30 seconds, in order to keep the audio path from shutting down. That might create some ticking.

While my app is running, you could run:

adb shell rm /data/data/com.mikersmicros.fm/files/s.flac

and that would kill this trick, at least until the next app powerup. Just tried this now and FM audio keeps going, for a few minutes at least (Maybe several 30s plays were queued). And the queueing/restart may cause ticks every 30s.
[Spirit FM] FadeFx:
The ticking is arround 3 to 5 hz so i guess it has nothing to do with the flac file. I knew it was connected to rds as it was not there when u either listened to a non rds station or disabled rds in settings. The ticking is at a constant low volume, so u will only hear it while silence or at low volume music passages oor while speach.

----------------------------------------

tapatalked
[Spirit FM] mikereidis:
OK, I can't hear it. I thought I heard something like that between stations, but it's still there when I turn RDS off.

I've changed the code now to turn RDS off when the app isn't on screen, as it is for other FM chips. So hopefully in the next version, this will be gone (Or it's not related to RDS being on.)

If the ticking is due to some bad WM8994 register setting, I should be able to fix it if I can learn which register and what data it needs.

I've also fixed the audio routing so it works like the CM FM app and doesn't require the silence sound hack. The downside is my app inherits some of the current libaudio FM issues.

I try to fix those and it works worse, so hopefully the CM libaudio will be fixed soon. The worst of this is that you might have to hit the Speaker/Headset button once or twice to get what you want sometimes.

I'll try to release this new version later tonight.
[Spirit FM] mikereidis:
Sept 13: http://www.mediafire.com/file/fpx1pr1225x9w3o/Spirit_FM_Radio_v110913.apk

Only Samsung Galaxy S changes in this version, compared to the vSept11b on the Market.

- RDS is turned off when app is not on screen.

- Revamped SamsungCM7 Audio Method should work better and without the silence hack. May require switching Speaker/Headset once or twice to get desired output.

This may not work on other Galaxy S ROMs such as MIUI. I've just tried the MIUI US 1.9.9 and audio is not functioning.
[Spirit FM] redline2097:
Please add a support for Galaxy S2. With batista rom 3.75 on a galaxy s2 i see the correct channels but music isn't playing.
[Spirit FM] mikereidis:
I'd love to. But enabling FM audio on new devices is a major challenge.

In theory, the SamsungStock or one of the other Samsung related Audio Methods should work on stock or stock derived ROMs. If not, and if someone can point me to a copy of the stock FM app, I could look to see if the audio routing secrets can be found.

For ROMs without the Samsung audio libraries, I don't know. It's a Yamaha audio chip, not the WM8994 in the original Galaxy. Supercurio doesn't seem interested in doing Voodoo sound for this chip.

The Galaxy S2 is much too expensive to fit into my budget. So unless someone with technical knowledge can help, I'm afraid it will be unsupported for a while.
[Spirit FM] kepke:
On I9000 I managed getting the market version to work on MIUI 1.9.9.

You need to use the default music player to play some music file and while it plays start the spirit FM with "Audio Method" - SamsungCM7 and "Volume Ctrl Stream" - Samsung FM then turn off the music player.

hope this helps
[Spirit FM] redline2097:
Here is a link to stock fm radio.apk http://db.tt/zY0brir

I would love to see Fm radio with Cyanogenmod 7. :)
[Spirit FM] mike_tbu:
Hi.

I have a problem om SE Xperia Mini Pro (not x10 mini pro!)

It displays this error message:

Compatibile chip not found

Fm:TI Sh:1 Su:0 Bt:1 Ht:0 H2:0 Mo:TIU
[Spirit FM] mikereidis:
I think the biggest problem is "Su: 0". This means that your device is NOT rooted, or SuperUser permission hasn't been granted to my app.

Unfortunately most devices require root for my app.

Also, "Ht:0" means there is no hcitool, which is one way my app can work even without root. But even then audio routing may not work without root.

Even if we can deal with these issues, some of the Xperia devices just don't work yet, for reasons yet to be determined.
[Spirit FM] mikereidis:
Thanks ! I will give that a shot. The MIUI ROMs are my current target for improvement now that CM7 seems OK.

The Market version Sept11b continuously plays a silent audio file when using SamsungCM7. So I'm not sure why your trick works and mine doesn't but I'll investigate. If my app could just play a short file that would be much better.

And thanks for noticing the new "Volume Ctrl Stream" option. I haven't mentioned it yet because it hasn't seemed to make much difference.

The mediafire Sept13 version won't work with MIUI unless some adb shell commands are used.
[Spirit FM] mikereidis:
Thanks !

So CM7 for Galaxy S2 doesn't have the CM FM app yet ? I've seen code in the repository, but it may not be working yet.

If/when they have added libaudio support for FM, there is a chance the Sept13 mediafire version of my app will work with the SamsungCM7 Audio Method:

http://www.mediafire.com/file/fpx1pr1225x9w3o/Spirit_FM_Radio_v110913.apk
[Spirit FM] kepke:
what commands?

let me try. ;)
[Spirit FM] mikereidis:
This adb shell command switches to and enables FM speaker:

/data/data/com.mikersmicros.fm/files/ssd 4 1 9 /dev/snd/controlC0 1

This one is for headset:

/data/data/com.mikersmicros.fm/files/ssd 4 1 9 /dev/snd/controlC0 2

In theory this should turn off the FM path but it never works:

/data/data/com.mikersmicros.fm/files/ssd 4 1 9 /dev/snd/controlC0 0

Sometimes the above doesn't work and for headset I must Go: Headset, Speaker, Headset like this:

/data/data/com.mikersmicros.fm/files/ssd 4 1 9 /dev/snd/controlC0 2

/data/data/com.mikersmicros.fm/files/ssd 4 1 9 /dev/snd/controlC0 1

/data/data/com.mikersmicros.fm/files/ssd 4 1 9 /dev/snd/controlC0 2

One thing that's strange is that doing this from a command line makes it stick. In the app the audio dies after a few seconds since the library thinks nothing is playing.

But I'm feeling like I'm about to give up on MIUI, both Galnet and US. I had both working for many hours this evening. Then I rebooted and nothing works ! Not even my old apps that used to work. And I switched for Galnet to US and the same thing. It's as if some hardware change happened.

I switch back to CM7 and everything is OK again. This is very perplexing.

I even managed to find a way to avoid the looping silence hack, but it sometimes caused a 2 second hang, and was sensitive to whether or not button clicks were audible.

The biggest problem is that MIUI doesn't support FM audio routing in their libraries. So I'm stuck trying to poke the ALSA driver which only partly works.

Anyway, I'll leave in the Audio Method I'm now calling "SamsungALSA", and it might work for some people, sometimes. But if it works at all, MIUI support is going to be a fragile hack unless someone can enlighten me about how to do this reliably on MIUI.

If/when MIUI supports their own FM app on this device, I can do what their app does. But AFAIK they've never updated their FM app for any chips except Broadcom.
[Spirit FM] xmguy:
Hey Mike you might check out the YouTube video I made that you linked too. Some people asked some questions I don't know the answers to.
[Spirit FM] nazimster:
Not working on Samsung Nexus S
[Spirit FM] FadeFx:
ud better link them to this thread...
[Spirit FM] kepke:
Thank you so much for the reply.

What audio method are you using to make this work? It did not work for me with 9/13.

Without any knowledge of android programing and how the SGS audio hardware works, it seems to me that on the market version when the radio is activate with these settings, the sample rate changes.

Maybe it explains why audio sounds on “fast forward” after that and the "other side" in calls can’t be heard.

Playing an audio file while activating the radio somehow forces the sample rate and audio turns out ok.

Well, that maybe the case or I’m just full of rubbish :cool:.

Anyway, thanks for trying ;).
[Spirit FM] mikereidis:
OK, thanks.

Yeah, the link to this thread seems sufficient. I'd offer my email address, except I don't know if there's a spam proof method for that.

It seems mostly questions about "Does it support my device/ROM?" or "Can you". Often my answer is just "Try it and see." If they can't spend 1-2 minutes to just load and try it, I'm not too excited to spend a few minutes or more searching for info.

My always incomplete support list is in post 2.

I don't want to spread myself too thin in various forums. And if you keep answering (sometimes the same) questions, you're just going to get more questions. (LOL).

I think I'm going to make my "Email Logs" function more hidden. It's amazing how many people will send me their logs, but they can't be bothered to say anything about their problem or device etc. EVEN when I reply back with a personalised message, after spending at least a few minutes looking over the logs.
[Spirit FM] mikereidis:
And I'm afraid it will never work.

The hardware connections just aren't there.
[Spirit FM] mikereidis:
It shouldn't matter, once the app is running. The command lines should make it work.

I've HAD this working, but yeah, for some reason it decided to stop. Weird.

Yes, the music player creates high pitched and fast paced "Chipmunk music" after my app has been run. And yet the exact same code and audio method work just fine on CM7.

Sample rate should ALWAYS be newly set every time a file is played.
[Spirit FM] roofrider:
@mike

i'm on s5570 on cm7 by tj...same as denzel09

tried wat u posted in our thread with the sep13 version and got this

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

>adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
S55703c6758d7 device

>adb shell
# killall mediaserver;/data/data/com.mikersmicros.fm/files/ssd 1 0
killall mediaserver;/data/data/com.mikersmicros.fm/files/ssd 1 0
FM analog audio enable utility vAugust 25
Copyright (c) 2011 Michael A. Reid. All rights reserved.
Mode: "1" (1)
Func: "0" (0)
Opening device /dev/msm_snd
snd_fd: 3
m1_do SND_GET_NUM_ENDPOINTS ioctl num_endpoints: 20
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 0 name: HANDSET
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 2 name: MONO_HEADSET
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 3 name: HEADSET
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 6 name: SPEAKER
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 8 name: TTY_HEADSET
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 9 name: TTY_VCO
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 10 name: TTY_HCO
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 12 name: BT
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 15 name: STEREO_USB
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 16 name: IN_S_SADC_OUT_HANDSET
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 17 name: IN_S_SADC_OUT_HEADSET
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 24 name: BT_CONFERENCE
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 25 name: IN_S_SADC_OUT_SPEAKER_P
HONE
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 26 name: FORCE_SPEAKER
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 27 name: FM_SPEAKER
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 29 name: NO_MIC_HEADSET
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 30 name: MEDIA_SPEAKER
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 31 name: MEDIA_STEREO_HEADSET
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 32 name: BT_NSEC_OFF
m1_do SND_GET_ENDPOINT ioctl snd_endpoint.id: 34 name: CURRENT
# killall mediaserver;/data/data/com.mikersmicros.fm/files/ssd 1 27
killall mediaserver;/data/data/com.mikersmicros.fm/files/ssd 1 27
FM analog audio enable utility vAugust 25
Copyright (c) 2011 Michael A. Reid. All rights reserved.
Mode: "1" (1)
Func: "27" (27)
Opening device /dev/msm_snd
snd_fd: 3
m1_do SND_SET_DEVICE ioctl ret: 0
#

but i didn hear any audio for a sec as u had said:(

maybe i shud try again? or libaudio needs to be updated once kernel.org is up again?