Merge lp:~adamblackburn/wicd/1.6-reconnect-dbm into lp:wicd

Proposed by Adam Blackburn on 2009-08-12
Status: Merged
Approved by: Dan O'Reilly on 2009-08-12
Approved revision: 451
Merged at revision: not available
Proposed branch: lp:~adamblackburn/wicd/1.6-reconnect-dbm
Merge into: lp:wicd
Diff against target: None lines
To merge this branch: bzr merge lp:~adamblackburn/wicd/1.6-reconnect-dbm
Reviewer Review Type Date Requested Status
Dan O'Reilly 2009-08-12 Approve on 2009-08-12
Review via email: mp+10014@code.launchpad.net
To post a comment you must log in.
Adam Blackburn (adamblackburn) wrote :

This branch fixes automatic reconnect when using dBm to measure signal strength. When the signal drops below -99 dBm, a rescan/reconnect will be triggered.

Dan O'Reilly (oreilldf) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'wicd/monitor.py'
2--- wicd/monitor.py 2009-06-15 23:44:27 +0000
3+++ wicd/monitor.py 2009-08-12 03:42:44 +0000
4@@ -178,8 +178,8 @@
5 if not bssid:
6 return False
7
8- wifi_signal = self._get_printable_sig_strength()
9- if wifi_signal == 0:
10+ wifi_signal = self._get_printable_sig_strength(always_positive=True)
11+ if wifi_signal <= 0:
12 # If we have no signal, increment connection loss counter.
13 # If we haven't gotten any signal 4 runs in a row (12 seconds),
14 # try to reconnect.
15@@ -296,13 +296,20 @@
16 self.last_state = state
17 return True
18
19- def _get_printable_sig_strength(self):
20+ def _get_printable_sig_strength(self, always_positive=False):
21 """ Get the correct signal strength format. """
22 try:
23 if daemon.GetSignalDisplayType() == 0:
24 wifi_signal = int(wireless.GetCurrentSignalStrength(self.iwconfig))
25 else:
26- wifi_signal = int(wireless.GetCurrentDBMStrength(self.iwconfig))
27+ if always_positive:
28+ # because dBm is negative, add 99 to the signal. This way, if
29+ # the signal drops below -99, wifi_signal will == 0, and
30+ # an automatic reconnect will be triggered
31+ # this is only used in check_for_wireless_connection
32+ wifi_signal = 99 + int(wireless.GetCurrentDBMStrength(self.iwconfig))
33+ else:
34+ wifi_signal = int(wireless.GetCurrentDBMStrength(self.iwconfig))
35 except TypeError:
36 wifi_signal = 0
37

Subscribers

People subscribed via source and target branches

to status/vote changes: