OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 """Connect to a WiFi service and report the amount of time it took | 3 """Connect to a WiFi service and report the amount of time it took |
4 | 4 |
5 This script initiates a connection to a WiFi service and reports | 5 This script initiates a connection to a WiFi service and reports |
6 the time to major state changes (assoc, config). If the connection | 6 the time to major state changes (assoc, config). If the connection |
7 fails within the desired time, it outputs the contents of the log | 7 fails within the desired time, it outputs the contents of the log |
8 files during that intervening time. | 8 files during that intervening time. |
9 | 9 |
10 """ | 10 """ |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 # If service isn't already connecting or connected, start now | 94 # If service isn't already connecting or connected, start now |
95 if (service.GetProperties()['State'] not in ('association', 'configuration', | 95 if (service.GetProperties()['State'] not in ('association', 'configuration', |
96 'ready')): | 96 'ready')): |
97 try: | 97 try: |
98 service.Connect() | 98 service.Connect() |
99 except dbus.exceptions.DBusException, e: | 99 except dbus.exceptions.DBusException, e: |
100 if e.get_dbus_name() == FLIMFLAM_ERROR_INPROGRESS: | 100 if e.get_dbus_name() == FLIMFLAM_ERROR_INPROGRESS: |
101 self.Debug('Service was already in progress (state=%s)' % | 101 self.Debug('Service was already in progress (state=%s)' % |
102 service.GetProperties().get('State')) | 102 service.GetProperties().get('State')) |
103 connect_quirks['in_progress'] = 1 | 103 connect_quirks['in_progress'] = 1 |
| 104 else: |
| 105 print 'FAIL(acquire): DBus exception in Connect() %s' % e |
| 106 ErrExit(2) |
104 | 107 |
105 self.service_handle = service | 108 self.service_handle = service |
106 return service | 109 return service |
107 | 110 |
108 def DoScan(self): | 111 def DoScan(self): |
109 self.scan_timeout = None | 112 self.scan_timeout = None |
110 self.Debug('Service not found; requesting scan...') | 113 self.Debug('Service not found; requesting scan...') |
111 try: | 114 try: |
112 manager.RequestScan('wifi') | 115 manager.RequestScan('wifi') |
113 except dbus.exceptions.DBusException, e: | 116 except dbus.exceptions.DBusException, e: |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 (acquire_time, wpa_select_time, assoc_time, config_time, | 253 (acquire_time, wpa_select_time, assoc_time, config_time, |
251 handler.frequency, handler.phymode, handler.security, | 254 handler.frequency, handler.phymode, handler.security, |
252 str(connect_quirks.keys()))) | 255 str(connect_quirks.keys()))) |
253 | 256 |
254 if connect_quirks: | 257 if connect_quirks: |
255 DumpLogs(logs) | 258 DumpLogs(logs) |
256 sys.exit(0) | 259 sys.exit(0) |
257 | 260 |
258 if __name__ == '__main__': | 261 if __name__ == '__main__': |
259 main(sys.argv) | 262 main(sys.argv) |
OLD | NEW |