Skip to content

Commit

Permalink
add eject method when the SD card is removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
halyssonJr committed Dec 9, 2024
1 parent 4b4fa30 commit 9c9640f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Source/implementations/f7/Meadow.F7/F7FileSystemInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class F7FileSystemInfo : IPlatformOS.FileSystemInfo

internal F7FileSystemInfo(StorageCapabilities capabilities, bool sdSupported)
{
_drives.Add(F7StorageInformation.Create(Resolver.Device));
// _drives.Add(F7StorageInformation.Create(Resolver.Device));

_sdSupported = sdSupported;

Expand Down Expand Up @@ -59,6 +59,7 @@ private void HandleInserted()
{
if (F7ExternalStorage.TryMount("/dev/mmcsd0", "/sdcard", out _sdCard))
{
_drives.Add(_sdCard);
RaiseExternalStorageEvent(_sdCard, ExternalStorageState.Inserted);
}
}
Expand All @@ -69,6 +70,8 @@ private void HandleRemoved()
if (_sdCard != null)
{
RaiseExternalStorageEvent(_sdCard, ExternalStorageState.Ejected);
_sdCard.Eject();
_drives.Clear();
_sdCard = null;
}
}
Expand Down

0 comments on commit 9c9640f

Please sign in to comment.