Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 42fc2fb

Browse filesBrowse files
authored
When FFat is mounted before SD, then filesystem reports wrong system sizes (espressif#8520)
* Fixes wrong usedbytes/totalbytes results. drive id was implemented fixed, does not work with arbitrary initialization. See espressif#3546 * Fixing indention/tabs
1 parent f197150 commit 42fc2fb
Copy full SHA for 42fc2fb

File tree

Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed

‎libraries/SD/src/SD.cpp

Copy file name to clipboardExpand all lines: libraries/SD/src/SD.cpp
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ uint64_t SDFS::totalBytes()
9595
{
9696
FATFS* fsinfo;
9797
DWORD fre_clust;
98-
if(f_getfree("0:",&fre_clust,&fsinfo)!= 0) return 0;
99-
uint64_t size = ((uint64_t)(fsinfo->csize))*(fsinfo->n_fatent - 2)
98+
char drv[3] = {(char)(48+_pdrv), ':', 0};
99+
if(f_getfree(drv,&fre_clust,&fsinfo)!= 0) return 0;
100+
uint64_t size = ((uint64_t)(fsinfo->csize))*(fsinfo->n_fatent - 2)
100101
#if _MAX_SS != 512
101102
*(fsinfo->ssize);
102103
#else
@@ -109,7 +110,8 @@ uint64_t SDFS::usedBytes()
109110
{
110111
FATFS* fsinfo;
111112
DWORD fre_clust;
112-
if(f_getfree("0:",&fre_clust,&fsinfo)!= 0) return 0;
113+
char drv[3] = {(char)(48+_pdrv), ':', 0};
114+
if(f_getfree(drv,&fre_clust,&fsinfo)!= 0) return 0;
113115
uint64_t size = ((uint64_t)(fsinfo->csize))*((fsinfo->n_fatent - 2) - (fsinfo->free_clst))
114116
#if _MAX_SS != 512
115117
*(fsinfo->ssize);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.