1.sd卡挂载检测优化
This commit is contained in:
parent
3ff91d1451
commit
2cf15cc0a9
|
@ -2154,22 +2154,55 @@ void serach_gps_onkey_start(void)
|
|||
}
|
||||
pthread_attr_destroy(&attr);
|
||||
}
|
||||
static int sf_is_sdc_mounted(void)
|
||||
{
|
||||
char line[256];
|
||||
printf("%s:%d is_mounted:%d", __FUNCTION__, __LINE__);
|
||||
|
||||
|
||||
FILE *file = fopen("/proc/mounts", "r");
|
||||
if (file == NULL) {
|
||||
perror("Error opening /proc/mounts");
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (fgets(line, sizeof(line), file)) {
|
||||
if (strstr(line, "/dev/mmcblk0p1") != NULL) {
|
||||
fclose(file);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
return 1;
|
||||
}
|
||||
int sf_check_sd(void)
|
||||
{
|
||||
UINT8 i = 0;
|
||||
int ret = SF_SUCCESS;
|
||||
if (sf_sd_status_get() != SF_SD_OK) {
|
||||
ret = SF_FAILURE;
|
||||
for (i = 0; i < 20; i++) {
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
ret = sf_sd_status_get();
|
||||
if (SF_SD_OK == ret) {
|
||||
if (SF_SD_OK == ret)
|
||||
{
|
||||
ret = SF_SUCCESS;
|
||||
MLOGI("SD\r\n");
|
||||
sf_statistics_param_load(sf_statistics_param_get());
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (1 == sf_is_sdc_mounted())
|
||||
{
|
||||
ret = SF_SUCCESS;
|
||||
MLOGI("mounted SD\r\n");
|
||||
sf_statistics_param_load(sf_statistics_param_get());
|
||||
break;
|
||||
}
|
||||
sleep(1);
|
||||
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue
Block a user