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

Side by Side Diff: server/site_linux_router.py

Issue 1708018: Default to 802.11g instead of 802.11b when hw_mode is not specified. (Closed)
Patch Set: Created 10 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import re 5 import re
6 6
7 def isLinuxRouter(router): 7 def isLinuxRouter(router):
8 router_uname = router.run('uname').stdout 8 router_uname = router.run('uname').stdout
9 return re.search('Linux', router_uname) 9 return re.search('Linux', router_uname)
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 # hostapd configuration persists throughout the test, subsequent 53 # hostapd configuration persists throughout the test, subsequent
54 # 'config' commands only modify it. 54 # 'config' commands only modify it.
55 self.hostapd = { 55 self.hostapd = {
56 'configured': False, 56 'configured': False,
57 'file': "/tmp/%s.conf" % self.phydev, 57 'file': "/tmp/%s.conf" % self.phydev,
58 'driver': "nl80211", 58 'driver': "nl80211",
59 'conf': { 59 'conf': {
60 'ssid': defssid, 60 'ssid': defssid,
61 'interface': self.wlanif, 61 'interface': self.wlanif,
62 'bridge': self.bridgeif 62 'bridge': self.bridgeif,
63 'hw_mode': 'g'
63 } 64 }
64 } 65 }
65 66
66 # Kill hostapd if already running. 67 # Kill hostapd if already running.
67 self.router.run("pkill hostapd >/dev/null 2>&1", ignore_status=True) 68 self.router.run("pkill hostapd >/dev/null 2>&1", ignore_status=True)
68 69
69 # Remove all bridges. 70 # Remove all bridges.
70 output = self.router.run("%s show" % self.cmd_brctl).stdout 71 output = self.router.run("%s show" % self.cmd_brctl).stdout
71 test = re.compile("^(\S+).*") 72 test = re.compile("^(\S+).*")
72 for line in output.splitlines()[1:]: 73 for line in output.splitlines()[1:]:
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 for k, v in params.iteritems(): 140 for k, v in params.iteritems():
140 if k == 'ssid': 141 if k == 'ssid':
141 conf['ssid'] = v 142 conf['ssid'] = v
142 elif k == 'channel': 143 elif k == 'channel':
143 freq = int(v) 144 freq = int(v)
144 145
145 # 2.4GHz 146 # 2.4GHz
146 if freq <= 2484: 147 if freq <= 2484:
147 # Make sure hw_mode is set 148 # Make sure hw_mode is set
148 if conf.get('hw_mode') == 'a': 149 if conf.get('hw_mode') == 'a':
149 conf['hw_mode'] = 'b' 150 conf['hw_mode'] = 'g'
150 151
151 # Freq = 5 * chan + 2407, except channel 14 152 # Freq = 5 * chan + 2407, except channel 14
152 if freq == 2484: 153 if freq == 2484:
153 conf['channel'] = 14 154 conf['channel'] = 14
154 else: 155 else:
155 conf['channel'] = (freq - 2407) / 5 156 conf['channel'] = (freq - 2407) / 5
156 # 5GHz 157 # 5GHz
157 else: 158 else:
158 # Make sure hw_mode is set 159 # Make sure hw_mode is set
159 conf['hw_mode'] = 'a' 160 conf['hw_mode'] = 'a'
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 self.router.run("pkill hostapd >/dev/null 2>&1", ignore_status=True) 272 self.router.run("pkill hostapd >/dev/null 2>&1", ignore_status=True)
272 # self.router.run("rm -f %s" % self.hostapd['file']) 273 # self.router.run("rm -f %s" % self.hostapd['file'])
273 274
274 # Tear down the bridge. 275 # Tear down the bridge.
275 self.router.run("%s link set %s down" % (self.cmd_ip, self.bridgeif), 276 self.router.run("%s link set %s down" % (self.cmd_ip, self.bridgeif),
276 ignore_status=True) 277 ignore_status=True)
277 self.router.run("%s delbr %s" % (self.cmd_brctl, self.bridgeif), 278 self.router.run("%s delbr %s" % (self.cmd_brctl, self.bridgeif),
278 ignore_status=True) 279 ignore_status=True)
279 280
280 self.hostapd['configured'] = False 281 self.hostapd['configured'] = False
OLDNEW
« 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