Defy [MB525] - Enabling FM Transmitter

wizwin

Senior Member
Nov 22, 2010
192
212
0
Bangalore
www.winnyonnet.ml
Hi all,

I have enabled the FM transmitter on Motorola DEFY using the sample FM test application from omap3 git. Please note its not an apk that you can install and its NOT for users (its only test code).

I have not yet successfully transmitted any audio but there seems to be some hope that it can be done. (provided all the required internal circuitry is present)

After a few modifications (and some ugly hacks) to the FM app, I was able to switch to TX mode, power on and set a frequency (tune) for FM transmission. Logs show promising results but I have to confirm if it is enabled for real. I have attached the log to this post.

Currently I am stuck with audio routing to FM transmitter. The FM test app seems to use ALSA to setup and get the routing done for some dev board. For Defy I am not sure how to get it working. I have to dig a bit more into audio API's and libraries. Any ideas? Sample apps/code or API's to get this done?

Just did this over the weekend and I am planning to mess around with it a bit more.

-- WiZarD [Winny Mathew]
 

Attachments

snath83

Member
Dec 13, 2010
24
2
0
the way things are going for motorola defy, it looks set to become the n900 of maemo or htc hd2, i.e. a legendary smartphone - and thanks a ton you all modders!
Seems like motorola has released a pandora's box without they knowing it themselves (speaks volumes about motorola's miscalculations about market positioning of the phone - even eldar murtazin was impressed by moto defy!)

Also, it is sometimes funny how on some other forums, users seem to know more than official moto folks - let's take the example of defy possessing a graphics chip - users knew it long before moto forum representatives could confirm it. And now if the above post is true, defy might soon have FM transmitting capabilities! What a great day!
 
  • Like
Reactions: obscurant1st

obscurant1st

Senior Member
Dec 24, 2010
159
31
0
Bangalore
coolfacts.in
Sowhat you are saying is, defy has all the needed hardware for a FM transmitter? :eek:
now if its possible, man its huge!
So please keep uptodate with whats happening! love to hear them!

All XDA developers should look into it, together we can make this happen!
 

AgentSmith

Senior Member
Feb 22, 2006
764
174
0
One more hurdle of unlocking the bootloader and defy would become a legend.. :)
That is not just one hurdle, that is THE hurdle. No unlocked bootloader no legend. This phone, however promising it seemed, just isn't becoming the new HD2. I am still not entirely sure if I rather should have bought the HD2 in the first place. But for the moment the waterproof case still makes the Defy the better one for me.
 

domenukk

Senior Member
Jan 11, 2010
824
30
0
That is not just one hurdle, that is THE hurdle. No unlocked bootloader no legend. This phone, however promising it seemed, just isn't becoming the new HD2. I am still not entirely sure if I rather should have bought the HD2 in the first place. But for the moment the waterproof case still makes the Defy the better one for me.
Have both.
HD2 is the better computer, Defy the better phone. (Smaller screen yet more batterylife and outdoor capabilities
 

cocus

Senior Member
Feb 2, 2010
88
5
0
Rosario, Santa Fe, AR
Hi. I really dont get how to compile this. As far as I see, there are .cpp and .c files, so I think that they can be compiled with a simple gcc-armel. The thing is, I have to clone the entire GIT of omapzoom?
What I need to compile those? I have the SDK(working, aside the Java exception) and the NDK of android and nothing else.
 

wizwin

Senior Member
Nov 22, 2010
192
212
0
Bangalore
www.winnyonnet.ml
Hi all,

I was a bit busy, out of focus and travelling. I did search DEFY's source code (kernel and framework) to find how data could be routed to the transmitter. I did not find anything interesting yet. :(

Steps pending:

1. Find how FM Radio Rx (stock FM Radio app) gets its data routed to external and 3.5 mm speakers.

2. Find out if there is code to send data via Tx path, if not, is it possible to add the same. (which may involve recompiling the driver/kernel)

There are many output devices listed in kernel source code for audio. (in kernel/sound/oss/omap34xx_audio_driver.c and kernel/sound/oss/cpcap_audio_driver.h). I am not sure if any of the output devices could be used for sending data to FM Tx.


@cocus:
a. You can use NDK and some modifications to the Makefile and source to get it compiled.
b. No you don't have to clone the entire git.


I can post a patch of changes I have done but currently it is ugly :p
 
Last edited:

wizwin

Senior Member
Nov 22, 2010
192
212
0
Bangalore
www.winnyonnet.ml
Initial patch and dependencies for enabling Tx (Native test app only)

Hi all,

I have attached 'FM_TX.zip' which contains the source code patch, dependencies and a README.txt (attached outside as well). Using this you can build 'fmapp' for enabling and testing FM Tx on DEFY.

'README.txt' has more information on steps, setup and more TODOs :)

Let me try to figure out audio...

-- Winny Mathew
-- [WiZarD]
 

Attachments

  • Like
Reactions: Minus8

cocus

Senior Member
Feb 2, 2010
88
5
0
Rosario, Santa Fe, AR
Hi, thanks for your great post.
I've cloned the omap3 hardware path, and now I have the fm radio dir. Now, how do I apply the patch?
I've tryied this, but I get a lot of errors:
[email protected]:~/devfm/omap3/fmradio$ patch -p1 < ./fmradio.patch
(Stripping trailing CRs from patch.)
patching file Makefile
(Stripping trailing CRs from patch.)
patching file fm_app/fm_app.c
Hunk #1 FAILED at 49.
Hunk #2 FAILED at 1718.
Hunk #3 FAILED at 3510.
Hunk #4 FAILED at 3529.
Hunk #5 FAILED at 3578.
Hunk #6 FAILED at 3621.
Hunk #7 FAILED at 3635.
Hunk #8 FAILED at 3644.
Hunk #9 FAILED at 3657.
Hunk #10 FAILED at 3773.
Hunk #11 FAILED at 3781.
Hunk #12 FAILED at 3795.
Hunk #13 FAILED at 3805.
Hunk #14 FAILED at 3817.
Hunk #15 FAILED at 3931.
15 out of 15 hunks FAILED -- saving rejects to file fm_app/fm_app.c.rej
(Stripping trailing CRs from patch.)
patching file fm_app/fm_trace.h
Hunk #1 FAILED at 184.
1 out of 1 hunk FAILED -- saving rejects to file fm_app/fm_trace.h.rej
(Stripping trailing CRs from patch.)
patching file fm_stack/FM_Trace/fm_trace.h
Hunk #1 FAILED at 184.
1 out of 1 hunk FAILED -- saving rejects to file fm_stack/FM_Trace/fm_trace.h.rej
(Stripping trailing CRs from patch.)
patching file fm_stack/HSW_FMStack/stack/tx/fm_tx_sm.c
Hunk #1 FAILED at 2290.
Hunk #2 FAILED at 2648.
2 out of 2 hunks FAILED -- saving rejects to file fm_stack/HSW_FMStack/stack/tx/fm_tx_sm.c.rej
(Stripping trailing CRs from patch.)
patching file fm_stack/MCP_Common/Platform/inc/mcp_hal_config.h
Hunk #1 FAILED at 76.
1 out of 1 hunk FAILED -- saving rejects to file fm_stack/MCP_Common/Platform/inc/mcp_hal_config.h.rej
(im a noob in this stuff).

Thanks!
 
Last edited:

cocus

Senior Member
Feb 2, 2010
88
5
0
Rosario, Santa Fe, AR
Hey, thanks for your answer. Yes, that is what I did. Take a look here, I've listed the fmradio directory and there is the fmradio.patch with the other files from the GIT.

[email protected]:~/devfm/omap3/fmradio$ ls
Android.mk fm_app fmradio.patch fm_stack LICENSE.TXT Makefile
[email protected]:~/devfm/omap3/fmradio$ patch -p1 < fmradio.patch
(Stripping trailing CRs from patch.)
patching file Makefile
(Stripping trailing CRs from patch.)
patching file fm_app/fm_app.c
Hunk #1 FAILED at 49.
Hunk #2 FAILED at 1718.
Hunk #3 FAILED at 3510.
Hunk #4 FAILED at 3529.
Hunk #5 FAILED at 3578.
Hunk #6 FAILED at 3621.
Hunk #7 FAILED at 3635.
Hunk #8 FAILED at 3644.
Hunk #9 FAILED at 3657.
Hunk #10 FAILED at 3773.
Hunk #11 FAILED at 3781.
Hunk #12 FAILED at 3795.
Hunk #13 FAILED at 3805.
Hunk #14 FAILED at 3817.
Hunk #15 FAILED at 3931.
15 out of 15 hunks FAILED -- saving rejects to file fm_app/fm_app.c.rej
(Stripping trailing CRs from patch.)
patching file fm_app/fm_trace.h
Hunk #1 FAILED at 184.
1 out of 1 hunk FAILED -- saving rejects to file fm_app/fm_trace.h.rej
(Stripping trailing CRs from patch.)
patching file fm_stack/FM_Trace/fm_trace.h
Hunk #1 FAILED at 184.
1 out of 1 hunk FAILED -- saving rejects to file fm_stack/FM_Trace/fm_trace.h.rej
(Stripping trailing CRs from patch.)
patching file fm_stack/HSW_FMStack/stack/tx/fm_tx_sm.c
Hunk #1 FAILED at 2290.
Hunk #2 FAILED at 2648.
2 out of 2 hunks FAILED -- saving rejects to file fm_stack/HSW_FMStack/stack/tx/fm_tx_sm.c.rej
(Stripping trailing CRs from patch.)
patching file fm_stack/MCP_Common/Platform/inc/mcp_hal_config.h
Hunk #1 FAILED at 76.
1 out of 1 hunk FAILED -- saving rejects to file fm_stack/MCP_Common/Platform/inc/mcp_hal_config.h.rej


I've tryied your pre-compiled binary, but Im getting a very strange error. Ive pushed the binary to /sdcard, then with the console Ive copyied it to /system/data and when I wanted to chmod it:
chmod +x fmapp
Bad mode
With chmod 0755 it didnt say anything, but when I try to run it:
./fmapp
-sh: ./fmapp: No such file or directory
And the file is there!!!!!
 
Last edited:

wizwin

Senior Member
Nov 22, 2010
192
212
0
Bangalore
www.winnyonnet.ml
Hey, thanks for your answer. Yes, that is what I did. Take a look here, I've listed the fmradio directory and there is the fmradio.patch with the other files from the GIT.





I've tryied your pre-compiled binary, but Im getting a very strange error. Ive pushed the binary to /sdcard, then with the console Ive copyied it to /system/data and when I wanted to chmod it:


With chmod 0755 it didnt say anything, but when I try to run it:


And the file is there!!!!!
Try this:

[Host ] $ adb shell
[Device] $ su
[Device] # mkdir /data/tmp
[Device] # chmod 777 /data/tmp
[Device] # exit
[Device] $ exit
---- Up to here, needed only once ----
[Host ] $ adb push fmapp /data/tmp

Connect to phone over WiFi using 'putty' (install QuickSSHd or similar)

[Device] $ su
[Device] # cd /data/tmp
[Device] # chmod 777 fmapp
[Device] # ./fmapp
 
Last edited: