diff --git a/docs/guides/bouffalolab/matter_factory_data.md b/docs/guides/bouffalolab/matter_factory_data.md index eeb5fe0cc6149b..d3c5504e89622f 100644 --- a/docs/guides/bouffalolab/matter_factory_data.md +++ b/docs/guides/bouffalolab/matter_factory_data.md @@ -22,10 +22,10 @@ size0 = 0x1000 ``` To enable matter factory data feature, please append `-mfd` option at end of -target name. Take BL616 Wi-Fi Matter Light as example. +target name. Take BL602 Wi-Fi Matter Light as example. ``` -./scripts/build/build_examples.py --target bouffalolab-bl616dk-light-wifi-mfd build +./scripts/build/build_examples.py --target bouffalolab-bl602dk-light-littlefs-mfd build ``` ## Factory data @@ -115,6 +115,7 @@ Please reference to `--help` for more detail. - Run following command to generate all plain text factory data + Please create output folder first. Here takes `out/test-cert` as example. ```shell ./scripts/tools/bouffalolab/generate_factory_data.py --output out/test-cert ``` diff --git a/docs/guides/index.md b/docs/guides/index.md index 14d9caf7e21839..61641d1de74565 100644 --- a/docs/guides/index.md +++ b/docs/guides/index.md @@ -23,6 +23,7 @@ ti/ti_matter_overview - [Android - Building](./android_building.md) - [Apple - Testing with iPhone, iPad, macOS, Apple TV, HomePod, Watch, etc](./darwin.md) - [ASR - Getting Started Guide](./asr_getting_started_guide.md) +- [Bouffalo Lab - Matter factory data generation](./bouffalolab/matter_factory_data.md) - [Espressif (ESP32) - Getting Started Guide](./esp32/README.md) - [Infineon PSoC6 - Software Update](./infineon_psoc6_software_update.md) - [Linux - Simulated Devices](./simulated_device_linux.md) diff --git a/examples/lighting-app/bouffalolab/README.md b/examples/lighting-app/bouffalolab/README.md index 199755c7e628ad..b9b3d1501ddc7c 100644 --- a/examples/lighting-app/bouffalolab/README.md +++ b/examples/lighting-app/bouffalolab/README.md @@ -114,18 +114,18 @@ The following steps take examples for `BL602DK`, `BL704LDK` and `BL706DK`. - `-wifi`, specifies to use Wi-Fi for Matter application. - - BL602 uses Wi-Fi by defualt. `-wifi` could be elided. + - BL602 uses Wi-Fi by default. `-wifi` could be elided. - BL702 needs it to specify to use BL706 + BL602 for Wi-Fi. - `-thread`, specifies to use Thread for Matter application. - - BL70X uses Thread by defualt. `-thread` could be elided. + - BL70X uses Thread by default. `-thread` could be elided. - `-ethernet`, specifies to use Ethernet for Matter application. - BL706 needs it to specify to use Ethernet. -- `-littlefs`, specifies to use littlefs for flash access. +- `-littlefs`, specifies to use `littlefs` for flash access. - `-easyflash`, specifies to use `easyflash` for flash access. - for platform BL602/BL70X, it is necessary to specify one of `-easyflash` and `-littlefs`. diff --git a/scripts/tools/bouffalolab/generate_factory_data.py b/scripts/tools/bouffalolab/generate_factory_data.py index 600aa4c61726d2..e03058857bc08d 100755 --- a/scripts/tools/bouffalolab/generate_factory_data.py +++ b/scripts/tools/bouffalolab/generate_factory_data.py @@ -146,8 +146,6 @@ def get_subject_attr(subject, oid): if not os.path.isfile(cert): return None, None, None, None, None - ctx = ssl.create_default_context() - with open(cert, 'rb') as cert_file: cert = x509.load_pem_x509_certificate(cert_file.read(), default_backend()) @@ -178,7 +176,7 @@ def verify_certificates(chip_cert, paa_cert, pai_cert, dac_cert): try: pai_public_key.verify(cert.signature, cert.tbs_certificate_bytes, ec.ECDSA(hashes.SHA256())) - except Exception as e: + except Exception: raise Exception("Failed to verify DAC signature with PAI certificate.") if (pai_cert != TEST_PAI_CERT and paa_cert != TEST_PAA_CERT) or (pai_cert == TEST_PAI_CERT and paa_cert == TEST_PAA_CERT): @@ -329,7 +327,7 @@ def convert_to_bytes(data): elif data is None: return bytes([]) else: - raise Exception("Data {} is invalid type: {}".format(name, type(data))) + raise Exception("Data is invalid type: {}".format(type(data))) def gen_tlvs(mfdDict, need_sec): MFD_ID_RAW_MASK = 0x8000 @@ -409,7 +407,7 @@ def gen_onboarding_data(args, onboard_txt, onboard_png, rendez=6): try: import qrcode from SetupPayload import CommissioningFlow, SetupPayload - except Exception as e: + except Exception: raise Exception("Please make sure qrcode has been installed.") else: raise Exception("Please make sure qrcode has been installed.") @@ -434,7 +432,7 @@ def main(): def check_arg(args): if not isinstance(args.output, str) or not os.path.exists(args.output): - raise Exception("output path is not specified.") + raise Exception("output path is not specified or not existed.") log.info("output path: {}".format(args.output)) if not isinstance(args.chip_cert, str) or not os.path.exists(args.chip_cert):