From d366bb6577af8dcc41161c878c241482474cd48c Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 27 Sep 2026 06:31:16 +0000 Subject: [PATCH 1/2] chore: build wolfSSL without DEBUG_WOLFSSL unless FREEINK_WOLFSSL_DEBUG Arduino-wolfSSL's user_settings.h enables DEBUG_WOLFSSL, which compiles every WOLFSSL_MSG/WOLFSSL_ENTER trace string and call into flash. Undefine it in the patch_wolfssl.py overrides unless FREEINK_WOLFSSL_DEBUG is set (the same macro SecureClient uses to turn tracing on), and gate the app's print hook with it. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_013k1W4UZTzyPQnTVXwZUbkS --- lib/KOReaderSync/KOReaderSyncClient.cpp | 8 ++++---- scripts/patch_wolfssl.py | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/KOReaderSync/KOReaderSyncClient.cpp b/lib/KOReaderSync/KOReaderSyncClient.cpp index 8736c4280e6..ada3c3b8fb5 100644 --- a/lib/KOReaderSync/KOReaderSyncClient.cpp +++ b/lib/KOReaderSync/KOReaderSyncClient.cpp @@ -23,10 +23,10 @@ #include "KOReaderCredentialStore.h" -#ifndef SIMULATOR -// wolfSSL is built with DEBUG_WOLFSSL, whose Arduino backend expects the app to -// provide this print hook (the stock definition lives in , which no -// translation unit here includes). Route it through the firmware logger, same +#if !defined(SIMULATOR) && defined(FREEINK_WOLFSSL_DEBUG) +// With FREEINK_WOLFSSL_DEBUG, wolfSSL is built with DEBUG_WOLFSSL, whose Arduino +// backend expects the app to provide this print hook (the stock definition lives +// in , which no translation unit here includes). Route it through the firmware logger, same // as upstream CrossPoint's HttpDownloader.cpp. extern "C" void wolfSSL_Arduino_Serial_Print(const char* const msg) { LOG_DBG("WOLFSSL", "%s", msg); } #endif diff --git a/scripts/patch_wolfssl.py b/scripts/patch_wolfssl.py index 4c6283c0752..6c1d6f9a60a 100644 --- a/scripts/patch_wolfssl.py +++ b/scripts/patch_wolfssl.py @@ -14,6 +14,11 @@ #endif #undef FP_MAX_BITS #define FP_MAX_BITS 8192 +/* Arduino-wolfSSL turns on DEBUG_WOLFSSL, which compiles every WOLFSSL_MSG and + WOLFSSL_ENTER trace string into flash. Keep it only for FREEINK_WOLFSSL_DEBUG. */ +#ifndef FREEINK_WOLFSSL_DEBUG +#undef DEBUG_WOLFSSL +#endif """ From 063d4aa3c50a0833f20a447ef27c11f829ee00bb Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 27 Sep 2026 06:50:15 +0000 Subject: [PATCH 2/2] docs: changelog entry for wolfSSL debug trace removal Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_013k1W4UZTzyPQnTVXwZUbkS --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f3b86d5e98..d94314b50ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - Idle power saving now engages after 1 second instead of 3, and battery level is polled every 6 seconds instead of every 1.5, trading slightly less frequent battery updates for lower average power draw. - The Library opens instantly when nothing on the SD card has changed since its last scan, instead of rescanning the whole card on every visit. Moving the selection no longer re-reads each visible book from the card. - Fewer SD card writes: session state and reading stats are no longer rewritten when nothing changed, and the reading percentage shown on Home is saved once when you leave a book instead of every 10 pages. +- Firmware is about 32 KB smaller: wolfSSL no longer builds its debug trace messages in. Builds with `-DFREEINK_WOLFSSL_DEBUG` still include them. ### Fixed