Reply
Thread Tools
Posts: 543 | Thanked: 151 times | Joined on Feb 2010 @ Germany
#1
I look for a script / application which will automatically enable my internet connection via WiFI or 3G every 2-3 hours and disconnects it after 1-2 minutes.

Reason? Well I want to check my Skype messages every few hours, having it 24/7 enabled takes a lot of power.
 
Posts: 804 | Thanked: 1,598 times | Joined on Feb 2010 @ Gdynia, Poland
#2
About disconnecting, there is package:
http://maemo.org/packages/view/autodisconnect/
You can configure it via control panel, if you want to have this functionality in your program/script, just look into the sources and copy relevant code.

About auto connecting I'm not sure, but you may try https://garage.maemo.org/projects/auto-connect/ , but I don't know if it does exactly what you want (description says that it just tunes the time interval of network search for automatic internet connection, but you may check which gconf keys it checks, etc., so it may be good starting point). Did you attempt to search in Fremantle documetation? I think I've seen somewhere what should be done to connect to the network... The pseudo-code looked like:
1. get "Internet connection" > "allow phone to connect to nerwork by itself?" value from control panel (it is some gconf value afair)
2. set it to "always allow on any connection" (you may set it to "wlan" if you want to check only when wlan is available)
3. run some maemo command to connect to network (there is a library in Fremantle which you should use, normal call to e.g. "wget" or "ping" will fail, because Maemo needs to know you want to open internet connection, so it can actually connect first, see http://wiki.maemo.org/Documentation/...bConIC_Library for more information)
4. Do some stuff you want to do (so, in your case it would be "set skype account to active", "wait a minute", "set skype account to inactive")
5. Disconnect from the Internet
6. set "Internet connection" > "allow phone to connect to nerwork by itself?" value to the one read in point "1."

In fact, points 1 and 6 are optional, as they just guarantee that you don't change user's settings permamently.
 
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#3
Install 'Alarmed' it will let you run a script/command using a cron like specification without installing any new junk to run in the background.

So set a job that runs once every 3 hours to connect. Then either use 'auto disconnect' program or set another job to run every 3 hours to disconnect.

Easy!
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 
Posts: 804 | Thanked: 1,598 times | Joined on Feb 2010 @ Gdynia, Poland
#4
Originally Posted by vi_ View Post
Install 'Alarmed' it will let you run a script/command using a cron like specification without installing any new junk to run in the background.

So set a job that runs once every 3 hours to connect. Then either use 'auto disconnect' program or set another job to run every 3 hours to disconnect.

Easy!
Didn't know alarmed already had an option to connect to the Internet, my bad.
 
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#5
It doesn't, however it can run scripts.

Code:
#!/bin/sh
#connect
dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:"[ANY]" uint32:0

Code:
#!/bin/sh
#disconnect
dbus-send --print-reply --system --dest=com.nokia.icd2 /com/nokia/icd2 com.nokia.icd2.disconnect_req uint32:0x8000
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 

The Following User Says Thank You to vi_ For This Useful Post:
Posts: 235 | Thanked: 86 times | Joined on Dec 2010
#6
Is there a script to disable/enable built-in auto-connect?

I have a terrible signal reception, so auto-connect is not an option (or else, I'll end up with no connection every time it's accidentally disconnected).
But since I don't need internet connection when I'm asleep, I wish I can turn it off during the night and automatically re-enable it in the morning.
 
Posts: 95 | Thanked: 66 times | Joined on Mar 2012
#7
try these (attached) for auto connect.
make sure you have command line unzip utility.
also make sure you can run sudo gainroot (you need to root your n900).

put the zip file into your n900 in MyDocs folder.
open up an xterm.
type:
sudo gainroot
cd /opt/usr/bin
unzip /home/user/MyDocs/optusrbin.zip
chmod 755 n900netconnections*
chmod 644 n900netconnections*.cfg
chown root:root n900netconnections*
./n900netconnectionslist

the last command should output a long list of things.
if you want to autoconnect your 3G/GPRS, look for type=GPRS among those lines.
then look for the first line above type=GPRS, that starts with the text "/system" & has the text "IAP/".
copy the stuff after "IAP/" and replace line 2 of n900netconnections*.cfg with it.
replace line 1 of n900netconnections*.cfg with your MCC (Mobile Country Code) value.
you can get your MCC from an app called NetMon if i'm not mistaken (it's a GSM network monitoring app).

once done, set alarmed to run command below at times desired:
sh /opt/usr/bin/n900netconnectionsconnect

thanks to all the posts in talk.maemo.org!
Attached Files
File Type: zip optusrbin.zip (1.3 KB, 68 views)
 

The Following 2 Users Say Thank You to bozoid For This Useful Post:
Posts: 95 | Thanked: 66 times | Joined on Mar 2012
#8
i currently use that script to only auto connect to internet when not roaming & every 20 minutes between 7am to 11pm.
it actually gives me a bit better battery life!
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 00:33.