| OLD | NEW |
| 1 import dbus, dbus.mainloop.glib, gobject, logging, re, sys, time, subprocess | 1 import dbus, dbus.mainloop.glib, gobject, logging, re, sys, time, subprocess |
| 2 | 2 |
| 3 ssid = sys.argv[1] | 3 ssid = sys.argv[1] |
| 4 security = sys.argv[2] | 4 security = sys.argv[2] |
| 5 psk = sys.argv[3] | 5 psk = sys.argv[3] |
| 6 assoc_timeout = float(sys.argv[4]) | 6 assoc_timeout = float(sys.argv[4]) |
| 7 config_timeout = float(sys.argv[5]) | 7 config_timeout = float(sys.argv[5]) |
| 8 reset_timeout = float(sys.argv[6]) if len(sys.argv) > 6 else assoc_timeout | 8 reset_timeout = float(sys.argv[6]) if len(sys.argv) > 6 else assoc_timeout |
| 9 | 9 |
| 10 bus_loop = dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) | 10 bus_loop = dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 while wait_time < reset_timeout: | 67 while wait_time < reset_timeout: |
| 68 if service.GetProperties().get("State", None) == "idle": | 68 if service.GetProperties().get("State", None) == "idle": |
| 69 break | 69 break |
| 70 time.sleep(2) | 70 time.sleep(2) |
| 71 wait_time += 2 | 71 wait_time += 2 |
| 72 | 72 |
| 73 print>>sys.stderr, "cleared ourselves out of '%s' after %3.1f secs" % \ | 73 print>>sys.stderr, "cleared ourselves out of '%s' after %3.1f secs" % \ |
| 74 (init_state, wait_time) | 74 (init_state, wait_time) |
| 75 time.sleep(4) | 75 time.sleep(4) |
| 76 | 76 |
| 77 | 77 |
| 78 def TryConnect(assoc_time): | 78 def TryConnect(assoc_time): |
| 79 init_assoc_time = assoc_time | 79 init_assoc_time = assoc_time |
| 80 try: | 80 try: |
| 81 init_props = service.GetProperties() | 81 init_props = service.GetProperties() |
| 82 init_state = init_props.get("State", None) | 82 init_state = init_props.get("State", None) |
| 83 if init_state == "configuration" or init_state == "ready": | 83 if init_state == "configuration" or init_state == "ready": |
| 84 if assoc_time > 0: | 84 if assoc_time > 0: |
| 85 # We connected in the time between the last failure and now | 85 # We connected in the time between the last failure and now |
| 86 print>>sys.stderr, "Associated while we weren't looking!" | 86 print>>sys.stderr, "Associated while we weren't looking!" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 config_time += .5 | 211 config_time += .5 |
| 212 if config_time >= config_timeout: | 212 if config_time >= config_timeout: |
| 213 print "TIMEOUT(config): ssid %s assoc %3.1f config %3.1f secs" \ | 213 print "TIMEOUT(config): ssid %s assoc %3.1f config %3.1f secs" \ |
| 214 %(ssid, assoc_time, config_time) | 214 %(ssid, assoc_time, config_time) |
| 215 DumpLogs(logs) | 215 DumpLogs(logs) |
| 216 sys.exit(6) | 216 sys.exit(6) |
| 217 | 217 |
| 218 print "OK %3.1f %3.1f %s (assoc and config times in sec, quirks)" \ | 218 print "OK %3.1f %3.1f %s (assoc and config times in sec, quirks)" \ |
| 219 %(assoc_time, config_time, str(connect_quirks.keys())) | 219 %(assoc_time, config_time, str(connect_quirks.keys())) |
| 220 sys.exit(0) | 220 sys.exit(0) |
| 221 | |
| OLD | NEW |