From 07f1e49566997d901925c3114878cc83387810c6 Mon Sep 17 00:00:00 2001 From: Laukik Hase Date: Fri, 28 Jan 2022 09:39:31 +0530 Subject: [PATCH 1/2] provisioning: Remove legacy examples section from README --- examples/provisioning/README.md | 18 ------------------ tools/esp_prov/README.md | 9 ++------- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/examples/provisioning/README.md b/examples/provisioning/README.md index 7cdadadfcd..d165165e17 100644 --- a/examples/provisioning/README.md +++ b/examples/provisioning/README.md @@ -24,21 +24,3 @@ The Android and iOS provisioning applications allow the user to configure the de ``` The more details about QR code format, you can refer to [QR Code Scan](https://github.com/espressif/esp-idf-provisioning-android#qr-code-scan). - -## Legacy Examples - -The legacy examples require own implementation of provisioning functions and handlers. The Wi-Fi provisioning component abstracts out most of this complexity and provides a simpler interface and so, that is recommended for use. However, if you want to use lower level provisioning and protocomm APIs, you can check the these examples under legacy/ folder: - -* softap_prov - Provisioning involves Wi-Fi station configuration via an HTTP server running on the device, which is initially configured to be in SoftAP mode. After provisioning, device runs in Wi-Fi station mode only and connects to the AP whose credentials were provided during provisioning. - -* ble_prov - Provisioning involves Wi-Fi station configuration via BLE service endpoints running on the device initially. After provisioning, BLE is turned off and device runs in Wi-Fi station mode, connecting to the AP whose credentials were provided during provisioning. - -* console_prov - Provisioning involves Wi-Fi station configuration via UART console. This is intended for debugging protocomm and provisioning related features. - -* custom_config - Similar to softap_prov examples, but allows for configuration of custom (device-local) information during provisioning. This is intended as an example for implementing custom provisioning schemes. - -Refer to the README.md files in each example directory for more information. diff --git a/tools/esp_prov/README.md b/tools/esp_prov/README.md index 1ce4078ace..d36e26e27c 100644 --- a/tools/esp_prov/README.md +++ b/tools/esp_prov/README.md @@ -91,11 +91,6 @@ Run `pip install -r $IDF_PATH/tools/esp_prov/requirements_linux_extra.txt` # EXAMPLE USAGE -Please refer to the README.md files with the examples present under `$IDF_PATH/examples/provisioning/`, namely: +Please refer to the README.md file with the `wifi_prov_mgr` example present under `$IDF_PATH/examples/provisioning/`. -* `ble_prov` -* `softap_prov` -* `custom_config` -* `console_prov` - -Each of these examples use specific options of the `esp_prov` tool and give an overview to simple as well as advanced usage scenarios. +This example uses specific options of the `esp_prov` tool and gives an overview of simple as well as advanced usage scenarios. From 1481758fd7874f63c2522b8eaf4ee302d7bf7b74 Mon Sep 17 00:00:00 2001 From: Laukik Hase Date: Fri, 28 Jan 2022 10:36:10 +0530 Subject: [PATCH 2/2] esp_prov.py: Replaced deprecated function for loading modules --- tools/esp_prov/proto/__init__.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/esp_prov/proto/__init__.py b/tools/esp_prov/proto/__init__.py index 2000b4dad9..c94f37bdd3 100644 --- a/tools/esp_prov/proto/__init__.py +++ b/tools/esp_prov/proto/__init__.py @@ -2,13 +2,20 @@ # SPDX-License-Identifier: Apache-2.0 # +import importlib.util import os -from types import ModuleType +import sys +from importlib.abc import Loader +from typing import Any -def _load_source(name, path): # type: (str, str) -> ModuleType - from importlib.machinery import SourceFileLoader - return SourceFileLoader(name, path).load_module(name) +def _load_source(name, path): # type: (str, str) -> Any + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + sys.modules[spec.name] = module + assert isinstance(spec.loader, Loader) + spec.loader.exec_module(module) + return module idf_path = os.environ['IDF_PATH']