From 82667e8c179bd559755783e166f2fd82cd73043d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Procha=CC=81zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 29 Sep 2021 16:12:22 +0200 Subject: [PATCH 1/3] SD.open() new feature for creating all folders in path This PR adds to the SD.open() function option to create all folders to the file. SD.open(const char* path, const char* mode, const bool create) Default value of create is false. When true folders are created. From issue #5019 --- libraries/FS/src/vfs_api.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/FS/src/vfs_api.cpp b/libraries/FS/src/vfs_api.cpp index e43b4397452..e18243dab7b 100644 --- a/libraries/FS/src/vfs_api.cpp +++ b/libraries/FS/src/vfs_api.cpp @@ -75,7 +75,7 @@ FileImplPtr VFSImpl::open(const char* fpath, const char* mode, const bool create while (token != NULL) { - memcpy(folder,fpath + start_index, end_index-start_index); + memccpy(folder,fpath + start_index, NULL, end_index-start_index); folder[end_index-start_index] = '\0'; if(!VFSImpl::mkdir(folder)) From 40e1cc447108bc755c66ec770875d59a6ac5a999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Procha=CC=81zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Thu, 30 Sep 2021 10:09:03 +0200 Subject: [PATCH 2/3] Update vfs_api.cpp memccpy -> memcpy --- libraries/FS/src/vfs_api.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/FS/src/vfs_api.cpp b/libraries/FS/src/vfs_api.cpp index e18243dab7b..e43b4397452 100644 --- a/libraries/FS/src/vfs_api.cpp +++ b/libraries/FS/src/vfs_api.cpp @@ -75,7 +75,7 @@ FileImplPtr VFSImpl::open(const char* fpath, const char* mode, const bool create while (token != NULL) { - memccpy(folder,fpath + start_index, NULL, end_index-start_index); + memcpy(folder,fpath + start_index, end_index-start_index); folder[end_index-start_index] = '\0'; if(!VFSImpl::mkdir(folder)) From f0696326df232ba0e928d6995f7eaf1d70547141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Procha=CC=81zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 4 Oct 2021 12:22:35 +0200 Subject: [PATCH 3/3] SD_MMC deinit fix Wrong deinit function was called. --- libraries/SD_MMC/src/SD_MMC.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/SD_MMC/src/SD_MMC.cpp b/libraries/SD_MMC/src/SD_MMC.cpp index 450657cfa6f..ba06c261cf9 100644 --- a/libraries/SD_MMC/src/SD_MMC.cpp +++ b/libraries/SD_MMC/src/SD_MMC.cpp @@ -54,7 +54,7 @@ bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount host.set_bus_ddr_mode = &sdmmc_host_set_bus_ddr_mode; host.set_card_clk = &sdmmc_host_set_card_clk; host.do_transaction = &sdmmc_host_do_transaction; - host.deinit_p = &sdspi_host_remove_device; + host.deinit = &sdmmc_host_deinit; host.io_int_enable = &sdmmc_host_io_int_enable; host.io_int_wait = &sdmmc_host_io_int_wait; host.command_timeout_ms = 0;