diff --git a/.gitignore b/.gitignore index b0749543f..2e26f6b38 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ components/esp32-camera/ components/esp_littlefs/ components/esp-rainmaker/ components/espressif__esp-dsp/ +components/espressif__esp_matter/ components/esp-insights/ components/arduino_tinyusb/tinyusb/ components/tflite-micro/ diff --git a/configs/defconfig.common b/configs/defconfig.common index 2fc18a697..3a0111f2e 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -125,7 +125,7 @@ CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y # Matter Settings # # Disable Matter BLE -CONFIG_ENABLE_CHIPOBLE=n +CONFIG_ENABLE_CHIPOBLE=y CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=n # ESP Insights CONFIG_ENABLE_ESP_INSIGHTS_TRACE=n diff --git a/main/idf_component.yml b/main/idf_component.yml index c6bb97f46..e1162a43c 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -16,8 +16,8 @@ dependencies: version: ">=1.4.2" rules: - if: "target in [esp32s3]" - espressif/esp_matter: - version: "^1.3.0" - require: public - rules: - - if: "target not in [esp32c2, esp32h2, esp32p4]" +# espressif/esp_matter: +# version: "^1.3.0" +# require: public +# rules: +# - if: "target not in [esp32c2, esp32h2, esp32p4]" diff --git a/patches/matter_chip_ChipDeviceScanner.diff b/patches/matter_chip_ChipDeviceScanner.diff new file mode 100644 index 000000000..dd37263ee --- /dev/null +++ b/patches/matter_chip_ChipDeviceScanner.diff @@ -0,0 +1,35 @@ +@@ -31,22 +31,19 @@ + bool BluedroidGetChipDeviceInfo(esp_ble_gap_cb_param_t & scan_result, chip::Ble::ChipBLEDeviceIdentificationInfo & deviceInfo) + { + // Check for CHIP Service UUID +- if (scan_result.scan_rst.ble_adv != NULL) ++ if (scan_result.scan_rst.adv_data_len > 13 && scan_result.scan_rst.ble_adv[5] == 0xf6 && ++ scan_result.scan_rst.ble_adv[6] == 0xff) + { +- if (scan_result.scan_rst.adv_data_len > 13 && scan_result.scan_rst.ble_adv[5] == 0xf6 && +- scan_result.scan_rst.ble_adv[6] == 0xff) +- { +- deviceInfo.OpCode = scan_result.scan_rst.ble_adv[7]; +- deviceInfo.DeviceDiscriminatorAndAdvVersion[0] = scan_result.scan_rst.ble_adv[8]; +- deviceInfo.DeviceDiscriminatorAndAdvVersion[1] = scan_result.scan_rst.ble_adv[9]; +- // vendor and product Id from adv +- deviceInfo.DeviceVendorId[0] = scan_result.scan_rst.ble_adv[10]; +- deviceInfo.DeviceVendorId[1] = scan_result.scan_rst.ble_adv[11]; +- deviceInfo.DeviceProductId[0] = scan_result.scan_rst.ble_adv[12]; +- deviceInfo.DeviceProductId[1] = scan_result.scan_rst.ble_adv[13]; +- deviceInfo.AdditionalDataFlag = scan_result.scan_rst.ble_adv[14]; +- return true; +- } ++ deviceInfo.OpCode = scan_result.scan_rst.ble_adv[7]; ++ deviceInfo.DeviceDiscriminatorAndAdvVersion[0] = scan_result.scan_rst.ble_adv[8]; ++ deviceInfo.DeviceDiscriminatorAndAdvVersion[1] = scan_result.scan_rst.ble_adv[9]; ++ // vendor and product Id from adv ++ deviceInfo.DeviceVendorId[0] = scan_result.scan_rst.ble_adv[10]; ++ deviceInfo.DeviceVendorId[1] = scan_result.scan_rst.ble_adv[11]; ++ deviceInfo.DeviceProductId[0] = scan_result.scan_rst.ble_adv[12]; ++ deviceInfo.DeviceProductId[1] = scan_result.scan_rst.ble_adv[13]; ++ deviceInfo.AdditionalDataFlag = scan_result.scan_rst.ble_adv[14]; ++ return true; + } + return false; + } diff --git a/tools/update-components.sh b/tools/update-components.sh index 298783c74..09f50f3b3 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -15,3 +15,39 @@ else git -C "$TINYUSB_REPO_DIR" pull --ff-only fi if [ $? -ne 0 ]; then exit 1; fi + +echo "Updating Matter v1.3 repository..." +MATTER_REPO_URL="https://github.com/espressif/esp-matter.git" +MATTER_REPO_DIR="$AR_COMPS/espressif__esp_matter" +MATTER_REPO_BRANCH="release/v1.3" +if [ ! -d "$MATTER_REPO_DIR" ]; then + git clone --depth 1 -b "$MATTER_REPO_BRANCH" "$MATTER_REPO_URL" "$MATTER_REPO_DIR" +else + git -C "$MATTER_REPO_DIR" fetch && \ + git -C "$MATTER_REPO_DIR" pull --ff-only +fi +if [ $? -ne 0 ]; then exit 1; fi +echo "Updating CHIP v1.3 repository..." +CHIP_REPO_URL="https://github.com/espressif/connectedhomeip.git" +CHIP_REPO_DIR="$MATTER_REPO_DIR/connectedhomeip/connectedhomeip" +CHIP_REPO_BRANCH="v1.3-branch" +if [ -d "$CHIP_REPO_DIR" ]; then + # Check if directory is empty + if [ -z "$(ls -A "$CHIP_REPO_DIR")" ]; then + rm -rf "$CHIP_REPO_DIR" + git clone --depth 1 -b "$CHIP_REPO_BRANCH" "$CHIP_REPO_URL" "$CHIP_REPO_DIR" + if [ $? -ne 0 ]; then exit 1; fi + $CHIP_REPO_DIR/scripts/checkout_submodules.py --platform esp32 --shallow + if [ $? -ne 0 ]; then exit 1; fi + echo "Patching CHIP v1.3 repository..." + CHIP_BAD_FILE="$CHIP_REPO_DIR/src/platform/ESP32/bluedroid/ChipDeviceScanner.cpp" + CHIP_PATCH="$AR_PATCHES/matter_chip_ChipDeviceScanner.diff" + if [ -f "$CHIP_BAD_FILE" ]; then + patch $CHIP_BAD_FILE $CHIP_PATCH + else + echo "Error: $CHIP_BAD_FILE not found. Check the script." + exit 1 + fi + fi +fi +echo "Matter v1.3 component is installed and updated."