Fix newly introduced race condition in SD driver. Make sure to force remount in case two SYS_HOTSWAP_INSERTED messages are received in a row. Be sure flags are reset to re-initialize the SD-card. Go back to locking out driver access during disk mount/unmount attempts.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16635 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2008-03-12 02:50:07 +00:00
parent d80246fac0
commit 2f5a37de5c

View file

@ -1045,13 +1045,22 @@ static void sd_thread(void)
{
#ifdef HAVE_HOTSWAP
case SYS_HOTSWAP_INSERTED:
mutex_lock(&sd_mtx); /* Lock-out card activity */
card_info[1].initialized = 0;
sd_status[1].retry = 0;
disk_unmount(1); /* Force remount */
disk_mount(1); /* mount microSD card */
queue_broadcast(SYS_FS_CHANGED, 0);
mutex_unlock(&sd_mtx);
break;
case SYS_HOTSWAP_EXTRACTED:
mutex_lock(&sd_mtx); /* Lock-out card activity */
card_info[1].initialized = 0;
sd_status[1].retry = 0;
disk_unmount(1); /* release "by force" */
queue_broadcast(SYS_FS_CHANGED, 0);
mutex_unlock(&sd_mtx);
break;
#endif
case SYS_TIMEOUT: