Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(usb/esp_tinyusb): Fix backward compatibility for MSC max_files #244

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion usb/esp_tinyusb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 1.4.1
## 1.4.2

- MSC: Fix maximum files open
- Add uninstall function
Expand Down
2 changes: 1 addition & 1 deletion usb/esp_tinyusb/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
description: Espressif's additions to TinyUSB
documentation: "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/peripherals/usb_device.html"
version: 1.4.1
version: 1.4.2
url: https://github.com/espressif/idf-extra-components/tree/master/usb/esp_tinyusb
dependencies:
idf: '>=5.0' # IDF 4.x contains TinyUSB as submodule
Expand Down
12 changes: 10 additions & 2 deletions usb/esp_tinyusb/tusb_msc_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,11 @@ esp_err_t tinyusb_msc_storage_init_spiflash(const tinyusb_msc_spiflash_config_t
s_storage_handle->is_fat_mounted = false;
s_storage_handle->base_path = NULL;
s_storage_handle->wl_handle = config->wl_handle;
s_storage_handle->max_files = config->mount_config.max_files;
// In case the user does not set mount_config.max_files
// and for backward compatibility with versions <1.4.2
// max_files is set to 2
const int max_files = config->mount_config.max_files;
s_storage_handle->max_files = max_files > 0 ? max_files : 2;

/* Callbacks setting up*/
if (config->callback_mount_changed) {
Expand Down Expand Up @@ -419,7 +423,11 @@ esp_err_t tinyusb_msc_storage_init_sdmmc(const tinyusb_msc_sdmmc_config_t *confi
s_storage_handle->is_fat_mounted = false;
s_storage_handle->base_path = NULL;
s_storage_handle->card = config->card;
s_storage_handle->max_files = config->mount_config.max_files;
// In case the user does not set mount_config.max_files
// and for backward compatibility with versions <1.4.2
// max_files is set to 2
const int max_files = config->mount_config.max_files;
s_storage_handle->max_files = max_files > 0 ? max_files : 2;

/* Callbacks setting up*/
if (config->callback_mount_changed) {
Expand Down
Loading