This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#12468 - Hotswap fails to recognize the card after it was removed in USB mode
|
DetailsIf Rockbox is connected via USB with no sd card inserted and it is inserted, it offers the OS to mount the new drive.
If the sd card is removed and reinsterted again, it fails to offer and recognize it. I could locate the problem in firmware/usbstack/usb_storage.c in the line if(inserted && check_disk_present(IF_MD(volume))) { after reinserting the card, check_disk_present fails to return true, so this check fails and the card isn't recognized anymore. |
This task depends upon
The initial contents of memory pointed to by the return value of fat_get_sector_buffer() don't matter. That's just some free memory where storage_read_sectors() can write.
On what device is this happening? Is this on Fuze+ and related to
FS#12458?Further investigations on this bug reveals, that indeed storage_read_sectors returns a -1 instead of 0 when the sd card is reinserted.
storage_read_sectors calls sd_read_sectors which calls transfer_sectors. And this is indeed a fuze+ specific implementation.
I'll investigate this problem further to see, which part of transfer_sectors fails.
ret = sd_wait_for_tran_state();
sets ret to -1.
Investigating further it seems to hint to a timeout during the following lines:
---
while(!send_cmd(SD_SEND_STATUS, card_info.rca, SSP_SHORT_RESP, &response) && cmd_retry > 0)
cmd_retry--;
if(cmd_retry <= 0)
return -1;
---
cmd_retry is set to 10, but no values like 20 or 100 brought the desired result, so it seems that something in send_cmd(SD_SEND_STATUS... goes wrong.
But other thing is, that SSP_SHORT_RESP has the value of 1 and MCI_ACMD is 4, so send_cmd automatically should have (flags & MCI_ACMD) checked to false as this should become 0, so send_cmd always returns false and won't read. Does this make any sense?