Jump to content

ZTE Blade FM Radio chipset + CM7


Guest t0mm13b

Recommended Posts

Guest t0mm13b
Hey all ...

Any chance you could try out this simple program that I put together to work on nightly 28, specifically this version as the FM Radio chipset is loaded on boot... source an' all is there for you to glean on .... learn from it :D

Can you please push that out to /data/lost+found directory and chmod 0755 to the binary image zteblade_fmtest and run it through a series of tests to confirm that it does indeed work....?

The binary uses the venerable unix's getopts to process command line arguments, be aware, that the program is quite primitive in the sense no error checking is done, so don't bug me if it seg faults on your handset... :D lulz!

-0 switches off the radio (I darn bloody hope so.... :()
-1 switches on the radio ( ditto... ;))
-b (Band....????)
-a (Audio Track.... ????)
-v (Volume control... don't know what the max is....)
-f this returns the frequency (this seems stuck on 8750 ... guess its 87.5)
-t (Tune into a particular station... again... not sure exactly how this works)
-s (Seeks to the nearest next station depending on the direction, if its 0 it's from highest station to the nearest station lower than specified. If its 1, its from nearest station to the next highest station...)

Some of these I do not fully understand but hope someone can step forward and explain... :D

So give it a lash on this and have fun with it...

We may be able to incorporate this using the unix system calls via 'ioctl's which can easily be converted to a library for linking with the java frontend at runtime via dynamic linking.

Update: 24th March 2011.

I have pushed out a new daemon server source for this on github, it is heavily modified and much more simplified, have a look at the README on the github's project page. In effect, this will enable the java front end to be easily hooked up to this daemon, by sending commands to the pipe for input and the daemon will act on it.

At the moment the daemon works just fine under x86 Linux, I will be creating a clockworkmod shortly to flash the binary into a suitable location... perhaps /system/usr/share/ztebladefm? the pipes will have to be hardcoded to look in there for ease of communication...

Stay tuned to the channel B)

Update: 28th March 2011
The daemon is working... github has been updated, the posix regexps were at fault, and I recompiled and rebuilt the binary to link with the PCRE library - which I have included the configuration file for anyone who wishes to use the version for Android. The actual daemon binary is in the attached zip file. Extract and push that binary out to /data/local/tmp
Have at least three adb shell sessions
One adb logcat to keep an eye on the log.
invoke /data/local/tmp/pipecreate.sh by way of this command sh /data/local/tmp/pipecreate.sh
Now that you have the pipes created and made the binary world executable
invoke /data/local/ztebladefmd with no parameters
cat > /data/local/tmp/ztebladefmdCmds # to send commands
cat /data/local/tmp/ztebladefmdStats to show the results
Commands are as follows, with parameters expressed in square brackets, using a pipe symbol | to denote one or the other alternative:
ON - turn the radio on
OFF - turn the radio off
FREQUENCY - returns the current frequency..
SHUTDOWN - this shuts down the daemon and closes down neatly
TUNE
VOLUME
AUDIO - choose either STEREO or MONO
BAND
TUNESTEP
AUTOSEEK
Please note, it does not matter how much space or upper case/lower case requirement as the PCRE regexp will take care of dud inputs... its much more intuitive and simpler.

P.S: this script ztebladefmd_update.zip is untested, flash it with clockwork and you don't have to create the pipes or chmod the binary etc.... let me know how that goes

Disclaimer: You are on your own if smoke comes out of it, or blows your eardrums...erratic battery drains, etc... not my fault, nor am I responsible :P

It seems the run_program in the edify script is not 100% fully understood so I cheated by creating a simple shell script to take care of it... :P

Please provide the feedback to this thread so that we can tell what direction to take..... on this in featuring a FM Radio into this CM7... B)

Cheers bladers! Have phun and happy hacking! :D Edited by t0mm13b
Link to comment
Share on other sites

Guest t0mm13b
:D

Cheers Rotmann :(

GOOD NEWS....

proof of concept works, and the radio does indeed work thanks to TomG for his input and testing it out....

So... the FM Radio will be happening.... w00t!

Stay tuned folks... :D

Link to comment
Share on other sites

Guest giorgitus
GOOD NEWS....

proof of concept works, and the radio does indeed work thanks to TomG for his input and testing it out....

So... the FM Radio will be happening.... w00t!

Stay tuned folks... :D

You are simply a god...with radio CM7 is THE rom..

thank you so much

Link to comment
Share on other sites

Guest macher

What does mean 'rv' in program?

I always get back status 0. eg ./zteblade _fmtest -1 "[FM_INIT2NORMAL] - rw=0; status=0"

Edited by macher
Link to comment
Share on other sites

Guest t0mm13b
aaaaaaaaaa... I copied files to /data/lost+found and i changed chmod for binary file. How to execude binary file? Im using n28 :D

@macher: Great, nearly there in what you're doing, now, run it with these lines

# Comment here preceded by hash

./zteblade_fmtest -1 # turn on radio

./zteblade_fmtest -0 # turn off radio

./zteblade_fmtest -1 -b 0 -j 0 -s 1,8750 -v 10 -a 0

# switch to -b 0 (0 = Generic band, 1 = Japan Wide, 2 = Japan, 3 = reserved), -j 0 (0 = 50Khz frequency, 1= 100Khz, 2=200Khz - IIRC), -s dir,frequency (dir = 1 upwards, 0 = downwards, comma, frequency, in this example autoseek in upwards direction to hit on the next available station after 8750), -v pump up/down the volume (0 - mute, 15 is max AFAIK) -a 0 (Audio Track 0 - Stereo, 1 is mono) another parameter -t is to tune into a specific frequency, again, you can combine them all into one....


./zteblade_fmtest -f  

#shows the frequency - am aware it seems to "stick" to 8750, either a bug in the driver or what not....

Hit ctrl+C to end it... the sleep duration is for a while...

I am working on a simple client/server architecture so that we can have a server (daemon) running in the background and the java front end can send messages to the daemon and away we go....

Stay tuned til then folks :D

Link to comment
Share on other sites

Guest t0mm13b
What does mean 'rv' in program?

There's different function calls to control the chip, rv is a return value, a value of zero is good, any other value is bad! Simple really :D

The output you will get on the terminal, either by adb shell or on the actual terminal will show which functions were used - it's a simple proof of concept code to put together a new package specifically for CM7's Blade.... :D

Link to comment
Share on other sites

Guest t0mm13b
Thanks so much :D

Does that feature the Andorko patch for RDS?

AFAIK the andorko patch for RDS is not in place in TomG's github... will let him know about this once we have the basic functionality in place, then we'll integrate the RDS into it...

one step at a time baby... yeah... rock 'n' roll bladers :( :D

Link to comment
Share on other sites

Guest t0mm13b
so, this is a command radio? (not GUI)

I seriously do think you have not read this thread from start to finish... :D

it's a PROOF OF CONCEPT to get FMRadio working under CM7.... nothing more...

not for ordinary users to play with.... :D

The reason I asked for others to test it is because I am deaf and do not like radios as they affect me in a physiological way...

Link to comment
Share on other sites

Guest macher

I run this ./zteblade_fmtest -1 -b 0 -j 0 -s 1,8750 -v 10 -a 0 and alwys get

unknown option --v

. any ideas? And it shouldn't be status 1 if it turn on?

Edited by macher
Link to comment
Share on other sites

Guest t0mm13b
I run this ./zteblade_fmtest -1 -b 0 -j 0 -s 1,8750 -v 10 -a 0 and alwys get
unknown option --v

. any ideas? And it shouldn't be status 1 if it turn on?

Ahhhhh good catch! yeah I left out a C 'break' statement... :(

Thanks... pull down the updated binary and try again... it should work this time :D

Kudos for spotting the bug... thanks a mill :D

Link to comment
Share on other sites

Guest t0mm13b
They have another checksums but it make this same error, but i't shouldn't becouse source now i think is correct

Hmmm... did you overwrite the old binary in /data/lost+found? Just to be sure....

Here's the md5sum on the binary file itself

16783178f1550ad091a0a018f48666d7 zteblade_fmtest

(you can run it by entering md5sum zteblade_fmtest... if they don't match up let me know and I'll dropbox it... :D )

Link to comment
Share on other sites

Guest t0mm13b
i overwrote and even if I make new folder for it (/data/lost+found/1/) is still this same.

Hmmm.... try this attached file... beneath this posting.... to save your sanity.... wipe the binary and unzip it into the folder again... if you're still having problems... do not hesitate to drop a line :D

new_zteblade_fmtest_bin.zip

Link to comment
Share on other sites

Guest t0mm13b
Oh man... really i dont know why but it wont work.

All this from adb shell

  • su
  • cd /data/lost+found
  • chmod 0777 zteblade_fmtest
  • rm zteblade_fmtest
  • then push it in by way of unzipping then adb push zteblade_fmtest /data/lost+found
  • chmod 0755 /data/lost+found/zteblade_fmtest
  • cd /data/lost+found
  • ./zteblade_fmtest ....

disregard this... see the later posting below....

Edited by t0mm13b
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.