maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   N900 Radio Transmitter: ways to amplify the radio signal (https://talk.maemo.org/showthread.php?t=38582)

DaveQB 2010-01-03 14:26

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Yep my idea works. I'll post a how-to tomorrow. Really need sleep now.

YoDude 2010-01-03 14:43

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by DaveQB (Post 451167)
Yep my idea works. I'll post a how-to tomorrow. Really need sleep now.

Looking forward to it mate... Thanks!

javispedro 2010-01-03 17:37

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
The best way to amplify the radio signal is (other than using headphones or even the USB cable) playing with "external" cables. Just wrapping a VGA cable does a lot here, but still, your mileage may vary...

twaelti 2010-01-03 18:41

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by optimaxxx (Post 449540)
have people covered the fact that the transmitter's digital?

It isn't digital. It's a classic analog FM transmitter, but includes RDS (Radio Data System) information. Your old car's radio doesn't have RDS, the new one has.

Arif 2010-01-03 20:36

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
It'd be nice if the FM transmitter strenght could be displayed/adjusted by the FM transmitter widget. :)

YoDude 2010-01-03 21:02

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by twaelti (Post 451498)
It isn't digital. It's a classic analog FM transmitter, but includes RDS (Radio Data System) information. Your old car's radio doesn't have RDS, the new one has.

Yup... The next thing to find is where the RDS info is stored so it can be personalized or even hacked to contain dynamic info passed from the media player or other apps.. :)

xmob 2010-01-03 21:27

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
I initially thought the same regarding the RDS. However, the PS field is only 8 characters and very few receivers support the RT field (64 characters).

It may be possible to do some clever scrolling in the 8 character PS field, but the RDS data rate is very slow (1187.5 bps).

qwerty12 2010-01-03 21:35

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by YoDude (Post 451639)
Yup... The next thing to find is where the RDS info is stored so it can be personalized or even hacked to contain dynamic info passed from the media player or other apps.. :)

http://maemo.org/packages/view/fmrdsnotify/

But it's no big secret; fmtxd provides a D-Bus interface for doing so; the above utilises it. There's also the preinstalled fmtx_client accessible from the X Terminal which also lets you set it, using that interface.

fmtxd does nothing special to set it, it just writes to a file in /sys.

YoDude 2010-01-03 22:30

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by qwerty12 (Post 451667)
http://maemo.org/packages/view/fmrdsnotify/

But it's no big secret; fmtxd provides a D-Bus interface for doing so; the above utilises it. There's also the preinstalled fmtx_client accessible from the X Terminal which also lets you set it, using that interface.

fmtxd does nothing special to set it, it just writes to a file in /sys.

Well there ya go, thanks.

Do you have any input on a means to change the transmitter output from the desktop.

DaveQB 2010-01-03 23:19

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Oh good one.

Well what I did was 3 things:

1. Become root, run visudo. In that text file [be careful] add line:
user ALL = NOPASSWD: /usr/local/bin/118
ie type
O
user ALL = NOPASSWD: /usr/local/bin/118
[ESC]
:x

2. Make a file "/usr/local/bin/118"
with contents:
Code:

#!/bin/sh
/bin/echo 118 > /sys/class/i2c-adapter/i2c-2/2-0063/power_level
exit 0

Then type:
Code:

chmod 755 /usr/local/bin/118
3. Add file:
/usr/share/applications/hildon/118.desktop
With contents:

Code:

[Desktop Entry]
Version=0.1
Type=Application
Name=118
Exec= /usr/bin/sudo /usr/local/bin/118
Icon=
X-Windows-Icon=
X-HildonDesk-ShowInToolbar=false
X-Osso-Type=application/x-executable

And now you have an app called 118 that does what you want.
I am not an expert on hildon *.desktop files and running this command waits for some sort of X feedback, so you need to multi-task out and it disappears.

Please someone tidy up that part of it.

DaveQB 2010-01-04 01:02

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by DaveQB (Post 451795)
Oh good one.

Well what I did was 3 things:

1. Become root, run visudo. In that text file [be careful] add line:
user ALL = NOPASSWD: /usr/local/bin/118
ie type
O
user ALL = NOPASSWD: /usr/local/bin/118
[ESC]
:x

2. Make a file "/usr/local/bin/118"
with contents:
Code:

#!/bin/sh
/bin/echo 118 > /sys/class/i2c-adapter/i2c-2/2-0063/power_level
exit 0

Then type:
Code:

chmod 755 /usr/local/bin/118
3. Add file:
/usr/share/applications/hildon/118.desktop
With contents:

Code:

[Desktop Entry]
Version=0.1
Type=Application
Name=118
Exec= /usr/bin/sudo /usr/local/bin/118
Icon=
X-Windows-Icon=
X-HildonDesk-ShowInToolbar=false
X-Osso-Type=application/x-executable

And now you have an app called 118 that does what you want.
I am not an expert on hildon *.desktop files and running this command waits for some sort of X feedback, so you need to multi-task out and it disappears.

Please someone tidy up that part of it.


I have put those two files you create in that in a tarball you get download onto the N900 directly.

So run this as root:

Code:

wget http://www.dward.us/software/118.tar
tar xf 118.tar

Now run ls and they will both be there, so now just run:

Code:

mv 118 /usr/local/bin/
mv 118.desktop /usr/share/applications/hildon/

HTH

ssjtoma 2010-01-04 01:06

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
I was trying to get the exact same thing running and it's great that someone got it working! =)

Anyway, I hit a bump trying to follow your steps:
Nokia-N900-42-11:~# visudo
visudo: no editor found (editor path = /bin/vi)

Any clue? I'm using an ssh connection and logged in as root.

DaveQB 2010-01-04 01:08

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by ssjtoma (Post 451943)
I was trying to get the exact same thing running and it's great that someone got it working! =)

Anyway, I hit a bump trying to follow your steps:
Nokia-N900-42-11:~# visudo
visudo: no editor found (editor path = /bin/vi)

Any clue? I'm using an ssh connection and logged in as root.

Oh ok, I thought that was just my N900.

Just link it to vim, you do have vim installed?

Code:

ln -s /usr/bin/vim /bin/vi

ssjtoma 2010-01-04 01:09

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by DaveQB (Post 451944)
Oh ok, I thought that was just my N900.

Just link it to vim, you do have vim installed?

Code:

ln -s /usr/bin/vim /bin/vi

No, but I'm installing it right now =)

ssjtoma 2010-01-04 01:20

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Nice. Works like a charm. I renamed it though to RadioHACK =)

DaveQB 2010-01-04 01:24

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by ssjtoma (Post 451954)
Nice. Works like a charm. I renamed it though to RadioHACK =)

Cool. There was a typo in my code with the untaring. I have edited and fixed that, sorry.

Now to make the GUI side effect much better.
I am installed the Maemo 5 SDK, so maybe I will make this a whole lot better and add a dialog box to say the command was successful.

ssjtoma 2010-01-04 01:29

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Haha nice. Don't forget to add the permission setting steps to your guide with the tar ball!

chmod 755 /usr/local/bin/118

;)

DaveQB 2010-01-04 01:32

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by ssjtoma (Post 451963)
Haha nice. Don't forget to add the permission setting steps to your guide with the tar ball!

chmod 755 /usr/local/bin/118

;)

That is the idea of the tarball; tar preserves unix perms, that's why I used that method.

debernardis 2010-01-04 07:11

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
I wrote to Pekka Ronkko, author of the simple-fmtx widget, to enclose the hack in the next version of his package. Best solution imho.

slavikko 2010-01-04 08:38

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Wrote the following quick & dirty script to use with desktop-cmd-exec

Create a file with the following code to /usr/local/bin/toggleradio.sh

Code:

#!/bin/bash
fmtx_client|grep disabled > /dev/null
if [ $? -eq 0 ]; then
  fmtx_client -p 1 > /dev/null
  fmtx_client -f 106900 > /dev/null
  echo 118 > /sys/class/i2c-adapter/i2c-2/2-0063/power_level
  echo "RF Enabled @106.90 with power `cat /sys/class/i2c-adapter/i2c-2/2-0063/power_level`"
else
  fmtx_client -p 0
  echo "RF Disabled"
fi
exit 0

chmod 755 /usr/local/bin/toggleradio.sh
add
Code:

user ALL = NOPASSWD: /usr/local/bin/toggleradio.sh
to /etc/sudoers

This will enable the rf transmitter if it's disabled and raise the power and disabled it if it's enabled. Configure desktop-cmd-exec to run it on click. The command line to insert to desktop-cmd-exec is 'sudo /usr/local/bin/toggleradio.sh'

Note, needs bash which you can get by
Code:

apt-get install bash
NOTE: there's seemingly a bug in the desktop-cmd-exec right now which causes it to run the script when you return to the desktop even though it's set to run on-click. I contacted the dev and hope that it'll be sorted out soon.

Made a new version of the script that's not dependent on bash & has some optional parameters to set the xmit power / freq
Code:

#!/bin/sh
#N900 FM transmitter toggler

#Establishing funtions
enableFM () {
  fmtx_client -p1 > /dev/null
  if [ $freq ]; then
        fmtx_client -f$freq > /dev/null
  fi
  echo $power > /sys/class/i2c-adapter/i2c-2/2-0063/power_level
  freq=`fmtx_client |grep frequency=|awk '{print int(substr($1,11))/1000};'`
  echo "RF Enabled @"$freq" with power `cat /sys/class/i2c-adapter/i2c-2/2-0063/power_level`"
  return 0
}

disableFM () {
  fmtx_client -p 0 > /dev/null
  echo "RF Disabled"
  return 0
}

usage () {
        echo "Usage:"
        echo " By default the script sets the power to 118 and does not mess with your default frequency, if you just run it."
        echo " Optional parameter one let's you define the transmission power manually"
        echo " Optional parameter two let's you define the frequency manually (eg. 106900 for 106.9)"
 exit 0
}



#Very simple command line parsing
case "$1" in
        [0-9]* )        power=$1;;
        [A-Za-z\-]* )  usage;;
        * )            power=118;;
esac
case "$2" in
        [0-9]* )        freq=$2;;
        * )
esac

fmtx_client|grep disabled > /dev/null
if [ $? = 0 ]; then
  enableFM
else
  disableFM
fi
exit 0


LozBlake 2010-01-04 10:15

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by DaveQB (Post 451934)
I have put those two files you create in that in a tarball you get download onto the N900 directly.

So run this as roo:

Code:

wget http://www.dward.us/software/118.tar
tar xf 118.tar

Now run ls and they will both be there, so now just run:

Code:

mv 118 /usr/local/bin/
mv 118.desktop /usr/share/applications/hildon/

HTH

Am i doing something wrong here, my n900 says wget not found??

Also by roo do you mean root?

I'm a complete novice by the way, sorry if this is all a bit obvious

slavikko 2010-01-04 11:31

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
root yes.
wget is not installed by default.
You can get it by running 'apt-get install wget' (as root)

Egres 2010-01-04 11:45

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by slavikko (Post 452221)
Note, needs bash which you can get by
Code:

apt-get install bash

AFAICS your script doesn't use any bash specific features. Can you check it's work with standard /bin/sh?

slcp 2010-01-04 13:10

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
hi, i have had success using echo in the terminal.

following the instructions from daveqb for a desktop shortcut for it has not worked...i have a desktop shortcut, however it is not making any changes.

I may have done something wrong, wanted to let you know though just in case!

slavikko 2010-01-04 14:22

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by Egres (Post 452366)
AFAICS your script doesn't use any bash specific features. Can you check it's work with standard /bin/sh?

Didn't work directly since it was a bit bashy, but I posted a new version in the original post that does not need sh.

yorg 2010-01-04 15:46

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
nice one!

it seems that frequency setting is disabled on my phone

I get:

"fmtx_client: ERROR: Unable to set frequency (Frequency is not currently allowed)"

or am I doing something wrong?

shadowjk 2010-01-04 16:06

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by xmob (Post 451659)
I initially thought the same regarding the RDS. However, the PS field is only 8 characters and very few receivers support the RT field (64 characters).

It may be possible to do some clever scrolling in the 8 character PS field, but the RDS data rate is very slow (1187.5 bps).

1187.5bps is, what, over 100 chars per second? so you could change the 8char field over 10 times per second? Sounds plenty fast to me.

Bratag 2010-01-04 16:07

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Messed around with the scripts a little and came up with some stuff that doesn't require any outside apps etc to work.

Edit a file called /opt/bin/boostfm.sh
Code:

!/bin/sh
STATE=`fmtx_client | grep state | cut -d '=' -f2`
if [ "disabled" = ${STATE} ]
then
  echo "Turning on FM transmitter"
  fmtx_client -p1
else
  echo "Turning off FM transmitter"
  fmtx_client -p0
fi
/bin/echo 118 > /sys/class/i2c-adapter/i2c-2/2-0063/power_level
exit 0

Now add the following to /etc/sudoers

Code:

user ALL = NOPASSWD: /opt/bin/boostfm.sh
Now create a file called BoostFM.desktop in /usr/share/applications/hildon which contains

Code:

[Desktop Entry]
Version=0.1
Type=Application
Name=BoostFM
Exec=osso-xterm 'sudo /opt/bin/boostfm.sh'
Icon=general_fm_transmitter
X-Windows-Icon=
X-HildonDesk-ShowInToolbar=false
X-Osso-Type=application/x-executable

This will open up an xterm, run the script and then close the xterm. It checks to see if the transmitter is on and will turn it off if it is. I used a standard system icon for the icon in the desktop file. All you need to now is put it as a shortcut on your desktop and its one tap on and off.

legoman666 2010-01-04 16:37

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
http://www.radio-locator.com/cgi-bin/vacant

ggroen 2010-01-04 17:08

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Sorry if this is asked before, I did some searching, but could not find it. Seems there are some experts on this thread..

Is there a way to use bluetooth for my Parrot carkit and use the FM tramsmitter as well? I find the N900 'seas' the Parrot as 'an earphone' and I get the music through bluetooth.. The volume is very low and I can't adjust it on Parrot or caraudio or N900! So I would like having a carkit and fm tfransmitter for my music. Thx!

cbock 2010-01-04 21:00

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by Bratag (Post 452651)
This will open up an xterm, run the script and then close the xterm. It checks to see if the transmitter is on and will turn it off if it is. I used a standard system icon for the icon in the desktop file. All you need to now is put it as a shortcut on your desktop and its one tap on and off.

If i use your Solution i get an xterm where i have to type in a Password.

So i just replaced the Exec-Line to "Exec= /usr/bin/sudo /usr/local/bin/boostfm.sh"

The only problem is that it starts a window with nothing in it and just the name BoostFM. If i switch to the Desktop it is gone and worked.
Don't know how to fix this problem.

greetings
Christopher

Bratag 2010-01-04 21:44

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by cbock (Post 453090)
If i use your Solution i get an xterm where i have to type in a Password.

So i just replaced the Exec-Line to "Exec= /usr/bin/sudo /usr/local/bin/boostfm.sh"

The only problem is that it starts a window with nothing in it and just the name BoostFM. If i switch to the Desktop it is gone and worked.
Don't know how to fix this problem.

greetings
Christopher

You didnt add the line to your suduoers file as shown in step II. You have to have that line otherwise you will get prompted

YoDude 2010-01-04 23:05

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Something broke!

I followed the instructions and everything went well... icon is present and when pushed window opens and closes. Tested it on the radio and it rocks!

I came back in to write this post and went to terminal to see what level it reports and couldn't gain root. :eek:

xTerm reports:

sudoers file: syntax error, line 75 <<<
sudo: parse error in etc/sudoers near line 75


Now Applications Manager reports "operation failed" and shows no catalogues installed.
Media player does not show any songs and will not close. :eek::eek:

I would hate to reflash. Is there anything I can try?


Quote:

Originally Posted by Bratag (Post 452651)
Messed around with the scripts a little and came up with some stuff that doesn't require any outside apps etc to work.

Edit a file called /opt/bin/boostfm.sh
Code:

!/bin/sh
STATE=`fmtx_client | grep state | cut -d '=' -f2`
if [ "disabled" = ${STATE} ]
then
  echo "Turning on FM transmitter"
  fmtx_client -p1
else
  echo "Turning off FM transmitter"
  fmtx_client -p0
fi
/bin/echo 118 > /sys/class/i2c-adapter/i2c-2/2-0063/power_level
exit 0

Now add the following to /etc/sudoers

Code:

user ALL = NOPASSWD: /opt/bin/boostfm.sh
Now create a file called BoostFM.desktop in /usr/share/applications/hildon which contains

Code:

[Desktop Entry]
Version=0.1
Type=Application
Name=BoostFM
Exec=osso-xterm 'sudo /opt/bin/boostfm.sh'
Icon=general_fm_transmitter
X-Windows-Icon=
X-HildonDesk-ShowInToolbar=false
X-Osso-Type=application/x-executable

This will open up an xterm, run the script and then close the xterm. It checks to see if the transmitter is on and will turn it off if it is. I used a standard system icon for the icon in the desktop file. All you need to now is put it as a shortcut on your desktop and its one tap on and off.


fnordianslip 2010-01-04 23:08

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
You could try ssh as root locally on the N900 or from something else, and fixing the /etc/sudoers file, assuming you have the ssh server running.

qwerty12 2010-01-04 23:10

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by YoDude (Post 453237)
Something broke!

I followed the instructions and everything went well... icon is present and when pushed window opens and closes. Tested it about:blankon the radio and it rocks!

I came back in to write this post and went to terminal to see what level it reports and couldn't gain root. :eek:

xTerm reports:

sudoers file: syntax error, line 75 <<<
sudo: parse error in etc/sudoers near line 75


Now Applications Manager reports "operation failed" and shows no catalogues installed.
Media player does not show any songs and will not close. :eek::eek:

I would hate to reflash. Is there anything I can try?

If you have rootsh installed (not the extras-devel version), run "rootsh /bin/sh" and you can remove the offending line from sudoers.

For future reference: Use visudo instead of editing sudoers directly. visudo tells you if a line will **** up the entire sudo system when exiting the editor.

DaveQB 2010-01-04 23:16

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by qwerty12 (Post 453247)

For future reference: Use visudo instead of editing sudoers directly. visudo tells you if a line will **** up the entire sudo system when exiting the editor.


EXACTLY!!
I was going to write that as I was reading through the last few [new] pages as alot of people are suggesting editing the file directly.

But now someone has made a good example of themselves for the benefit of the community.
Thanks YoDude ;)

YoDude 2010-01-04 23:38

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by DaveQB (Post 453256)
EXACTLY!!
I was going to write that as I was reading through the last few [new] pages as alot of people are suggesting editing the file directly.

But now someone has made a good example of themselves for the benefit of the community.
Thanks YoDude ;)

Yeah... I'm not sure what example was made :rolleyes:

Bratag 2010-01-04 23:52

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
I suspect people cut and paste the line and ended up with a blank line in their sudoers file. Sorry but the code tags seem to add a blank line wether I want it or not.

Agree with visudo comment. I actually used that myself guess I should have specified that. This is why I suck at writing docs

YoDude 2010-01-05 00:36

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by Bratag (Post 453301)
I suspect people cut and paste the line and ended up with a blank line in their sudoers file. Sorry but the code tags seem to add a blank line wether I want it or not.

Agree with visudo comment. I actually used that myself guess I should have specified that. This is why I suck at writing docs

The extra line was exactly what happened... NP, after all...

I finally learned this:


:D

I also learned that I made quite a few changes since I backed up last...

..and, if you package this up in a deb they will write songs about you. :)

It works and it adds so much value to the N900. The FM transmitter will now act as most expect it to and not the way it was shipped. Cheers.

As a bonus, if my Chinook & Diablo re-flashing history is a guide, this means a new firmware image will be available within the next two or three days :rolleyes:

Kind of like washing your car will make it rain. :D

jjx 2010-01-05 04:00

Re: N900 Radio Transmitter: ways to amplify the radio signal
 
Quote:

Originally Posted by shadowjk (Post 452650)
1187.5bps is, what, over 100 chars per second? so you could change the 8char field over 10 times per second? Sounds plenty fast to me.

The RDS signal carries more than just those 8 characters, so no.

But it might be fast enough to show "RINGING" when there's an incoming call and "YOUR MOM" when it's someone special :-)


All times are GMT. The time now is 02:15.

vBulletin® Version 3.8.8