diff --git a/src/helpers/ota/OtaCli.cpp b/src/helpers/ota/OtaCli.cpp index 61676cedf..e7d4bdd94 100644 --- a/src/helpers/ota/OtaCli.cpp +++ b/src/helpers/ota/OtaCli.cpp @@ -883,7 +883,11 @@ bool handle_ota_command(const char* command, char* reply, mesh::MainBoard& board (defined(OTA_QSPI_BOOTLOADER_UPDATE) || defined(OTA_INTERNAL_BOOTLOADER_UPDATE) || \ defined(OTA_SD_BOOTLOADER_UPDATE)) const OtaBootloaderIdentity& bid = c.bootloaderIdentity(); +#if defined(OTA_RAK_BOOTLOADER_RECOVERY) + const OtaBlCaps& bl = c.bootloaderAppCaps(); +#else const OtaBlCaps& bl = c.bootloaderUpdateCaps(); +#endif if (*rest == 0 || strcmp(rest, "status") == 0) { if (!bid.present || !bid.crc_ok) { strcpy(reply, "Bootloader update unavailable: installed embedded manifest/CRC is invalid"); diff --git a/test/test_ota/test_ota_core.cpp b/test/test_ota/test_ota_core.cpp index 5ccb275b7..5c200485a 100644 --- a/test/test_ota/test_ota_core.cpp +++ b/test/test_ota/test_ota_core.cpp @@ -830,6 +830,20 @@ TEST(OtaBootPackage, LegacyAndCurrentBootloadersHaveSeparateCapabilityViews) { EXPECT_TRUE(app.present); EXPECT_FALSE(update.present); + // Adaptive RAK ABI-2 advertises application OTA and the recovery storage + // layout, while its bootloader still cannot self-update. + const uint8_t adaptive_marker[16] = { + 'M','O','T','A','B','L','D','R', 2,0, 5,0, + OTA_BL_PROFILE_RAK_AUTO, 0,0,0}; + memset(image, 0xFF, sizeof(image)); + memcpy(image + 4, adaptive_marker, sizeof(adaptive_marker)); + app = ota_bl_app_caps_scan(image, sizeof(image)); + update = ota_bl_update_caps_scan_aligned( + image, sizeof(image), OTA_BL_PROFILE_RAK_AUTO); + ASSERT_TRUE(app.present); + EXPECT_EQ(app.storage_flags, OTA_BL_PROFILE_RAK_AUTO); + EXPECT_FALSE(update.present); + // A valid marker for another storage profile is visible diagnostically but // cannot authorize an internal-flash bootloader replacement. memset(image, 0xFF, sizeof(image));