// shellInfo.c -- System information wrapper for DVX Shell // // Delegates hardware detection to the platform layer via // platformGetSystemInfo(), then logs the result line-by-line // to DVX.LOG. The result pointer is cached so subsequent calls // to shellGetSystemInfo() return instantly without re-probing. #include "shellInfo.h" #include "shellApp.h" #include "platform/dvxPlatform.h" #include // ============================================================ // Module state // ============================================================ static const char *sCachedInfo = NULL; // ============================================================ // shellGetSystemInfo -- return the cached info text // ============================================================ const char *shellGetSystemInfo(void) { return sCachedInfo ? sCachedInfo : ""; } // ============================================================ // shellInfoInit -- gather info and log it // ============================================================ void shellInfoInit(AppContextT *ctx) { sCachedInfo = platformGetSystemInfo(&ctx->display); // Log each line individually so the log file is readable shellLog("=== System Information ==="); const char *line = sCachedInfo; while (*line) { const char *eol = strchr(line, '\n'); if (!eol) { shellLog("%s", line); break; } int32_t len = (int32_t)(eol - line); char tmp[256]; if (len >= (int32_t)sizeof(tmp)) { len = sizeof(tmp) - 1; } memcpy(tmp, line, len); tmp[len] = '\0'; shellLog("%s", tmp); line = eol + 1; } shellLog("=== End System Information ==="); }