From 1a0596a2fbb68c1285ec59606d03a610ee94ca47 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 19 Feb 2019 14:45:45 -0800 Subject: Add option to disable the concurrent write protection This allows writing to the filesystem from the host computer and CircuitPython by increasing the risk of filesystem corruption. --- shared-module/storage/__init__.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'shared-module/storage') diff --git a/shared-module/storage/__init__.c b/shared-module/storage/__init__.c index f09edd785..215e1356a 100644 --- a/shared-module/storage/__init__.c +++ b/shared-module/storage/__init__.c @@ -143,7 +143,7 @@ mp_obj_t common_hal_storage_getmount(const char *mount_path) { return storage_object_from_path(mount_path); } -void common_hal_storage_remount(const char *mount_path, bool readonly) { +void common_hal_storage_remount(const char *mount_path, bool readonly, bool disable_concurrent_write_protection) { if (strcmp(mount_path, "/") != 0) { mp_raise_OSError(MP_EINVAL); } @@ -156,7 +156,8 @@ void common_hal_storage_remount(const char *mount_path, bool readonly) { } #endif - supervisor_flash_set_usb_writable(readonly); + filesystem_set_internal_writable_by_usb(readonly); + filesystem_set_internal_concurrent_write_protection(!disable_concurrent_write_protection); } void common_hal_storage_erase_filesystem(void) { -- cgit v1.2.3