From 21560c049e514b106da634ebdb05deb45915fc91 Mon Sep 17 00:00:00 2001 From: Marek Ventur Date: Wed, 29 Aug 2018 15:06:51 +0100 Subject: [PATCH] Add wpa enterprise to bootstrap.py/wifi.py --- .development/sync.py | 1 - bootstrap.py | 4 +++- lib/wifi.py | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.development/sync.py b/.development/sync.py index 5665873..b5e0d96 100644 --- a/.development/sync.py +++ b/.development/sync.py @@ -31,7 +31,6 @@ def sync(args, patterns, resources, verbose, skip_wifi): paths.add(path) if not found and (pattern not in paths): print("WARN: No resources to copy found for pattern %s" % patterns) - pyboard_util.soft_reset(args, verbose) pyboard_util.init_copy_via_repl(args) if not verbose: print("Copying %s files: " % len(paths), end="", flush=True) diff --git a/bootstrap.py b/bootstrap.py index 06d0c63..8aeed1c 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -57,7 +57,9 @@ def wifi_details(): def connect(): details = wifi_details() - if 'pw' in details: + if 'user' in details: + wifi.connect(details['ssid'], details['pw'], enterprise=True, entuser=details['user'], entmethod=wlan.EAP_METHOD_PEAP0_MSCHAPv2, entserverauth=False) + elif 'pw' in details: wifi.connect(details['ssid'], details['pw']) else: wifi.connect(details['ssid']) diff --git a/lib/wifi.py b/lib/wifi.py index c7e7e6a..566f8d5 100644 --- a/lib/wifi.py +++ b/lib/wifi.py @@ -68,7 +68,9 @@ def connect(wait=True, timeout=10, show_wait_message=False, prompt_on_fail=True, raise def connect_wifi(details, timeout, wait=False): - if 'pw' in details: + if 'user' in details: + nic().connect(details['ssid'], details['pw'], enterprise=True, entuser=details['user'], entmethod=wlan.EAP_METHOD_PEAP0_MSCHAPv2, entserverauth=False) + elif 'pw' in details: nic().connect(details['ssid'], details['pw']) else: nic().connect(details['ssid'])