-
-
Notifications
You must be signed in to change notification settings - Fork 94
Introduce new configuration system #197
Description
Using properties to store and fetch configuration properties has reached its limits. I've thought about a better way to fetch configuration within the driver. Primarily it needs to work in good ol' pure C and shouldn't be too much of a hassle to also write to from C# (as DSHMC is a .NET application). It boiled down to two technologies to use: the registry or the filesystem.
Registry access if very limited, almost unusable in UMDF and that's on purpose, the hosting process of an user-mode driver runs under very low privileges for security reasons and I don't want to change that. There are ways to create registry keys and alter their permissions to allow the LocalService account read and write permissions but it didn't feel quite right.
Another way that is "easy" in an UMDF driver is to read from the filesystem, since we're running in user-mode, the common file primitives to open and read files work out of the box. At first I thought about using an INI parser, but to my delight I found a lightweight JSON parser so I settled on using JSON. It's an established standard, simple syntax for humans and it has native support in .NET, so it ticks all the boxes!
The driver will attempt to read the file C:\ProgramData\DsHidMini\DsHidMini.json and fallback to default values, if not found or parsing errors occur. This path has been chosen as the driver can read it without any modifications and any user can alter the file if they'd like to tinker with it outside of DSHMC. This will also allow for DSHMC to only require administrative elevation to restart the device, but no longer to simply store settings!
Related issues
These could be addressed and potentially fixed in entirety with this new feature:
- DShdmini Dead-zone threashold feature request #196
- Request: Add option (radio button) in Settings to have LEDs show battery/charging status or P# #87
- Request: Disable digital face buttons on SXS mode #81
- Allow setting LED effects #53
- Big Motor only rumbles above certain strength value #52
- Emulate a strength adjustable small motor by using the Big motor #51
- Add D-Pad as buttons in GPJ and SDF mode #35
- Request: option to give dshidmini priority over lightbar translation #31
- Request for LED states reaction to battery level #30
- Add "Flip axis" option to new configuration system #202
- DSHMv3 does not allow setting LEDs states from config file #260
- Allow user to change Quick Disconnect button combination #261
JSON Schema
See example config file (work in progress).