From a7548d3bc7b4cb91553a59a06490290869270437 Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Mon, 20 Jul 2009 13:47:21 +0000 Subject: [PATCH] Make sd_present() and mmc_present() look only at the actual presence of a card, not at initialisation state git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21981 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/ata_mmc.c | 9 ++++++++- firmware/target/arm/as3525/ata_sd_as3525.c | 9 ++++++++- firmware/target/arm/ata-sd-pp.c | 9 ++++++++- firmware/target/arm/tcc780x/sd-tcc780x.c | 7 +++---- firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c | 4 ++-- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index 239778577d..01b8a6f029 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c @@ -999,7 +999,14 @@ bool mmc_present(IF_MD_NONVOID(int drive)) #ifndef HAVE_MULTIDRIVE const int drive=0; #endif - return (card_info[drive].initialized && card_info[drive].numblocks > 0); + if(drive==0) + { + return true; + } + else + { + return mmc_detect(); + } } #endif diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c index bca52a09f1..995bf932ca 100644 --- a/firmware/target/arm/as3525/ata_sd_as3525.c +++ b/firmware/target/arm/as3525/ata_sd_as3525.c @@ -522,7 +522,14 @@ bool sd_present(IF_MD_NONVOID(int drive)) #ifndef HAVE_MULTIDRIVE const int drive=0; #endif - return (card_info[drive].initialized && card_info[drive].numblocks > 0); + if(drive==0) + { + return true; + } + else + { + return card_detect_target(); + } } #endif diff --git a/firmware/target/arm/ata-sd-pp.c b/firmware/target/arm/ata-sd-pp.c index f963e0ac48..78a2a4f3a4 100644 --- a/firmware/target/arm/ata-sd-pp.c +++ b/firmware/target/arm/ata-sd-pp.c @@ -1345,7 +1345,14 @@ bool sd_present(IF_MD_NONVOID(int drive)) #ifndef HAVE_MULTIDRIVE const int drive=0; #endif - return (card_info[drive].initialized && card_info[drive].numblocks > 0); + if(drive==0) + { + return true; + } + else + { + return card_detect_target(); + } } #endif diff --git a/firmware/target/arm/tcc780x/sd-tcc780x.c b/firmware/target/arm/tcc780x/sd-tcc780x.c index 8b0ac8a8a6..bb426d8125 100644 --- a/firmware/target/arm/tcc780x/sd-tcc780x.c +++ b/firmware/target/arm/tcc780x/sd-tcc780x.c @@ -252,11 +252,10 @@ bool sd_removable(IF_MD_NONVOID(int card_no)) bool sd_present(IF_MD_NONVOID(int card_no)) { -#ifndef HAVE_MULTIDRIVE - const int card_no = 0; +#ifdef HAVE_MULTIDRIVE + (void)card_no; #endif - return (card_info[card_no].initialized && - card_info[card_no].numblocks > 0); + return card_detect_target(); } #else diff --git a/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c b/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c index b1a9d599d9..544e0cf481 100644 --- a/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c @@ -1366,10 +1366,10 @@ bool sd_removable(IF_MV_NONVOID(int drive)) bool sd_present(IF_MV_NONVOID(int drive)) { -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE (void)drive; #endif - return (card.numblocks > 0 && card_detect_target()); + return card_detect_target(); } #ifdef CONFIG_STORAGE_MULTI