![]() |
Re: Connect to Internet on demand & disconnect automatically, particularly for GPRS?
Quote:
|
Re: Connect to Internet on demand & disconnect automatically, particularly for GPRS?
Just a small battery regarding notice: With a similar script I end the day with about 80% battery. Mails are updated automatically every two hours, I use all kind of widgets like omweather. It's true that I don't speak that much at the telephone.
Before coding that script my battery was almost drained at the end of the day. I didn't expect wlan controller to be _that_ power unfriendly. |
Re: Connect to Internet on demand & disconnect automatically, particularly for GPRS?
Interesting, no wonder so many people are unsatisfied with the battery. It seems that the issue isn't the need for a larger battery but better power management...
|
Re: Connect to Internet on demand & disconnect automatically, particularly for GPRS?
Can we get a "latest and greatest" working version of that script slapped into a fresh thread or somewhere easily accessible in case modifcations/updates are made to it? I am interested in trying this out but would like to know which version is the one people are using with the most success at the moment.
|
Re: Connect to Internet on demand & disconnect automatically, particularly for GPRS?
well, this is what I'm using - based on a similar idea from his thread. Improvments are welcomed, I'm looking especially for "screen on" info in order to let he connection alive when screen is lit.
#!/bin/sh while true; do a=`tail -1 /proc/net/route | cut -f1` b=`grep wlan0 /proc/net/dev | cut -c 9-18` while [ "$a" = "wlan0" ] do c=`expr $b + 6000` sleep 180 b=`grep wlan0 /proc/net/dev | cut -c 9-18` d=`expr $b + 1` a=`tail -1 /proc/net/route | cut -f1` if [ "$d" -lt "$c" -a "$a" = "wlan0" ]; then echo Disconnecting dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true fi done sleep 180 done |
Re: Connect to Internet on demand & disconnect automatically, particularly for GPRS?
Quote:
string "on" "on" can also be "dimmed" and "off". I guess you can use dbus-scripts or something similar to have something happen upon the display state changing. |
Re: Connect to Internet on demand & disconnect automatically, particularly for GPRS?
Quote:
How to disconnect automatically from idle networks (3g/2g/wi-fi) UPDATED 09/02/10 SECOND UPDATE 09/02/10 - FIXED A FEW TYPOS THIRD UPDATE 09/02/10 - MADE THE INSTRUCTIONS MORE USER FRIENDLY UPDATED 10/02/10 - MADE IT START ONLY WHEN A CONNECTION IS ACTIVE SECOND UPDATE 10/02/10 - FIXED A TYPO... HAD FORGOTTEN A LINE THIRD UPDATE 10/02/10 - NO CHANGE TO THE SCRIPT OR MAIN INSTRUCTIONS, JUST TO THE EXTRA FUNCTIONALLITY INSTRUCTIONS Before you start, you'll need to install vim and rootfsh, both found in the extras repository. 1) In xterminal input Code:
sudo gainroot Code:
vim /usr/local/bin/autodisconnect Code:
#!/bin/sh Code:
chmod a+x /usr/local/bin/autodisconnect Code:
vim /etc/network/if-up.d/00_autodisconnect Code:
!#/bin/sh Code:
chmod a+x /etc/network/if-up.d/00_autodisconnect 9) Enjoy! Extra instructions for those looking specific funcionallity: a) If you want to disconnect only from wi-fi change line 5 Code:
while [ "$a" != "Iface" ] Code:
while [ "$a" == "wlan0" ] i) The constant (1000 in this case) in line 7 is about how many bytes must be receiven in a given period of time (the sleep time in line 9) to consider the connection in use. Anything less than that is considered idle. I also recomend a low number because I still don't know exactly how does it get along with idling in IM (but you still want to stay "Avalaible"). If you get randomly disconnected when idling in IM lower the value. ii) The sleep time in line 8 determines when you'll disconnect automatically. It will almost never be the exact time indicated. If you stop using your connection it should disconnect in a range of x to 2x seconds of the time set (x being the sleep time). Any questions feel free to post here. Hope it works for you. |
Re: Connect to Internet on demand & disconnect automatically, particularly for GPRS?
Is it normal that two instances of the Script are running? I don't know how things in event.d work, so I am just curious.
Code:
Nokia-N900-42-11:~# ps |grep auto |
Re: Connect to Internet on demand & disconnect automatically, particularly for GPRS?
Quote:
|
Re: Connect to Internet on demand & disconnect automatically, particularly for GPRS?
Hi there. I've been running the following script for now a week and it works pretty good on my device both with 3G and Wifi. Since it's the script I want to use in an application I am currently developping, if I could have some feedbacks, it would be great.
Thx! Code:
#!/bin/sh |
All times are GMT. The time now is 17:12. |
vBulletin® Version 3.8.8