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

Settings FILE subsystem is not working with SD card with FAT filesystem #72741

Open
Mierunski opened this issue May 14, 2024 · 2 comments
Open
Assignees
Labels
area: Settings Settings subsystem bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@Mierunski
Copy link
Collaborator

Describe the bug
Settings FILE subsystem is not working with SD card with FAT filesystem, providing file directory with /SD:/ prefix results in fail to load or create settings file.

I'm testing on nRF9160DK with external SD Card module.

When settings file subsystem is trying to create directory for file, it checks directories if they exist one by one.
Because mount point is first directory in path, fs_stat returns -ENOENT after that fs_mkdir is called which returns -EEXIST
https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/settings/src/settings_file.c#L524

For workaround, i tested substitiuting expression in https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/settings/src/settings_file.c#L548 to err && err != -EEXIST
After that code is working, but it does not seem like a final solution

To Reproduce
Take a board with SD Card, enable Filesystem backend for setting

CONFIG_SETTINGS=y
CONFIG_SETTINGS_FILE=y
CONFIG_SETTINGS_FILE_PATH="/SD:/setts.ini"
CONFIG_FILE_SYSTEM=y
CONFIG_FAT_FILESYSTEM_ELM=y

Expected behavior
Settings file backend works correctly

Impact
Settings file backend is useless without additional zephyr patch kept separately

Logs and console output

*** Booting nRF Connect SDK v3.5.99-ncs1 ***
[00:00:00.577,209] <inf> sd: Maximum SD clock is under 25MHz, using clock of 8000000Hz

Listing dir /SD: ...
[DIR ] System Volume Information
[FILE] setts.ini (size = 486)
[FILE] global_data.json (size = 124)
[DIR ] log
[00:00:00.590,087] <inf> APP: Application started
path = /SD:, err = -2
[00:00:00.590,209] <err> fs: failed to create directory (-17)
settings_subsys_init failed (err -17)

Environment (please complete the following information):

  • OS: Windows
  • Toolchain NCS v2.6.0
  • Version used v3.5.99-ncs1
@Mierunski Mierunski added bug The issue is a bug, or the PR is fixing a bug area: Settings Settings subsystem labels May 14, 2024
@aescolar
Copy link
Member

This issue seems to relate to Nordic's Connect SDK.
If the issue is present in Zephyr please provide the information requested in the bug template so the it can be reproduced in upstream Zephyr without NCS.
Otherwise please file the issue downstream instead.

@aescolar
Copy link
Member

aescolar commented May 14, 2024

CC @de-nordic @mniestroj

@aescolar aescolar added the priority: low Low impact/importance bug label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Settings Settings subsystem bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

3 participants