diff --git a/.github/workflows/esp_idf.yml b/.github/workflows/esp_idf.yml index a630d5e..91f60b9 100644 --- a/.github/workflows/esp_idf.yml +++ b/.github/workflows/esp_idf.yml @@ -12,9 +12,9 @@ jobs: uses: actions/checkout@v2 with: submodules: 'recursive' - - name: ESP-IDF v5.1.2 build esp32s3 + - name: ESP-IDF v5.4 build esp32s3 uses: espressif/esp-idf-ci-action@v1 with: - esp_idf_version: v5.1.2 + esp_idf_version: v5.4 target: esp32s3 command: 'idf.py set-target esp32s3 build' diff --git a/components/LibSSH-ESP32 b/components/LibSSH-ESP32 index e59313c..5700487 160000 --- a/components/LibSSH-ESP32 +++ b/components/LibSSH-ESP32 @@ -1 +1 @@ -Subproject commit e59313c3ac700993ede257d58ab855d5ace5327d +Subproject commit 570048744e0c3441b4504841194e4f74a96e7613 diff --git a/components/ssh/src/server.cc b/components/ssh/src/server.cc index e4428f3..632d430 100644 --- a/components/ssh/src/server.cc +++ b/components/ssh/src/server.cc @@ -160,14 +160,14 @@ ListenError Server::Listen(const HandlerCallback& handler) ESP_LOGI(TAG, "[%s] new connection from: %s", sessInfo.Id.c_str(), sessInfo.ClientIP.c_str()); - ESP_LOGD(TAG, "[%s] starts key exchange...", sessInfo.Id.c_str()); + ESP_LOGI(TAG, "[%s] starts key exchange...", sessInfo.Id.c_str()); rc = ssh_handle_key_exchange(sshSession); if (rc != SSH_OK) { ESP_LOGW(TAG, "[%s] key exchange failed: %s", sessInfo.Id.c_str(), ssh_get_error(sshSession)); return ListenError::Accept; } - ESP_LOGD(TAG, "[%s] auth client...", sessInfo.Id.c_str()); + ESP_LOGI(TAG, "[%s] auth client...", sessInfo.Id.c_str()); auto userInfo = authenticate(sshSession, sessInfo); if (!userInfo) { ESP_LOGW(TAG, "[%s] auth failed, abort", sessInfo.Id.c_str()); @@ -175,7 +175,7 @@ ListenError Server::Listen(const HandlerCallback& handler) } sessInfo.User = std::move(userInfo.value()); - ESP_LOGD(TAG, "[%s] wait for a channel session...", sessInfo.Id.c_str()); + ESP_LOGI(TAG, "[%s] wait for a channel session...", sessInfo.Id.c_str()); ssh_message message = nullptr; ssh_channel chan = nullptr; do { @@ -227,6 +227,10 @@ ListenError Server::Listen(const HandlerCallback& handler) } if (ssh_message_subtype(message) != SSH_CHANNEL_REQUEST_EXEC) { + if (ssh_message_subtype(message) != SSH_CHANNEL_REQUEST_ENV) { + ESP_LOGW(TAG, "[%s] requested invalid channel %d:%d", sessInfo.Id.c_str(), ssh_message_type(message), ssh_message_subtype(message)); + }; + ssh_message_reply_default(message); ssh_message_free(message); continue; diff --git a/components/ui/src/button.cc b/components/ui/src/button.cc index f8d4a0f..62734ca 100644 --- a/components/ui/src/button.cc +++ b/components/ui/src/button.cc @@ -1,6 +1,5 @@ #include #include "ui/button.h" -#include "config.h" using namespace UI; diff --git a/dependencies.lock b/dependencies.lock index 51481fa..cdfd690 100644 --- a/dependencies.lock +++ b/dependencies.lock @@ -1,51 +1,91 @@ dependencies: bblanchon/arduinojson: - component_hash: 463812931f99cb7a554d64311288f537b43daaca3eed2427557b907af393447c + component_hash: 21b41e6cce335cefc142c457ceb50eb45621ff9ea6fd0a0ee349a642e48a47a3 + dependencies: [] source: - service_url: https://api.components.espressif.com/ + registry_url: https://components.espressif.com/ type: service - version: 6.21.5 + version: 7.3.0 espressif/esp_lcd_touch: - component_hash: d4d8f2dc33205797169a97a02e0d89a8982f59fe0509129b54422052b8522f59 + component_hash: 779b4ba2464a3ae85681e4b860caa5fdc35801458c23f3039ee761bae7f442a4 + dependencies: + - name: idf + require: private + version: '>=4.4.2' source: - service_url: https://api.components.espressif.com/ + registry_url: https://components.espressif.com type: service - version: 1.1.1 + version: 1.1.2 espressif/esp_lcd_touch_cst816s: component_hash: 270bd7df3a2a5cffa3a626c4709fc03237d83fd9daa6fb70c833a2f1875f0f68 + dependencies: + - name: idf + require: private + version: '>=4.4.2' + - name: espressif/esp_lcd_touch + registry_url: https://components.espressif.com + require: public + version: ^1.0.4 source: - service_url: https://api.components.espressif.com/ + registry_url: https://components.espressif.com/ type: service version: 1.0.3 espressif/esp_tinyusb: - component_hash: 43d73c626724054db083ad2a537e8af223e3bca7a915fc38a9d9c6c7f2920a69 + component_hash: fe1135e7a419b0c6034117aea46d4ad8048618de50f3ae774b1526ae571f1ec6 + dependencies: + - name: idf + require: private + version: '>=5.0' + - name: espressif/tinyusb + registry_url: https://components.espressif.com + require: public + version: '>=0.14.2' source: - service_url: https://api.components.espressif.com/ + registry_url: https://components.espressif.com/ type: service - version: 1.4.3 + version: 1.7.1 espressif/libsodium: - component_hash: f6e982479a2389cb6868e8fb761cf23aba6c355a8090b3e906299807775f58a3 + component_hash: 25b968723c584a2742ca36cebe5a7ef049c6767e059f7b1e1eec69946019025d + dependencies: + - name: idf + require: private + version: '>=4.2' source: - service_url: https://api.components.espressif.com/ + registry_url: https://components.espressif.com/ type: service - version: 1.0.20~1 + version: 1.0.20~2 espressif/tinyusb: - component_hash: a11195d4c7c385aa2b1430009486dd4007920307d13b7db474a62ff040907d8f + component_hash: 0f96faa5e29d5a04553ba7050b9051c1f6b549b9340681eb7afdda419a8dff2e + dependencies: + - name: idf + require: private + version: '>=5.0' source: - service_url: https://api.components.espressif.com/ + registry_url: https://components.espressif.com type: service - version: 0.15.0~4 + targets: + - esp32s2 + - esp32s3 + - esp32p4 + version: 0.18.0~1 idf: - component_hash: null source: type: idf - version: 5.1.2 + version: 5.4.0 lvgl/lvgl: - component_hash: 948bff879a345149b83065535bbc4a026ce9f47498a22881e432a264b9098015 + component_hash: d7c1ac037ae6e85d94897f807d6e7ba0946a83e720074fc95a4f6241da9f9f53 + dependencies: [] source: - service_url: https://api.components.espressif.com/ + registry_url: https://components.espressif.com/ type: service - version: 8.3.11 -manifest_hash: 274d2cea5a7bbaa200ff3e38c33582d8878030d2b62013f54b7efa6c84f1440c + version: 8.4.0 +direct_dependencies: +- bblanchon/arduinojson +- espressif/esp_lcd_touch_cst816s +- espressif/esp_tinyusb +- espressif/libsodium +- idf +- lvgl/lvgl +manifest_hash: 86a1bbad848f6e431c9b1d1fc6f00c1fa63de16ee067779dc86b801507d06fab target: esp32s3 -version: 1.0.0 +version: 2.0.0 diff --git a/main/Kconfig b/main/Kconfig index d2607dd..3fd09e6 100644 --- a/main/Kconfig +++ b/main/Kconfig @@ -33,10 +33,6 @@ menu "BoundBox Runtime" int "SSHD task stack size" default 32768 - config COMMAND_BUFFER_SIZE - int "Command buffer size" - default 16384 - config SHUTDOWN_ON_ASSERT bool "Use shutdown instead of assert (board will be available after manual rst)" default false diff --git a/main/commands.cc b/main/commands.cc index 81721ed..9651ee8 100644 --- a/main/commands.cc +++ b/main/commands.cc @@ -108,13 +108,13 @@ namespace bool HandleSecretsStore(Secrets* secrets, const SSH::SessionInfo& sessInfo, const JsonObjectConst& req, JsonObject& rsp) { JsonObjectConst secretsJson = req["secrets"].as(); - if (!secretsJson.containsKey("host_key")) { + if (!secretsJson["host_key"].is()) { rsp["error_code"] = CMD_ERR_CODE_SECRETS_STORE_INVALID_HOST_KEY; - rsp["error_msg"] = "empty host key"; + rsp["error_msg"] = "invalid or empty host key"; return false; } - if (!secretsJson.containsKey("secret_key")) { + if (!secretsJson["secret_key"].is()) { rsp["error_code"] = CMD_ERR_CODE_SECRETS_STORE_INVALID_SECRET_KEY; rsp["error_msg"] = "empty host key"; return false; @@ -172,14 +172,14 @@ Error Commands::Initialize(Authenticator* auth, Secrets* secrets) Error Commands::Dispatch(const SSH::SessionInfo& sessInfo, std::string_view cmdName, SSH::Stream& stream) { ESP_LOGI(TAG, "[%s] called command: %s", sessInfo.Id.c_str(), cmdName.cbegin()); - DynamicJsonDocument req(CONFIG_COMMAND_BUFFER_SIZE); + JsonDocument req; DeserializationError jsonErr = deserializeJson(req, stream); if (jsonErr && jsonErr != DeserializationError::Code::EmptyInput) { ESP_LOGE(TAG, "[%s] unable to read request: %s", sessInfo.Id.c_str(), jsonErr.c_str()); return Error::CommandFailed; } - DynamicJsonDocument rspDoc(CONFIG_COMMAND_BUFFER_SIZE); + JsonDocument rspDoc; JsonObject rsp = rspDoc.to(); bool ok = Handle(sessInfo, cmdName, req.as(), rsp); @@ -247,13 +247,13 @@ bool Commands::Handle(const SSH::SessionInfo& sessInfo, std::string_view cmdName }; if (cmdName == "/help") { - JsonArray jsonCommands = rsp.createNestedArray("commands"); + JsonArray jsonCommands = rsp["commands"].to(); for (const auto& cmd : commands) { if (!cmd.UsedAllowed && sessInfo.User.Role != SSH::UserRole::SysOp) { continue; } - JsonObject jsonCmd = jsonCommands.createNestedObject(); + JsonObject jsonCmd = jsonCommands.add(); jsonCmd["command"] = cmd.Name; jsonCmd["description"] = cmd.Help; } diff --git a/main/idf_component.yml b/main/idf_component.yml index 4796f3e..7488a08 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -1,4 +1,4 @@ dependencies: - idf: "^5.1.0" + idf: "^5.4.0" lvgl/lvgl: "^8.3.11" - bblanchon/arduinojson: "^6.21.4" + bblanchon/arduinojson: "^7.3.0" diff --git a/main/secrets.cc b/main/secrets.cc index 9571673..9c09699 100644 --- a/main/secrets.cc +++ b/main/secrets.cc @@ -131,7 +131,7 @@ Error Secrets::Erase() Error Secrets::FromJson(const JsonObjectConst& obj) noexcept { - if (!obj.containsKey("host_key") || !obj.containsKey("secret_key")) { + if (!obj["host_key"].is() || !obj["secret_key"].is()) { return Error::ShitHappens; } diff --git a/sdkconfig.defaults b/sdkconfig.defaults index fc04b1b..0c5c359 100644 --- a/sdkconfig.defaults +++ b/sdkconfig.defaults @@ -1,5 +1,4 @@ CONFIG_ESPTOOLPY_FLASHFREQ_80M=y -CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT=y CONFIG_ESPTOOLPY_FLASHFREQ="80m" CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y CONFIG_ESPTOOLPY_FLASHSIZE="16MB" @@ -34,7 +33,6 @@ CONFIG_TINYUSB_DESC_SERIAL_STRING="31337" CONFIG_LWIP_LOCAL_HOSTNAME="BoundBox" CONFIG_ETH_SPI_ETHERNET_W5500=y -CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n CONFIG_ESP_MAIN_TASK_STACK_SIZE=7168