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

Make saving the configuration more robust #467

Closed
mondalaci opened this issue Oct 18, 2017 · 3 comments · Fixed by #594
Closed

Make saving the configuration more robust #467

mondalaci opened this issue Oct 18, 2017 · 3 comments · Fixed by #594
Assignees

Comments

@mondalaci
Copy link
Member

mondalaci commented Oct 18, 2017

When uploading the user configuration to the UHK, there is a phase when the lauchEepromTransfer USB command gets called, and then getKeyboardState is getting polled until it returns 0 as the first byte.

This phase is critical because if some for some reason it gets interrupted, the configuration will be left in an inconsistent state.

In order to make Agent more robust, let's do the following:

  • When the user clicks on the "Save to keyboard button", save the user configuration to the file system automatically to "${agentDirectory}/${uhkUuid}.json" and only after that execute the already implemented transfer.
  • After loading the configuration from the UHK, if the config serializer fails to parse it, display a restoration screen to the user.

The restoration screen should contain the following:

Title: [fa-exclamation-circle icon] Fix configuration
Paragraph: Your on-board device configuration is invalid. (1.5 rem above and below spacing just like for the "Device configuration" screen)
Button: Restore the last valid device configuration (blue button)

Before displaying the above screen, check if there is a previous configuration saved, and also check if it's valid (the configuration parser can successfully parse it). If not, then rather display the following button:

Button: Reset device configuration (red button, no confirmation)

Also create a menu item for this page as the first child of the Device node. Name the menu item "Fix configuration" and remove it once the button (whichever is displayed) gets clicked and the restoration process finished.

@ert78gb
Copy link
Member

ert78gb commented Apr 1, 2018

@mondalaci Just for the clarification.
Which configuration save to the file the new user configuration or that is on the device ?

@ert78gb
Copy link
Member

ert78gb commented Apr 1, 2018

I suggest to use appData dir to store file, because that writeable and use fix name for user configuration instead of random generated uuid

@mondalaci
Copy link
Member Author

Just added packages/usb/{write-userconfig.js,invalid.config} to this branch. You can mess up the user config of your UKH by running write-userconfig.js invalid-config.bin. If you reconnect your UHK then the display will show FTY just as expected. When starting up Agent instead of displaying the recovery screen, it will simply display the default config which is not the expected behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants