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:
parent
d80246fac0
commit
2f5a37de5c
1 changed files with 9 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue