Welcome to CyanogenMod
|Welcome to our forum. Like most online communities you must register to post, but don't worry this is a simple free process that requires minimal information for you to signup. Be a part of the CyanogenMod Forum by signing in or creating an account. You can even sign in with your Facebook or Twitter account.
Posted 18 February 2011 - 01:52 PM
Link to thread on xda: http://forum.xda-dev...ad.php?t=896941
Recently, inspired by the progress with the camera, I started an "investigation" on how the FM radio actually works on out Tattoos. Unfortunately I am not able to continue working on that (not atleast until March), so I decided to share the information on the FM radio that I have so one of you folks can try to get it working.
The FM radio on Tattoo is handled by the BRF6350 chip. It is actually responsible mainly for the Bluetooth, but it also handles the FM radio. I've decided to search a bit more about the chip and found that TI has released a library (brflinux available here). That library is actually compiled in the bts daemon (the daemon responsible for both Bluetooth and FM radio on the official 1.6 ROMs). To function, this library also needs "an init script" that is a proprietary file called FMInit_300.bts under /system/etc/firmware/ .
The BRF6350 chip has analog audio output that is connected to a switch, controllable by the sysfs interface. That switch is accessable by the file /sys/class/htc_accessory/fm/flag . If you read from it you can see the current state, if you write to it you can change the current state. The file can handle the following strings:
"disable" - Turn off audio output by the BRF6350 chip
"fm_headset" - Turn on audio and send it to the headphones
"fm_speaker" - Turn on audio and send it to the phone speaker
When FM radio is off the switch should always be set to "disable" and when the radio is turned on the state should be set to "fm_headset" (atleast that is what is done on the official ROMs).
To detect if the headset is connected (that is your anthenna). You should read the following sysfs file /sys/class/switch/h2w/state a number is written there (in ASCII), that describes the state of the headset. The bits in that number have the following meaning:
#define BIT_HEADSET (1 << 0)
#define BIT_HEADSET_NO_MIC (1 << 1)
#define BIT_TTY_FULL (1 << 2)
#define BIT_FM_HEADSET (1 << 3)
#define BIT_FM_SPEAKER (1 << 4)
#define BIT_TTY_VCO (1 << 5)
#define BIT_TTY_HCO (1 << 6)
#define BIT_35MM_HEADSET (1 << 7)
atleast bits 0 or 1 and 7 should be set if the headset is connected.
After I had this basic info gathered, I began to search for application of all that.
In the following topic an interface is described that could be used for the FM radio on ROMs for our Tattoos. If we can connect the brflinux library to the JNI interface at the base of the new CyanogenMod FM radio application, we can have the radio up and running.
In fact the interfaces of the JNI library (at the base of the FM radio app) and the brflinux library are very similar so it would be quite possible.
Hope this was useful.
Rosti (a.k.a pisaro)
Posted 19 February 2011 - 02:01 AM
Posted 05 March 2011 - 10:07 PM
This is under wrork at this moment, so we will have radio miui in some days
Posted 30 March 2011 - 05:38 AM
Posted 30 March 2011 - 07:03 AM
Yeap, i second that. Luckily, I have headphones with volume control, as most mp3 player have that problem.