From 121b95ef75ef85197dcd13b86f77c8550361c730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20M=C3=BAdry?= Date: Tue, 16 Sep 2025 14:46:27 +0200 Subject: [PATCH 1/4] fix: Update cherryusb_host and examples using esp_tinyusb and usb_host_msc --- .../peripherals/usb/device/tusb_hid/main/idf_component.yml | 2 +- .../usb/device/tusb_midi/main/idf_component.yml | 2 +- .../peripherals/usb/device/tusb_msc/main/idf_component.yml | 2 +- .../peripherals/usb/device/tusb_ncm/main/idf_component.yml | 2 +- examples/peripherals/usb/host/cherryusb_host/main/msc.c | 7 ++++++- examples/peripherals/usb/host/msc/main/idf_component.yml | 2 +- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/peripherals/usb/device/tusb_hid/main/idf_component.yml b/examples/peripherals/usb/device/tusb_hid/main/idf_component.yml index 03340b8fe0..e1a93a262e 100644 --- a/examples/peripherals/usb/device/tusb_hid/main/idf_component.yml +++ b/examples/peripherals/usb/device/tusb_hid/main/idf_component.yml @@ -1,4 +1,4 @@ ## IDF Component Manager Manifest File dependencies: espressif/esp_tinyusb: - version: "^2.0.0" + version: "^2.0.1~1" diff --git a/examples/peripherals/usb/device/tusb_midi/main/idf_component.yml b/examples/peripherals/usb/device/tusb_midi/main/idf_component.yml index 03340b8fe0..e1a93a262e 100644 --- a/examples/peripherals/usb/device/tusb_midi/main/idf_component.yml +++ b/examples/peripherals/usb/device/tusb_midi/main/idf_component.yml @@ -1,4 +1,4 @@ ## IDF Component Manager Manifest File dependencies: espressif/esp_tinyusb: - version: "^2.0.0" + version: "^2.0.1~1" diff --git a/examples/peripherals/usb/device/tusb_msc/main/idf_component.yml b/examples/peripherals/usb/device/tusb_msc/main/idf_component.yml index 03340b8fe0..e1a93a262e 100644 --- a/examples/peripherals/usb/device/tusb_msc/main/idf_component.yml +++ b/examples/peripherals/usb/device/tusb_msc/main/idf_component.yml @@ -1,4 +1,4 @@ ## IDF Component Manager Manifest File dependencies: espressif/esp_tinyusb: - version: "^2.0.0" + version: "^2.0.1~1" diff --git a/examples/peripherals/usb/device/tusb_ncm/main/idf_component.yml b/examples/peripherals/usb/device/tusb_ncm/main/idf_component.yml index 03340b8fe0..e1a93a262e 100644 --- a/examples/peripherals/usb/device/tusb_ncm/main/idf_component.yml +++ b/examples/peripherals/usb/device/tusb_ncm/main/idf_component.yml @@ -1,4 +1,4 @@ ## IDF Component Manager Manifest File dependencies: espressif/esp_tinyusb: - version: "^2.0.0" + version: "^2.0.1~1" diff --git a/examples/peripherals/usb/host/cherryusb_host/main/msc.c b/examples/peripherals/usb/host/cherryusb_host/main/msc.c index 97f897c812..346851eea6 100644 --- a/examples/peripherals/usb/host/cherryusb_host/main/msc.c +++ b/examples/peripherals/usb/host/cherryusb_host/main/msc.c @@ -273,7 +273,12 @@ esp_err_t msc_host_vfs_register(struct usbh_msc *msc_class, strcpy(vfs->base_path, base_path); vfs->pdrv = pdrv; - ret = esp_vfs_fat_register(base_path, drive, mount_config->max_files, &fs); + esp_vfs_fat_conf_t conf = { + .base_path = base_path, + .fat_drive = drive, + .max_files = mount_config->max_files, + }; + ret = esp_vfs_fat_register_cfg(&conf, &fs); ESP_GOTO_ON_ERROR(ret, fail, TAG, "Failed to register filesystem, error=%s", esp_err_to_name(ret)); vfs->fs = fs; diff --git a/examples/peripherals/usb/host/msc/main/idf_component.yml b/examples/peripherals/usb/host/msc/main/idf_component.yml index 198a93bbf4..df732fdb80 100644 --- a/examples/peripherals/usb/host/msc/main/idf_component.yml +++ b/examples/peripherals/usb/host/msc/main/idf_component.yml @@ -1,4 +1,4 @@ ## IDF Component Manager Manifest File dependencies: idf: ">=4.4" - usb_host_msc: "^1.1.1" + usb_host_msc: "^1.1.4" From 092a5ba5a54d9592ff8eaaa016def12a37fc7995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20M=C3=BAdry?= Date: Tue, 16 Sep 2025 14:56:59 +0200 Subject: [PATCH 2/4] refactor(fatfs): Update esp_vfs_fat_register function prototype to match esp_vfs_fat_register_cfg --- components/fatfs/vfs/esp_vfs_fat.h | 9 +++++---- components/fatfs/vfs/vfs_fat.c | 14 +++----------- .../migration-guides/release-6.x/6.0/storage.rst | 6 ++++-- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/components/fatfs/vfs/esp_vfs_fat.h b/components/fatfs/vfs/esp_vfs_fat.h index 332a131c80..b8ac7e625c 100644 --- a/components/fatfs/vfs/esp_vfs_fat.h +++ b/components/fatfs/vfs/esp_vfs_fat.h @@ -66,7 +66,7 @@ typedef struct { * - ESP_ERR_INVALID_STATE if esp_vfs_fat_register was already called * - ESP_ERR_NO_MEM if not enough memory or too many VFSes already registered */ -esp_err_t esp_vfs_fat_register_cfg(const esp_vfs_fat_conf_t* conf, FATFS** out_fs); +esp_err_t esp_vfs_fat_register(const esp_vfs_fat_conf_t* conf, FATFS** out_fs); /** * @brief Un-register FATFS from VFS @@ -446,11 +446,11 @@ esp_err_t esp_vfs_fat_test_contiguous_file(const char* base_path, const char* fu /** @cond */ /** - * @deprecated Please use `esp_vfs_fat_register_cfg` instead + * @deprecated Please use `esp_vfs_fat_register` instead */ -esp_err_t esp_vfs_fat_register(const char* base_path, const char* fat_drive, - size_t max_files, FATFS** out_fs); +esp_err_t esp_vfs_fat_register_cfg(const esp_vfs_fat_conf_t* conf, FATFS** out_fs); +#ifndef CONFIG_IDF_TARGET_LINUX /** * @deprecated Please use `esp_vfs_fat_spiflash_mount_rw_wl` instead */ @@ -479,6 +479,7 @@ esp_err_t esp_vfs_fat_rawflash_mount(const char* base_path, */ esp_err_t esp_vfs_fat_rawflash_unmount(const char* base_path, const char* partition_label) __attribute__((deprecated("esp_vfs_fat_rawflash_unmount is deprecated, please use esp_vfs_fat_spiflash_unmount_ro instead"))); +#endif /** @endcond */ #ifdef __cplusplus diff --git a/components/fatfs/vfs/vfs_fat.c b/components/fatfs/vfs/vfs_fat.c index aeab037f57..64ff7ab57b 100644 --- a/components/fatfs/vfs/vfs_fat.c +++ b/components/fatfs/vfs/vfs_fat.c @@ -138,16 +138,6 @@ static size_t find_unused_context_index(void) return FF_VOLUMES; } -esp_err_t esp_vfs_fat_register(const char* base_path, const char* fat_drive, size_t max_files, FATFS** out_fs) -{ - esp_vfs_fat_conf_t conf = { - .base_path = base_path, - .fat_drive = fat_drive, - .max_files = max_files, - }; - return esp_vfs_fat_register_cfg(&conf, out_fs); -} - #ifdef CONFIG_VFS_SUPPORT_DIR static const esp_vfs_dir_ops_t s_vfs_fat_dir = { .stat_p = &vfs_fat_stat, @@ -185,7 +175,7 @@ static const esp_vfs_fs_ops_t s_vfs_fat = { #endif // CONFIG_VFS_SUPPORT_DIR }; -esp_err_t esp_vfs_fat_register_cfg(const esp_vfs_fat_conf_t* conf, FATFS** out_fs) +esp_err_t esp_vfs_fat_register(const esp_vfs_fat_conf_t* conf, FATFS** out_fs) { size_t ctx = find_context_index_by_path(conf->base_path); if (ctx < FF_VOLUMES) { @@ -236,6 +226,8 @@ esp_err_t esp_vfs_fat_register_cfg(const esp_vfs_fat_conf_t* conf, FATFS** out_f return ESP_OK; } +esp_err_t esp_vfs_fat_register_cfg(const esp_vfs_fat_conf_t* conf, FATFS** out_fs) __attribute__((alias("esp_vfs_fat_register"))); + esp_err_t esp_vfs_fat_unregister_path(const char* base_path) { size_t ctx = find_context_index_by_path(base_path); diff --git a/docs/en/migration-guides/release-6.x/6.0/storage.rst b/docs/en/migration-guides/release-6.x/6.0/storage.rst index 281e09efee..0d7651ac6e 100644 --- a/docs/en/migration-guides/release-6.x/6.0/storage.rst +++ b/docs/en/migration-guides/release-6.x/6.0/storage.rst @@ -3,11 +3,13 @@ Storage :link_to_translation:`zh_CN:[中文]` -Removed VFS SDMMC Deprecated API --------------------------------- +Breaking Changes +---------------- Deprecated ``esp_vfs_fat_sdmmc_unmount`` function is now removed. Please use ``esp_vfs_fat_sdcard_unmount`` instead. +Function prototype for ``esp_vfs_fat_register`` has been changed to match ``esp_vfs_fat_register_cfg`` function. ``esp_vfs_fat_register_cfg`` is now deprecated. + VFS --- From 785a018380f39cfbc67fb6002c2f01410adc60ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20M=C3=BAdry?= Date: Tue, 16 Sep 2025 15:04:53 +0200 Subject: [PATCH 3/4] fix: Update examples etc. to use esp_vfs_fat_register Instead of deprecated esp_vfs_fat_register_cfg --- components/fatfs/vfs/vfs_fat_sdmmc.c | 4 ++-- components/fatfs/vfs/vfs_fat_spiflash.c | 8 ++++---- examples/peripherals/usb/host/cherryusb_host/main/msc.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/fatfs/vfs/vfs_fat_sdmmc.c b/components/fatfs/vfs/vfs_fat_sdmmc.c index b559c0cd3f..51b901a339 100644 --- a/components/fatfs/vfs/vfs_fat_sdmmc.c +++ b/components/fatfs/vfs/vfs_fat_sdmmc.c @@ -155,12 +155,12 @@ static esp_err_t esp_vfs_fat_mount_internal(const esp_vfs_fat_mount_config_t *mo .fat_drive = drv, .max_files = mount_config->max_files, }; - err = esp_vfs_fat_register_cfg(&conf, &fs); + err = esp_vfs_fat_register(&conf, &fs); *out_fs = fs; if (err == ESP_ERR_INVALID_STATE) { // it's okay, already registered with VFS } else if (err != ESP_OK) { - ESP_LOGD(TAG, "esp_vfs_fat_register_cfg failed 0x(%x)", err); + ESP_LOGD(TAG, "esp_vfs_fat_register failed 0x(%x)", err); goto fail; } diff --git a/components/fatfs/vfs/vfs_fat_spiflash.c b/components/fatfs/vfs/vfs_fat_spiflash.c index a5f88a2519..aebc9a4923 100644 --- a/components/fatfs/vfs/vfs_fat_spiflash.c +++ b/components/fatfs/vfs/vfs_fat_spiflash.c @@ -177,11 +177,11 @@ esp_err_t esp_vfs_fat_spiflash_mount_rw_wl(const char* base_path, .fat_drive = drv, .max_files = mount_config->max_files, }; - ret = esp_vfs_fat_register_cfg(&conf, &fs); + ret = esp_vfs_fat_register(&conf, &fs); if (ret == ESP_ERR_INVALID_STATE) { // it's okay, already registered with VFS } else if (ret != ESP_OK) { - ESP_LOGD(TAG, "esp_vfs_fat_register_cfg failed 0x(%x)", ret); + ESP_LOGD(TAG, "esp_vfs_fat_register failed 0x(%x)", ret); goto fail; } @@ -367,11 +367,11 @@ esp_err_t esp_vfs_fat_spiflash_mount_ro(const char* base_path, .fat_drive = drv, .max_files = mount_config->max_files, }; - ret = esp_vfs_fat_register_cfg(&conf, &fs); + ret = esp_vfs_fat_register(&conf, &fs); if (ret == ESP_ERR_INVALID_STATE) { // it's okay, already registered with VFS } else if (ret != ESP_OK) { - ESP_LOGD(TAG, "esp_vfs_fat_register_cfg failed 0x(%x)", ret); + ESP_LOGD(TAG, "esp_vfs_fat_register failed 0x(%x)", ret); goto fail; } diff --git a/examples/peripherals/usb/host/cherryusb_host/main/msc.c b/examples/peripherals/usb/host/cherryusb_host/main/msc.c index 346851eea6..cf0e0d8de6 100644 --- a/examples/peripherals/usb/host/cherryusb_host/main/msc.c +++ b/examples/peripherals/usb/host/cherryusb_host/main/msc.c @@ -278,7 +278,7 @@ esp_err_t msc_host_vfs_register(struct usbh_msc *msc_class, .fat_drive = drive, .max_files = mount_config->max_files, }; - ret = esp_vfs_fat_register_cfg(&conf, &fs); + ret = esp_vfs_fat_register(&conf, &fs); ESP_GOTO_ON_ERROR(ret, fail, TAG, "Failed to register filesystem, error=%s", esp_err_to_name(ret)); vfs->fs = fs; From 90d561cec0f13adf628432e35ceff93519330c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20M=C3=BAdry?= Date: Tue, 6 Jan 2026 14:58:11 +0100 Subject: [PATCH 4/4] docs: Provide translation for esp_vfs_fat_register function prototype update --- docs/zh_CN/migration-guides/release-6.x/6.0/storage.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/zh_CN/migration-guides/release-6.x/6.0/storage.rst b/docs/zh_CN/migration-guides/release-6.x/6.0/storage.rst index a791b04dc5..190b3c673b 100644 --- a/docs/zh_CN/migration-guides/release-6.x/6.0/storage.rst +++ b/docs/zh_CN/migration-guides/release-6.x/6.0/storage.rst @@ -3,10 +3,12 @@ :link_to_translation:`en:[English]` -移除已弃用的 VFS SDMMC API ---------------------------- +重大变更 +-------- -``esp_vfs_fat_sdmmc_unmount`` 函数已弃用且被移除,请使用 ``esp_vfs_fat_sdcard_unmount`` 代替。 +已被弃用的 API ``esp_vfs_fat_sdmmc_unmount`` 现已移除,请使用 ``esp_vfs_fat_sdcard_unmount`` 代替。 + +``esp_vfs_fat_register`` 的函数原型已修改为与 ``esp_vfs_fat_register_cfg`` 函数保持一致。``esp_vfs_fat_register_cfg`` 现已弃用。 VFS