Kaleidoscope icon indicating copy to clipboard operation
Kaleidoscope copied to clipboard

Backup/Restore interface for plugins

Open jeamland opened this issue 3 years ago • 2 comments
trafficstars

Is your feature request related to a problem? Please describe. Currently Chrysalis contains a hard-coded list of focus commands to run in order to effect a backup and/or restore of a device's EEPROM contents that is independent of the EEPROM layout of the firmware version(s) in question. This is rather unwieldy and makes is cumbersome to implement equivalent functionality in other environments, e.g. CLI builds.

Describe the solution you'd like Adding a backup/restore interface that plugins could opt in to would then allow a hypothetical central Backup plugin to collect and marshal all the data from the various plugins out, and to accept a set of marshalled data and provide it to the plugins.

jeamland avatar Oct 16 '22 07:10 jeamland

A quick idea: what if we had a Focus.inputMatchesBackup() function, which would simply match against backup. Alongside it, we'd have Focus.printBackup(cmd1, cmd2, ...), similar to Focus.printHelp(), but it would only print command names that should be backed up.

Then, the tool on the host side could query those commands one by one, and save their values.

I wouldn't include the values in the printBackup() output, because the Focus protocol doesn't make it possible to send multiple results, we'd need to special-case backup, and I'd rather not do that. Echoing the commands that should be backed up is sufficient help, I think. It makes it possible for us to not hardcode the list. We still would need to query those values one by one, but that's just a loop.

algernon avatar Oct 16 '22 08:10 algernon

With a command table architecture like #1285, we could add a flag to the command table entry to signal that a command is backup-suitable.

tlyu avatar Oct 19 '22 13:10 tlyu