View Single Post
Posts: 856 | Thanked: 1,681 times | Joined on Apr 2010 @ Aleppo ,Syria
#2113
Originally Posted by vi_ View Post
That is correct (about the battery). Now for your next trick, adjusting wifi power...

When I am on my home wifi, I am always near the access point. Thus I do not need the full 100mW of wifi power. I can use just 10mW and still have perfect connection. Similarly, at work I am in the middle of 3 dd-wrt routers all cranking out 250mW of power, I can get away with just 2mW of wifi power there. Adjusting wifi power by the 'connections' settings is a pain in the testicles and cannot be done for each network separately...

In maemo (an most linux's) there is is a directory called /etc/network/if-up.d. Any scripts in this folder will be run as root whenever I 'connect'...

So, you create a file called:

Code:
/etc/network/if-up.d/50_wifiscripts
Containing:

Code:
#!/bin/sh
essid=$(iwgetid -s)

if [ "$essid" == "qwerty12" ]; then
	iwconfig wlan0 txpower 7
	echo $essid
elif [ "$essid" == "work" ]; then
	iwconfig wlan0 txpower 3
fi
This means when I connect to qwerty12 (home) or work the power is reduced appropriatley.


Similarly, at the other end:

Code:
/etc/network/if-down.d/50_wifiscripts
Containing:

Code:
#!/bin/sh
iwconfig wlan0 txpower 20
To put power back to max when I disconnect (so you can still connect to other networks).

You can stick other stuff in these directories too. For example, switch to work profile when I connect to work wifi.

This lets me stay connected to wifi all day without even batting an eyelid!
yep yep yep
vi_'s trick
 

The Following 2 Users Say Thank You to karam For This Useful Post: