Jump to content

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.
  • Start new topics and reply to others
  • Subscribe to topics and forums to get automatic updates
  • Get your own profile and make new friends
  • Download files attached to the forum.
  • Customize your experience here
  • Share your CyanogenMod experience!
Guest Message by DevFuse
 

FM Radio


  • Please log in to reply
5 replies to this topic

#1 finnk

finnk
  • Members
  • 24 posts
  • Country:
    dk - Denmark
  • Location:
    Copenhagen
  • Device Model:
    HTC Click/Tattoo
  • CM Version:
    CM7.1 nightly
  • Recovery Image:
    ClockworkMod

Posted 18 February 2011 - 01:52 PM

Pisaro posted the following on xda-developers, but not in the android development section. It might help with the FM development. Hope its allright to post it here :)
Link to thread on xda: http://forum.xda-dev...ad.php?t=896941

**********Start quote*************
Hi All,

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.

Cheers,
Rosti (a.k.a pisaro)

**********End quote*************

#2 sunitknandi

sunitknandi
  • Members
  • 20 posts
  • Device Model:
    HTC Tattoo
  • CM Version:
    0
  • Recovery Image:
    Amon_RA

Posted 19 February 2011 - 02:01 AM

Yea. I noticed this earlier. Anyway, who's making FM radios for Cyanogenmod here? Maybe that guy can help.

#3 KalimochoAz

KalimochoAz

    HTC Tattoo Moderator

  • Members
  • 67 posts
  • Country:
    es - Spain
  • Device Model:
    Tattoo / Nexus S
  • CM Version:
    CyanogenMod 7.x
  • Recovery Image:
    Cyanogen

Posted 05 March 2011 - 10:07 PM

View Postsunitknandi, on 19 February 2011 - 02:01 AM, said:

Yea. I noticed this earlier. Anyway, who's making FM radios for Cyanogenmod here? Maybe that guy can help.

This is under wrork at this moment, so we will have radio miui in some days

#4 jovanz

jovanz
  • Members
  • 12 posts
  • Country:
    rs - Serbia
  • Device Model:
    HTC Tatoo
  • CM Version:
    CM 7 RC4.1
  • Recovery Image:
    ClockworkMod

Posted 07 March 2011 - 02:20 AM

Great News. :)

#5 sunitknandi

sunitknandi
  • Members
  • 20 posts
  • Device Model:
    HTC Tattoo
  • CM Version:
    0
  • Recovery Image:
    Amon_RA

Posted 30 March 2011 - 05:38 AM

hey guys, the fm radio volume with the earphones is too loud with even with the first level. Please fix this problem, my ears are aching.

#6 EowynCarter

EowynCarter
  • Members
  • 31 posts
  • Country:
    fr - France
  • Device Model:
    Zero, Tattoo
  • CM Version:
    7
  • Recovery Image:
    ClockworkMod

Posted 30 March 2011 - 07:03 AM

View Postsunitknandi, on 30 March 2011 - 05:38 AM, said:

hey guys, the fm radio volume with the earphones is too loud with even with the first level. Please fix this problem, my ears are aching.

Yeap, i second that. Luckily, I have headphones with volume control, as most mp3 player have that problem.