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

Proposed by Adam Blackburn
Status: Merged
Approved by: Dan O'Reilly
Approved revision: 451
Merged at revision: not available
Proposed branch: lp:~adamblackburn/wicd/1.6-reconnect-dbm
Merge into: lp:wicd/1.6
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 Approve
Review via email: mp+10014@code.launchpad.net
To post a comment you must log in.
Revision history for this message
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.

Revision history for this message
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
=== modified file 'wicd/monitor.py'
--- wicd/monitor.py 2009-06-15 23:44:27 +0000
+++ wicd/monitor.py 2009-08-12 03:42:44 +0000
@@ -178,8 +178,8 @@
178 if not bssid:178 if not bssid:
179 return False179 return False
180180
181 wifi_signal = self._get_printable_sig_strength()181 wifi_signal = self._get_printable_sig_strength(always_positive=True)
182 if wifi_signal == 0:182 if wifi_signal <= 0:
183 # If we have no signal, increment connection loss counter.183 # If we have no signal, increment connection loss counter.
184 # If we haven't gotten any signal 4 runs in a row (12 seconds),184 # If we haven't gotten any signal 4 runs in a row (12 seconds),
185 # try to reconnect.185 # try to reconnect.
@@ -296,13 +296,20 @@
296 self.last_state = state296 self.last_state = state
297 return True297 return True
298298
299 def _get_printable_sig_strength(self):299 def _get_printable_sig_strength(self, always_positive=False):
300 """ Get the correct signal strength format. """300 """ Get the correct signal strength format. """
301 try:301 try:
302 if daemon.GetSignalDisplayType() == 0:302 if daemon.GetSignalDisplayType() == 0:
303 wifi_signal = int(wireless.GetCurrentSignalStrength(self.iwconfig))303 wifi_signal = int(wireless.GetCurrentSignalStrength(self.iwconfig))
304 else:304 else:
305 wifi_signal = int(wireless.GetCurrentDBMStrength(self.iwconfig))305 if always_positive:
306 # because dBm is negative, add 99 to the signal. This way, if
307 # the signal drops below -99, wifi_signal will == 0, and
308 # an automatic reconnect will be triggered
309 # this is only used in check_for_wireless_connection
310 wifi_signal = 99 + int(wireless.GetCurrentDBMStrength(self.iwconfig))
311 else:
312 wifi_signal = int(wireless.GetCurrentDBMStrength(self.iwconfig))
306 except TypeError:313 except TypeError:
307 wifi_signal = 0 314 wifi_signal = 0
308315

Subscribers

People subscribed via source and target branches

to status/vote changes: