|
@@ -16,6 +16,10 @@
|
|
|
#include "drivers/usb_device.h"
|
|
|
#include "mstorage.h"
|
|
|
|
|
|
+#ifdef RT_USING_DFS_MNTTABLE
|
|
|
+#include "dfs_fs.h"
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef RT_USB_DEVICE_MSTORAGE
|
|
|
|
|
|
enum STAT
|
|
@@ -955,7 +959,7 @@ static rt_err_t _function_enable(ufunction_t func)
|
|
|
struct mstorage *data;
|
|
|
RT_ASSERT(func != RT_NULL);
|
|
|
RT_DEBUG_LOG(RT_DEBUG_USB, ("Mass storage function enabled\n"));
|
|
|
- data = (struct mstorage*)func->user_data;
|
|
|
+ data = (struct mstorage*)func->user_data;
|
|
|
|
|
|
data->disk = rt_device_find(RT_USB_MSTORAGE_DISK_NAME);
|
|
|
if(data->disk == RT_NULL)
|
|
@@ -964,6 +968,10 @@ static rt_err_t _function_enable(ufunction_t func)
|
|
|
return -RT_ERROR;
|
|
|
}
|
|
|
|
|
|
+#ifdef RT_USING_DFS_MNTTABLE
|
|
|
+ dfs_unmount_device(data->disk);
|
|
|
+#endif
|
|
|
+
|
|
|
if(rt_device_open(data->disk, RT_DEVICE_OFLAG_RDWR) != RT_EOK)
|
|
|
{
|
|
|
rt_kprintf("disk open error\n");
|
|
@@ -1029,6 +1037,9 @@ static rt_err_t _function_disable(ufunction_t func)
|
|
|
if(data->disk != RT_NULL)
|
|
|
{
|
|
|
rt_device_close(data->disk);
|
|
|
+#ifdef RT_USING_DFS_MNTTABLE
|
|
|
+ dfs_mount_device(data->disk);
|
|
|
+#endif
|
|
|
data->disk = RT_NULL;
|
|
|
}
|
|
|
|