Permalink
Browse files

Sort netscheme -a list by link quality

  • Loading branch information...
1 parent 1ec1eda commit a38ea82d13cfa61b798e6e1d60a9e4842302ed6d @akkana committed Oct 21, 2012
Showing with 5 additions and 0 deletions.
  1. +4 −0 netscheme
  2. +1 −0 netutils.py
View
@@ -373,6 +373,7 @@ psk="%s"
def is_debian() :
# Ubuntu 12.04 Precise Pangolin has broken Debian-style networking,
# so check whether we're running it:
+ #return False
try :
lsb = open("/etc/lsb-release")
is_ubuntu = False
@@ -425,6 +426,9 @@ def print_current_scheme() :
def list_accesspoints(maxap=20) :
aplist = netutils.get_accesspoints()
+ # Sort the list be ap.quality
+ aplist.sort(cmp=lambda x,y: cmp(y.quality, x.quality))
+
print "Visible access points:"
for ap in aplist :
# Show mode if it's anything but Master -- e.g. Ad-hoc
View
@@ -488,6 +488,7 @@ def get_accesspoints() :
if not wiface and iface.wireless :
wiface = iface
if not wiface : # No wireless interface on this system
+ print "No wireless interface! Interfaces were", ifaces
return None
if not wiface.up :
wiface.ifconfig_up()

0 comments on commit a38ea82

Please sign in to comment.