aboutsummaryrefslogtreecommitdiff
path: root/patches/0007-yp3-power-off-at-boot-when-there-is-no-SD-card.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/0007-yp3-power-off-at-boot-when-there-is-no-SD-card.patch')
-rw-r--r--patches/0007-yp3-power-off-at-boot-when-there-is-no-SD-card.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/patches/0007-yp3-power-off-at-boot-when-there-is-no-SD-card.patch b/patches/0007-yp3-power-off-at-boot-when-there-is-no-SD-card.patch
new file mode 100644
index 0000000..086494c
--- /dev/null
+++ b/patches/0007-yp3-power-off-at-boot-when-there-is-no-SD-card.patch
@@ -0,0 +1,48 @@
+From 33293a86a06f935e44f17f36b38f586e7b0e5b33 Mon Sep 17 00:00:00 2001
+From: YP3 Audiobook <noreply@example.invalid>
+Date: Thu, 26 Nov 2026 20:23:27 +0000
+Subject: [PATCH 07/11] yp3: power off at boot when there is no SD card
+
+Turned on without a card, the player showed "ATA error: -5", then after
+a key the debug screen and a panic ("ata: -5" and a backtrace). The
+panic parks the CPU until the recovery watchdog resets it (~16 s), a
+dark screen that looked like a crash into download mode.
+
+Now it says there is no SD card, waits 5 s and powers off; with the
+card back in, the next power-on boots normally.
+
+---
+ apps/main.c | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+diff --git a/apps/main.c b/apps/main.c
+index 1dcc992d..ca189b07 100644
+--- a/apps/main.c
++++ b/apps/main.c
+@@ -626,6 +626,23 @@ static void init(void)
+ CHART(">storage_init");
+ rc = storage_init();
+ CHART("<storage_init");
++#ifdef HAVE_SD_CARD_SWAP
++ if (rc)
++ {
++ /* No card (or none that answers): say so and power off. Upstream
++ waited for a key, showed the debug screen and panicked, and the
++ panic parked the player dark until the recovery watchdog reset
++ it (~16 s), which looked like a crash into download mode. */
++ lcd_clear_display();
++ lcd_puts(0, 1, "No SD card.");
++ lcd_puts(0, 3, "Put the card in,");
++ lcd_puts(0, 4, "then turn the");
++ lcd_puts(0, 5, "player on.");
++ lcd_update();
++ sleep(5*HZ);
++ power_off();
++ }
++#endif
+ if(rc)
+ {
+ lcd_clear_display();
+--
+2.56.1
+