From ff57ccc75adcce2b64d37dc923e424d026c5f12f Mon Sep 17 00:00:00 2001 From: Cem Aksoylar Date: Fri, 10 Nov 2023 22:51:37 -0800 Subject: [PATCH 1/4] feat(shields): Allow settings_reset to build with board-only keyboards --- app/boards/shields/settings_reset/settings_reset.overlay | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/boards/shields/settings_reset/settings_reset.overlay b/app/boards/shields/settings_reset/settings_reset.overlay index 1c3b7145..8e129562 100644 --- a/app/boards/shields/settings_reset/settings_reset.overlay +++ b/app/boards/shields/settings_reset/settings_reset.overlay @@ -8,10 +8,10 @@ / { chosen { - zmk,kscan = &kscan0; + zmk,kscan = &settings_reset_kscan; }; - kscan0: kscan { + settings_reset_kscan: settings_reset_kscan { compatible = "zmk,kscan-mock"; columns = <1>; rows = <0>; From 52ed49b4bb2ed14ea1a5bc8305cf6f6cabb79673 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Wed, 13 Dec 2023 19:13:21 +0000 Subject: [PATCH 2/4] fix(ci): Upgrade to github-script@v7 * Also adjust form @actions/upload API changes. --- .github/workflows/build.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 82b156e1..a7d0560d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,13 +55,12 @@ jobs: - name: Install @actions/artifact run: npm install @actions/artifact - name: Build and upload artifacts - uses: actions/github-script@v4 + uses: actions/github-script@v7 id: boards-list with: script: | const fs = require('fs'); - const artifact = require('@actions/artifact'); - const artifactClient = artifact.create(); + const {default: artifact} = require('@actions/artifact'); const execSync = require('child_process').execSync; @@ -90,7 +89,7 @@ jobs: const cmakeName = shieldArgs['cmake-args'] ? '-' + (shieldArgs.nickname || shieldArgs['cmake-args'].split(' ').join('')) : ''; const artifactName = `${{ matrix.board }}${shieldArgs.shield ? '-' + shieldArgs.shield : ''}${cmakeName}-zmk`; - await artifactClient.uploadArtifact(artifactName, files, rootDirectory, options); + await artifact.uploadArtifact(artifactName, files, rootDirectory, options); } catch (e) { console.error(`::error::Failed to build or upload ${{ matrix.board }} ${shieldArgs.shield} ${shieldArgs['cmake-args']}`); console.error(e); @@ -111,7 +110,7 @@ jobs: include-list: ${{ steps.compile-list.outputs.result }} steps: - name: Join build lists - uses: actions/github-script@v4 + uses: actions/github-script@v7 id: compile-list with: script: | @@ -158,7 +157,7 @@ jobs: node-version: "14.x" - name: Install js-yaml run: npm install js-yaml - - uses: actions/github-script@v4 + - uses: actions/github-script@v7 id: core-list with: script: | @@ -187,7 +186,7 @@ jobs: node-version: "14.x" - name: Install js-yaml run: npm install js-yaml - - uses: actions/github-script@v4 + - uses: actions/github-script@v7 id: boards-list with: script: | @@ -264,7 +263,7 @@ jobs: nightly-include: ${{ steps.nightly-list.outputs.result }} steps: - name: Create nightly list - uses: actions/github-script@v4 + uses: actions/github-script@v7 id: nightly-list with: script: | @@ -315,7 +314,7 @@ jobs: - name: Install js-yaml run: npm install js-yaml - name: Aggregate Metadata - uses: actions/github-script@v4 + uses: actions/github-script@v7 id: aggregate-metadata with: script: | @@ -333,7 +332,7 @@ jobs: result-encoding: string - name: Organize Metadata - uses: actions/github-script@v4 + uses: actions/github-script@v7 id: organize-metadata with: script: | @@ -390,7 +389,7 @@ jobs: id: changed-files with: format: "json" - - uses: actions/github-script@v4 + - uses: actions/github-script@v7 id: board-changes with: script: | @@ -398,7 +397,7 @@ jobs: const boardChanges = changedFiles.filter(f => f.startsWith('app/boards')); return boardChanges.length ? 'true' : 'false'; result-encoding: string - - uses: actions/github-script@v4 + - uses: actions/github-script@v7 id: core-changes with: script: | From 9b3a98691c178067e87f888d986e1ec87dda66e6 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Wed, 13 Dec 2023 10:59:24 -0800 Subject: [PATCH 3/4] refactor(bt): Split security and conn exp. Kconfig * Split connection and security experimental changes into dedicated Kconfig flags for easier testing of only connection related fixes. Co-authored-by: Cem Aksoylar --- app/Kconfig | 33 ++++++++++++++++++++++++--------- docs/docs/config/bluetooth.md | 12 +++++++----- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/app/Kconfig b/app/Kconfig index a9b1b39e..70d5cc04 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -142,29 +142,44 @@ menuconfig ZMK_BLE if ZMK_BLE -config ZMK_BLE_EXPERIMENTAL_FEATURES - bool "Experimental: Enable experimental/advanced BLE settings/features" - imply ZMK_BLE_PASSKEY_ENTRY +config ZMK_BLE_EXPERIMENTAL_CONN + bool "Experimental BLE connection changes" imply BT_GATT_AUTO_SEC_REQ + help + Enables a combination of settings that are planned to be default in future versions of ZMK + to improve connection stability. This includes changes to timing on BLE pairing initation, + restores use of the updated/new LLCP implementation, and disables 2M PHY support. + +config ZMK_BLE_EXPERIMENTAL_SEC + bool "Experimental BLE security changes" imply BT_SMP_ALLOW_UNAUTH_OVERWRITE help - Enables a combination of settings that are planned to be default in future versions of ZMK. - This includes changes to timing on BLE pairing initation, BT Secure Connection passkey entry, - restores use of the updated/new LLCP implementation, disables 2M PHY support, and allows - overwrite of keys from previously paired hosts. + Enables a combination of settings that are planned to be officially supported in the future. + This includes enabling BT Secure Connection passkey entry, and allows overwrite of keys from + previously paired hosts. + +config ZMK_BLE_EXPERIMENTAL_FEATURES + bool "Experimental BLE connection and security settings/features" + select ZMK_BLE_EXPERIMENTAL_CONN + select ZMK_BLE_EXPERIMENTAL_SEC + help + Enables experimental connection changes and security features. config ZMK_BLE_PASSKEY_ENTRY bool "Require passkey entry on the keyboard to complete pairing" default n select RING_BUFFER +config BT_SMP_ALLOW_UNAUTH_OVERWRITE + imply ZMK_BLE_PASSKEY_ENTRY + choice BT_LL_SW_LLCP_IMPL - default BT_LL_SW_LLCP_LEGACY if !ZMK_BLE_EXPERIMENTAL_FEATURES + default BT_LL_SW_LLCP_LEGACY if !ZMK_BLE_EXPERIMENTAL_CONN endchoice config BT_CTLR_PHY_2M - default n if ZMK_BLE_EXPERIMENTAL_FEATURES + default n if ZMK_BLE_EXPERIMENTAL_CONN # BT_TINYCRYPT_ECC is required for BT_SMP_SC_PAIR_ONLY when using HCI config BT_TINYCRYPT_ECC diff --git a/docs/docs/config/bluetooth.md b/docs/docs/config/bluetooth.md index 61477cb5..9149b36b 100644 --- a/docs/docs/config/bluetooth.md +++ b/docs/docs/config/bluetooth.md @@ -9,8 +9,10 @@ See [Configuration Overview](index.md) for instructions on how to change these s ## Kconfig -| Option | Type | Description | Default | -| -------------------------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -| `CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES` | bool | Enables a combination of settings that are planned to be default in future versions of ZMK. This includes changes to timing on BLE pairing initation, BT Secure Connection passkey entry, restores use of the updated/new LLCP implementation, disables 2M PHY support, and allows overwrite of keys from previously paired hosts. | n | -| `CONFIG_ZMK_BLE_PASSKEY_ENTRY` | bool | Enable passkey entry during pairing for enhanced security. (Note: After enabling this, you will need to re-pair all previously paired hosts) | n | -| `CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION` | bool | Low level setting for GATT subscriptions. Set to `n` to work around an annoying Windows bug with battery notifications. | y | +| Option | Type | Description | Default | +| -------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | +| `CONFIG_ZMK_BLE_EXPERIMENTAL_CONN` | bool | Enables a combination of settings that are planned to be default in future versions of ZMK to improve connection stability. This includes changes to timing on BLE pairing initation, restores use of the updated/new LLCP implementation, and disables 2M PHY support. | n | +| `CONFIG_ZMK_BLE_EXPERIMENTAL_SEC` | bool | Enables a combination of settings that are planned to be officially supported in the future. This includes enabling BT Secure Connection passkey entry, and allows overwrite of keys from previously paired hosts. | n | +| `CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES` | bool | Aggregate config that enables both `CONFIG_ZMK_BLE_EXPERIMENTAL_CONN` and `CONFIG_ZMK_BLE_EXPERIMENTAL_SEC`. | n | +| `CONFIG_ZMK_BLE_PASSKEY_ENTRY` | bool | Enable passkey entry during pairing for enhanced security. (Note: After enabling this, you will need to re-pair all previously paired hosts.) | n | +| `CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION` | bool | Low level setting for GATT subscriptions. Set to `n` to work around an annoying Windows bug with battery notifications. | y | From f4f402fa44793ef7ce2a6ac382aeded57a5f16aa Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Fri, 15 Dec 2023 20:13:43 +0000 Subject: [PATCH 4/4] fix(ci): Use unique artifact for test logs * To address conflicts with identically named artifact uploads, include the test name in the artifact name. --- .github/workflows/ble-test.yml | 8 ++++---- .github/workflows/test.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ble-test.yml b/.github/workflows/ble-test.yml index 3bc8a718..8f545002 100644 --- a/.github/workflows/ble-test.yml +++ b/.github/workflows/ble-test.yml @@ -27,7 +27,7 @@ jobs: run: | cd app/tests/ble export TESTS=$(ls -d * | grep -v central | jq -R -s -c 'split("\n")[:-1]') - echo "::set-output name=test-dirs::${TESTS}" + echo "test-dirs=${TESTS}" > $GITHUB_OUTPUT run-tests: needs: collect-tests strategy: @@ -40,7 +40,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Cache west modules - uses: actions/cache@v3.0.2 + uses: actions/cache@v3 env: cache-name: cache-zephyr-modules with: @@ -72,7 +72,7 @@ jobs: run: BSIM_COMPONENTS_PATH="${GITHUB_WORKSPACE}/tools/bsim/components/" BSIM_OUT_PATH="${GITHUB_WORKSPACE}/tools/bsim/" ./run-ble-test.sh tests/ble/${{ matrix.test }} - name: Archive artifacts if: ${{ always() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: "log-files" + name: "${{ matrix.test }}-log-files" path: app/build/**/*.log diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ec630812..eba4ff3a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: run: | cd app/tests/ export TESTS=$(ls -d * | grep -v ble | jq -R -s -c 'split("\n")[:-1]') - echo "::set-output name=test-dirs::${TESTS}" + echo "test-dirs=${TESTS}" >> $GITHUB_OUTPUT run-tests: needs: collect-tests strategy: @@ -38,7 +38,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Cache west modules - uses: actions/cache@v3.0.2 + uses: actions/cache@v3 env: cache-name: cache-zephyr-modules with: @@ -65,7 +65,7 @@ jobs: run: west test tests/${{ matrix.test }} - name: Archive artifacts if: ${{ always() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: "log-files" + name: "${{ matrix.test }}-log-files" path: app/build/**/*.log