Public Access
sd card: what the card says it is, from its CID register
Type, size, and the identity register read by our SD driver (CMD10): manufacturer, OEM, product name, revision, serial and date, decoded by a host-tested parser. Needed for the upstream report of #21: nothing else here could read the card's identity. This one is a Samsung 8 GB SDHC from June 2013. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
+14
-1
@@ -23,6 +23,7 @@
|
||||
#include "platform/crash_report.h"
|
||||
#include "platform/nvs_store.h"
|
||||
#include "platform/system_info.h"
|
||||
#include "sd_card_id.h"
|
||||
#include "sd_fault.h"
|
||||
#include "service_manager.h"
|
||||
#include "platform/identity.h"
|
||||
@@ -376,7 +377,7 @@ static const char* const kHelp =
|
||||
"gemini get <url> fetch a Gemini page and report header, size, certificate, heap\n"
|
||||
"irc start | irc stop | irc dump | irc say <buffer> <text>\n"
|
||||
"ls [folder] | rm <path> | install <path.ota> (Update from SD)\n"
|
||||
"sd list | cat <path> | log <text> | burst | sound on|off | short | normal\n"
|
||||
"sd card | sd list | cat <path> | log <text> | burst | sound on|off | short | normal\n"
|
||||
#ifdef RORO_DEBUG
|
||||
"crash abort|wdt crash on purpose (to test crash reports and Safe Mode)\n"
|
||||
"lora inject <hex> [rssi] [snr] a packet into the LoRa Scanner as if received (nothing is sent)\n"
|
||||
@@ -538,6 +539,18 @@ static void runCommand(String line) {
|
||||
}
|
||||
}
|
||||
if (line.startsWith("sd put ")) startUpload(line.substring(7)); // then raw bytes: see uploadStep()
|
||||
if (line == "sd card") { // what the card says it is, from its CID register
|
||||
if (!storageService->state().present) return (void)console.println("sd card: no card");
|
||||
storageService->runJob([]() {
|
||||
uint8_t cid[16];
|
||||
const char* type = SD.cardType() == CARD_SDHC ? "SDHC/SDXC" : SD.cardType() == CARD_SD ? "SDSC" : "MMC or unknown";
|
||||
if (!sdReadCid(cid)) return (void)console.println("sd card: the card didn't answer");
|
||||
console.printf("sd card: %s, %.1f GB, %s\n", type, SD.cardSize() / 1e9, sdCardSummary(parseSdCid(cid)).c_str());
|
||||
console.printf("sd card: CID");
|
||||
for (uint8_t b : cid) console.printf(" %02x", b);
|
||||
console.println();
|
||||
});
|
||||
}
|
||||
if (line == "sd list") {
|
||||
storageService->requestListing();
|
||||
listingWanted = true;
|
||||
|
||||
Reference in New Issue
Block a user