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

bluetooth: fast_pair: Delete "reset" flag instead of storing false #11686

Merged
merged 2 commits into from
Jul 5, 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
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,11 @@ Binary libraries
Bluetooth libraries and services
--------------------------------

* :ref:`bt_fast_pair_readme` library:

* Deleted reset in progress flag from settings storage instead of storing it as ``false`` on factory reset operation.
This is done to ensure that no Fast Pair data is left in the settings storage after the factory reset.

* :ref:`bt_mesh` library:

* Added:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,13 @@ static int reset_in_progress_set(bool in_progress)
{
int err;

err = settings_save_one(SETTINGS_RESET_IN_PROGRESS_FULL_NAME, &in_progress,
sizeof(in_progress));
if (in_progress) {
err = settings_save_one(SETTINGS_RESET_IN_PROGRESS_FULL_NAME, &in_progress,
sizeof(in_progress));
} else {
err = settings_delete(SETTINGS_RESET_IN_PROGRESS_FULL_NAME);
}

if (err) {
return err;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,35 +182,6 @@ static int fp_settings_data_validate_empty_cb(const char *key, size_t len, setti
return 0;
}

if (!strncmp(key, SETTINGS_RESET_IN_PROGRESS_FULL_NAME,
sizeof(SETTINGS_RESET_IN_PROGRESS_FULL_NAME))) {
int rc;
bool reset_in_progress;

if (len != sizeof(reset_in_progress)) {
*err = -EINVAL;
return *err;
}

rc = read_cb(cb_arg, &reset_in_progress, len);
if (rc < 0) {
*err = rc;
return *err;
}

if (rc != len) {
*err = -EINVAL;
return *err;
}

if (reset_in_progress) {
*err = -EFAULT;
return *err;
}

return 0;
}

*err = -EFAULT;
return *err;
}
Expand Down