Skip to content

Commit

Permalink
fix lint code and spell
Browse files Browse the repository at this point in the history
  • Loading branch information
wy-hh committed Aug 26, 2024
1 parent 8053e93 commit 4db58ed
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
5 changes: 3 additions & 2 deletions docs/guides/bouffalolab/matter_factory_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
```
Expand Down
1 change: 1 addition & 0 deletions docs/guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions examples/lighting-app/bouffalolab/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
10 changes: 4 additions & 6 deletions scripts/tools/bouffalolab/generate_factory_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.")
Expand All @@ -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):
Expand Down

0 comments on commit 4db58ed

Please sign in to comment.