dagargo/overwitch

Move device definitions outside the C code

dagargo opened this issue · 3 comments

To add support for new devices without the need of new releases, we need to add a JSON file with the device definitions which could be overridden by the user.

Consider supporting a list of paths for the definition file.

  1. Same folder as the executable file
  2. Config folder in a system directory

The benefits would be that during development, you would only have to change files in the source directory.

When the application is launched, it would look for a definition file in the same folder where it was launched from and then fall back to the system-wide definition file.

The idea is to implent it the same way it's in Elektroid.

This means that if the config file is found in ~/.config/overwitch/devices.json, this will take preference over the file distributed with the package (and located with all the other resources).

See https://github.com/dagargo/elektroid#adding-and-reconfiguring-devices for more information.

This won't be in the 1.0 release but it will be in the 1.1.

Implemented in 819a13c as mentioned above.

Besides, a liboverwitch shared library is installed with the binaries, which might be helpful for you. GLib and the JSON parsing library are not needed and can be excluded from the library by passing some options to ./configure (see the documentation for more details), which should help with embedded-like devices. In this case, the C code definitions apply.