|
|
2010-01-31
, 20:01
|
|
Posts: 1,224 |
Thanked: 1,763 times |
Joined on Jul 2007
|
#82
|
|
|
2010-02-02
, 10:46
|
|
Posts: 284 |
Thanked: 75 times |
Joined on Nov 2009
|
#83
|
|
|
2010-02-06
, 09:00
|
|
Posts: 43 |
Thanked: 32 times |
Joined on Jan 2010
|
#84
|
vim /usr/local/bin/autodisconnect
#!/bin/sh
while true; do
sleep 60
a=`tail -1 /proc/net/route | cut -f1`
while [ "$a" == "wlan0" ]
do
b=`grep wlan0 /proc/net/dev | cut -c 8-12`
c=$b
sleep 180
b=`grep wlan0 /proc/net/dev | cut -c 8-12`
a=`tail -1 /proc/net/route | cut -1`
if [ "$b" == "$c" -a "$a" == "wlan0" ]; then
dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true
fi
c=$b
done
done
chmod a+x /usr/local/bin/autodisconnect
vim /etc/event.d/autodisconnect
description "Run a script to disconnect idle wi-fi"
start on started icd2
console none
script
/usr/local/bin/autodisconnect
end script
|
|
2010-02-07
, 17:11
|
|
Posts: 31 |
Thanked: 44 times |
Joined on Nov 2009
@ Czech Republic
|
#85
|
It is possible to activate it as icd2 idletimer support is still there in
fremantle but you will need kernel support activated.
This is not tested but should probably work:
- compile idletimer kernel module (IDLETIMER config option is in netfilter
configuration), the idletimer files are found in fremantle kernel sources
- install iptables + ipt_IDLETIMER module (take the sources from diablo and
compile)
- load the kernel module before icd2 starts
There is no UI for setting idletimer value. The idletimer settings are per
network type i.e.,
/system/osso/connectivity/network_type/WLAN_INFRA/idle_timeout for WLAN
(cellular network type is called GPRS) and the value is in seconds.
|
|
2010-02-07
, 18:42
|
|
Posts: 241 |
Thanked: 69 times |
Joined on Dec 2009
@ Germany
|
#86
|
|
|
2010-02-07
, 21:11
|
|
Posts: 43 |
Thanked: 32 times |
Joined on Jan 2010
|
#87
|
@azstunt: i tried your script because thats exactly what I was looking for. Unfortunatly it does not disconnect my wlan.
with "ps" i see 2 instances of the script running and there is "sleep 180" there also. so i think it recognizes the established connection. but it does not disconnect, waited for 30 minutes or so. my messengers are offline and mfe-setting is to check every 60 minutes.
#!/bin/sh
while true; do
sleep 10
a=`tail -1 /proc/net/route | cut -f1`
echo $a
b=`grep wlan0 /proc/net/dev | cut -c 8-19`
echo $b
while [ "$a" == "wlan0" ]
do
c=`expr $b + 1000`
echo $c
sleep 10
b=`grep wlan0 /proc/net/dev | cut -c 8-19`
echo $b
d=`expr $b + 1`
echo $d
a=`tail -1 /proc/net/route | cut -f1`
if [ "$d" -lt "$c" -a "$a" == "wlan0" ]; then
dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true
a=`tail -1 /proc/net/route | cut -f1`
sleep 5
fi
done
done
|
|
2010-02-07
, 22:07
|
|
Posts: 241 |
Thanked: 69 times |
Joined on Dec 2009
@ Germany
|
#88
|
Nokia-N900-42-11:/usr/local/bin# ./autodisconnectd
wlan0
125059300
125060300
125059300
125059301
125060300
125059300
125059301
Iface
125059300
Iface
125059300
Iface
125059300
Iface
125059300
Iface
125059300
Iface
125059300
Iface
125059300
Iface
125059300
^CNokia-N900-42-11:/usr/local/bin#
|
|
2010-02-07
, 22:14
|
|
Posts: 43 |
Thanked: 32 times |
Joined on Jan 2010
|
#89
|
it disconnected correctly. does it idle again or does it send the disconnect command continously?
I have to admit I dont fully understand your script. so do I change every sleep 10 to sleep 180 for normal use? what about the sleep 5? change to 60? then erase all echos-lines to surpress output? anything else to delete?
#!/bin/sh
while true; do
sleep 180
a=`tail -1 /proc/net/route | cut -f1`
b=`grep wlan0 /proc/net/dev | cut -c 8-19`
while [ "$a" == "wlan0" ]
do
c=`expr $b + 1000`
sleep 180
b=`grep wlan0 /proc/net/dev | cut -c 8-19`
d=`expr $b + 1`
a=`tail -1 /proc/net/route | cut -f1`
if [ "$d" -lt "$c" -a "$a" == "wlan0" ]; then
dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true
a=`tail -1 /proc/net/route | cut -f1`
sleep 5
fi
done
done
|
|
2010-02-07
, 22:31
|
|
Posts: 144 |
Thanked: 21 times |
Joined on Mar 2007
@ Finland
|
#90
|
![]() |
| Thread Tools | |
|
There are two basic approach to use N900 - use it as ACCESS device then you don't need an access to you from outside. In this case you can just set it "offline" in "Availability" button (not "Offline mode" - it switches of your cellphone totally ... battery lasts weeks). In this mode your batter would last around 48h, I estimate.
The second approach - stay connected with net/people as possible. In this case you want receive skype/gtalk/email and think about battery.