Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(988)

Unified Diff: server/site_linux_router.py

Issue 3148006: Correctly auto-detect 2GHz and 5GHz phy devices (Closed) Base URL: ssh://gitrw.chromium.org/autotest.git
Patch Set: Changed comment Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/site_linux_router.py
diff --git a/server/site_linux_router.py b/server/site_linux_router.py
index 9636c9543e2d230bd4daad7c32920181b72fd2ee..5ed08fd6fdd2d2fdab10bd9cf687d25586c85177 100644
--- a/server/site_linux_router.py
+++ b/server/site_linux_router.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import logging, re
+from autotest_lib.client.common_lib import error
def isLinuxRouter(router):
router_uname = router.run('uname').stdout
@@ -32,20 +33,38 @@ class LinuxRouter(object):
# Network interfaces.
self.bridgeif = params.get('bridgedev', "br-lan")
- self.wiredif = params.get('wiredev', "eth1")
+ self.wiredif = params.get('wiredev', "eth0")
self.wlanif2 = "wlan2"
self.wlanif5 = "wlan5"
- # Default to 1st available wireless phy.
+ # Parse the output of 'iw phy' and find a device for each frequency
if "phydev2" not in params:
output = self.router.run("%s list" % self.cmd_iw).stdout
- test = re.compile("Wiphy (.*)")
+ re_wiphy = re.compile("Wiphy (.*)")
+ re_mhz = re.compile("(\d+) MHz")
+ in_phy = False
+ self.phydev2 = None
+ self.phydev5 = None
for line in output.splitlines():
- m = test.match(line)
- if m:
- self.phydev2 = m.group(1)
- self.phydev5 = self.phydev2
- break
+ match_wiphy = re_wiphy.match(line)
+ if match_wiphy:
+ in_phy = True
+ widevname = match_wiphy.group(1)
+ elif in_phy:
+ if line[0] == '\t':
+ match_mhz = re_mhz.search(line)
+ if match_mhz:
+ mhz = int(match_mhz.group(1))
+ if self.phydev2 is None and \
+ mhz in range(2402,2472,5):
+ self.phydev2 = widevname
+ elif self.phydev5 is None and \
+ mhz in range(5100,6000,20):
+ self.phydev5 = widevname
+ if None not in (self.phydev2, self.phydev5):
+ break
+ else:
+ in_phy = False
else:
raise error.TestFail("No Wireless NIC detected on the device")
else:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698