• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category
  • Assigned To
  • Operating System
  • Severity Low
  • Priority Very Low
  • Reported Version Unstable (example)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by hohensoh - 2005-03-18
Last edited by amiconn - 2005-05-17

FS#2475 - better USB mode handling if MMC plugged at startup

This patch avoids the prompt for MMC removal if plugged
right at the start. USB mode is handled before the
mounting, which else causes the first MMC access.

I have some issues with it, sometimes it gets confused
after leaving USB mode. Like, duplicating the MMC
content into the root (confusing cards, perhaps), or not
showing any content. Very strange, perhaps uncovering
an older bug.

Closed by  amiconn
2005-05-17 23:35
Reason for closing:  Accepted

I tried the patch on my Ondio SP and didn't have any issues
with it (this was after the MMC driver got updated to handle
blocksizes != 512 byte).

I fixed the marked issues in main.c (glitch protection,
timeout), and also some others.

@Jörg: Please test the new patch.

The 'break' was unnecessary, it only increased code size.

Some research remarks:

(1) I updated the patch again, using a better place for
setting the 'MMC touched' flag.

I do have another idea for determining the state on boot.
Instead of simply 'guessing' (!coldstart meaning MMC was
probably touched, which is incorrect when booting a
non-flashed box, or left-booting), we can actually probe the
card without switching it. This is possible because the card
only switches to SPI mode when it receives a CMD0 and /CS is
low. So if we send another command instead (e.g. CMD1), the
card won't switch to SPI mode just because of that. If we
receive an answer, it already is in SPI mode, otherwise it's

(2) I also observed the described behaviour (MMC contents
both as root volume and under /<MMC1>) now, but it seems
this is unrelated o the early USB handling. I found a way to
quite reliably reproduce it:

a) Ondio switched off, MMC in slot, but standing out ~8 mm
so it doesn't get detected

b) Switch on the Ondio, and after approx. one second
(rockbox logo still displayed), push in the card. ⇒ message
"No .rockbox directory…", and 2x card contents

This looks like a mount race to me. Both the main mount and
the MMC thread try to mount at the same time…

Awaiting comments….

Patch updated to current cvs.

- Removed the extra USB check and the start of dirbrowse()

as it is no longer necessary with early USB detection and
may even cause deadlocks (there's a bug report)

- Try to detect correct MMC state when in doubt as described


- Small fix for player (no double height)

Awaiting comments/ test results, not only from Ondio owners…


Available keyboard shortcuts


Task Details

Task Editing