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

Side by Side Diff: test/mm-poll-signal-strength

Issue 6731056: Update to test scripts to work with both ModemManager and Cromo (Closed) Base URL: ssh://gitrw.chromium.org:9222/flimflam.git@master
Patch Set: Fix review comments Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « test/mm-list-modems ('k') | test/mm-register » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
3 import re 7 import re
4 import sys 8 import sys
5 import time 9 import time
6 10
7 import dbus 11 import dbus
8 import mm 12 import mm
9 13
10 INTERFACES = ['interface_1_dbm', 'interface_2_dbm'] 14 INTERFACES = ['interface_1_dbm', 'interface_2_dbm']
11 15
12 TIME = 60 16 TIME = 60
13 SAMPLES = TIME * 2 17 SAMPLES = TIME * 2
14 18
15 19
16 manager = mm.ModemManager() 20 manager, path = mm.PickOneModem('')
17 path = mm.PickOneModem(manager, '')
18 simple_modem = manager.SimpleModem(path) 21 simple_modem = manager.SimpleModem(path)
19 22
20 strengths = [] # list of lists where list[i] is dbm for interface #i 23 strengths = [] # list of lists where list[i] is dbm for interface #i
21 start = time.time() 24 start = time.time()
22 finish = start + TIME 25 finish = start + TIME
23 26
24 for i in xrange(SAMPLES): 27 for i in xrange(SAMPLES):
25 next_reading_time = start + i * (float(TIME) / float(SAMPLES)) 28 next_reading_time = start + i * (float(TIME) / float(SAMPLES))
26 29
27 # Wait for next reading time 30 # Wait for next reading time
(...skipping 25 matching lines...) Expand all
53 sum([sample[interface] for sample in strengths]) / 56 sum([sample[interface] for sample in strengths]) /
54 float(len(strengths))) 57 float(len(strengths)))
55 58
56 output = ['%.1f' % x for x in [start] + means] 59 output = ['%.1f' % x for x in [start] + means]
57 output_string = '\t'.join(output) 60 output_string = '\t'.join(output)
58 61
59 print >> sys.stderr, ( 62 print >> sys.stderr, (
60 time.strftime('%a, %d %b %Y %H:%M:%S local: ', time.localtime()) + 63 time.strftime('%a, %d %b %Y %H:%M:%S local: ', time.localtime()) +
61 output_string) 64 output_string)
62 print output_string 65 print output_string
OLDNEW
« no previous file with comments | « test/mm-list-modems ('k') | test/mm-register » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698