Skip to content

Commit 9fe1909

Browse files
authored
Fix error in size()
The size() function incorrectly returned the block size instead of the block size times the block count. This sent FATFileSystem::reformat() into an mbed_assert_internal - mbed_error - mbed_halt_system sequence, when disk_get_sector_count() in FATFileSystem.cpp calculates scount as 1 as a consequence. Thus, it wasn't possible to format FAT file systems on USB thumb drives.
1 parent a5b5cbc commit 9fe1909

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/USBHostMSD/USBHostMSD.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ mbed::bd_size_t USBHostMSD::get_erase_size() const
401401
mbed::bd_size_t USBHostMSD::size() const
402402
{
403403
USB_DBG("FILESYSTEM: size ");
404-
return (disk_init ? (mbed::bd_size_t)blockSize : 0);
404+
return (disk_init ? (mbed::bd_size_t)blockCount*blockSize : 0);
405405
}
406406

407407
const char *USBHostMSD::get_type() const

0 commit comments

Comments
 (0)