hrvach / deskhop

Fast Desktop Switching Device
GNU General Public License v3.0
6.44k stars 188 forks source link

(roadmap proposal) Text-based configuration management #91

Closed kpfleming closed 5 months ago

kpfleming commented 7 months ago

As noted in #72, it would be useful for users to be able to manage their configuration without having to compile/recompile firmware. This would also allow users to upgrade to new firmware releases directly using builds from the repository (and via LVFS).

I've been working on a plan for this, which includes a number of steps:

  1. Implement firmware and configuration upload/download via DFU (#78)
  2. Cleanup config_t and ensure that it includes all of the user configuration (including KBD_LED_AS_INDICATOR, HOTKEY_TOGGLE, etc. which are currently compiled directly into the code) (implemented)
  3. Add a host-side tool which can import/export configuration using an INI-style text file (implemented, example INI file)
  4. Add INI upload/download via DFU
  5. Use INI export/import during the DFU firmware upgrade process to preserve configuration across firmware upgrades that change the configuration version

I'm using minIni as the INI-file library, it's small enough and simple enough to be incorporated into the firmware without a major increase in size.

I waited to open this issue until I had items 1-3 already implemented and tested, to be certain that I actually could implement them :-)

All feedback welcome; if this approach is acceptable, I'll open followup PRs as each of the earlier ones are merged, eventually getting to completion at step 5.

raldnor commented 7 months ago

Great work! Excellent documentation in the ini-files as well. Would it be possible to protect the DFU ini upload with something like a password or pin, requiring a new firmware upload to reset such a password/pin?

hrvach commented 7 months ago

I have an alternative idea for a friendly config without any external software, but need to try a proof of concept when I'm finally back from work trip - I'm curious if it would be feasible.

Sorry for being slow lately guys, but work is a bit crazy.

Also, @kpfleming your config cleanup changes are great and long overdue on my end. Whatever the interface to change the config ends up being, having it configurable is always a good idea :)

kpfleming commented 7 months ago

Great work! Excellent documentation in the ini-files as well. Would it be possible to protect the DFU ini upload with something like a password or pin, requiring a new firmware upload to reset such a password/pin?

All things are possible :-) It's a little challenging to use any sort of shared-key mechanism when the device doesn't have a user interface, though.

jalmeroth commented 7 months ago

It's a little challenging to use any sort of shared-key mechanism when the device doesn't have a user interface, though.

What about pressing the BOOTSEL button instead?

kpfleming commented 7 months ago

I have an alternative idea for a friendly config without any external software, but need to try a proof of concept when I'm finally back from work trip - I'm curious if it would be feasible.

The approach I'm working on doesn't require any external software, but it was much easier to develop/debug the INI-handling code outside of the firmware. In addition, once it is in the firmware if the user attempts to upload an invalid configuration, there's no way for the firmware to report back errors to let them know what was wrong, so I think having an external tool that can be used to validate the configuration will be useful.

hrvach commented 5 months ago

Latest branch/rc has a web UI, so hopefully configuration should be easier and more user friendly. It's far from ideal, but with some additional tweaking hopefully it will be able to fully replace the awkward keyboard shortcuts.