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

Conflicts between saving to the flash while the USB host is active #1176

Open
bsstephan opened this issue Oct 1, 2024 · 0 comments · May be fixed by #1178
Open

Conflicts between saving to the flash while the USB host is active #1176

bsstephan opened this issue Oct 1, 2024 · 0 comments · May be fixed by #1178
Assignees
Labels
bug Something isn't working

Comments

@bsstephan
Copy link
Contributor

It is unsupported to write to flash from one core while the other is using it. Our runtime flash users are the configuration and tinyusb. The current implementation has writeToFlash use multicore_lockout before writing to essentially disable interrupts on the other core (where tinyusb is running). This keeps from crashing the USB host, but the disabling of interrupts does cause e.g. a MagicBoots to unpair and thus authentication can be dropped if that's in the middle of happening when interrupts are disabled.

Meanwhile, we save the config to flash in the following instances:

  • in Turbo when changing the shot count
  • in NeoPicoLED (?? need to look into this one)
  • ConfigManager::setGamepadOptions but this looks like vestigial code
  • changing JS modes
  • changing SOCD cleaner modes
  • setting invert X/Y axis
  • setting 4-way modes
  • changing profiles
  • changing input modes (at boot time)

Most of these are just saving to config after changing a runtime setting, e.g. the SOCD modes, profiles, and similar toggles. In order to not interrupt auth, I think not saving, or saving in a more limited/controlled manner, is worth investigating.

@bsstephan bsstephan added the bug Something isn't working label Oct 1, 2024
@bsstephan bsstephan linked a pull request Oct 1, 2024 that will close this issue
@bsstephan bsstephan self-assigned this Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant