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

Keyboard Firmware Update Error #128

Closed
BernardoRebelo opened this issue Nov 16, 2020 · 22 comments · Fixed by #132 or #135
Closed

Keyboard Firmware Update Error #128

BernardoRebelo opened this issue Nov 16, 2020 · 22 comments · Fixed by #132 or #135
Assignees
Labels
bug Something isn't working
Milestone

Comments

@BernardoRebelo
Copy link

Describe the bug
After installing Bazecor 0.2.4 and setting the keyboard's LED's in rainbow mode, I click update firmware. A window briefly shows up for a few seconds, telling me about the countdown and what to press. A few seconds later that window disappears and I get an error on the bottom left saying "Firmware update failed, because the settings could not be saved."

To Reproduce
Steps to reproduce the behavior:

  1. Go to Firmware Update
  2. Click on Update
  3. Wait a few seconds
  4. See error

Expected behavior
The countdown/instructions window shows up and the user follows the instructions to update the keyboard's firmware.

Screenshots
Firmware Error

Desktop (please complete the following information):

  • OS: Windows 10 x64
  • Bazecor Version: 0.2.4

Unsure how to update the Keyboard's firmware after updating Bazecor itself

@BernardoRebelo BernardoRebelo added the bug Something isn't working label Nov 16, 2020
@Acrossfy
Copy link

Same. Also, all my layers setup is gone.

@gitetsu
Copy link

gitetsu commented Nov 17, 2020

Same here.

  • OS: Mac OS X 10.14.6
  • Bazecor Version: 0.2.4

@sos0
Copy link

sos0 commented Nov 17, 2020

Reproduced on my end as well. Tagging related issue: #127 as #128 may be a prerequisite in reproducing #127

@AlexDygma
Copy link
Member

Hello @BernardoRebelo, @Acrossfy, @gitetsu, @sos0 !

I'm Sorry to hear that you lost your layers, this can happen because of this reasons:

  • The update process failed due to lack of permissions to read the layer backup file after being stored (now that you have a way to back up all your layers, i recommend on using it just to have a failsafe)
  • The flasher was unable to reconnect after flashing to the keyboard due to timing/serial port issues.
  • the backup wasn't done properly and something wasn't stored as it should, making the restoring process fail.

the fact is that there is a log file for the flashing process created at this locations in your computers:

  • Mac
    • Mac/Users/$YourUser$/Library/ApplicationSupport/BAZECOR
  • Win
    • C:\Users$YourUser$\AppData\Roaming\BAZECOR

There you will find a file named like:
Raise-backup-2020-11-19-08_26_34.json

With that file in hand you can get the flashing log so i can know what happened, but you can also restore the layers you lost.

So please, upload the files to this issue so i can troubleshoot what is happening during the flashing process and i will also restore your settings in a general backup file, so i can give them back to you to restore your layers!

Lets get this solved! 😉

@AlexDygma AlexDygma self-assigned this Nov 19, 2020
@AlexDygma AlexDygma added this to the 0.2.5 milestone Nov 19, 2020
@pilhuhn
Copy link

pilhuhn commented Nov 19, 2020

The file says for me (btw on OSX there is a .json.json ending to it)

"log":["Neuron detected","Get backup settings hardware.keyscan: Error: Firmware update failed, because the settings could not be saved","Get backup settings macros.map: Error: Firmware update failed, because the settings could not be saved"],"serialNumber":"OMITTED","firmwareFile":"File has not being selected"}

@gitetsu
Copy link

gitetsu commented Nov 20, 2020

I'm in a similar situation. (including .json.json)
"log":["Neuron detected","Get backup settings macros.map: Error: Firmware update failed, because the settings could not be saved"],"serialNumber":"OMITTED","firmwareFile":"File has not being selected"}

@abernix
Copy link

abernix commented Nov 20, 2020

@AlexDygma In my own case, I've had a successful firmware upgrade from 0.22 to 0.24, but the buttons in all my layers ended up as just TRANSparent buttons, with their colors preserved, but with no actual keymap/bindings present.

Here is my backup file: https://gist.github.com/abernix/19a4060a59d1d155d7d499eb7c450d27#file-raise-backup-2020-11-20-14_15_22-json-json

How might I convert this firmware upgrade log into a backup file that can be restored? It seems like it is something that is mappable, but it's not immediately clear what the steps are to do that. It looks like it requires merging some properties from different objects in the firmware update log JSON into a more complex object which matches the format of the backup file JSON. I started trying using jq, but thought you might have something put together already to do the conversion.

@AlexDygma
Copy link
Member

@AlexDygma In my own case, I've had a successful firmware upgrade from 0.22 to 0.24, but the buttons in all my layers ended up as just TRANSparent buttons, with their colors preserved, but with no actual keymap/bindings present.

Here is my backup file: https://gist.github.com/abernix/19a4060a59d1d155d7d499eb7c450d27#file-raise-backup-2020-11-20-14_15_22-json-json

How might I convert this firmware upgrade log into a backup file that can be restored? It seems like it is something that is mappable, but it's not immediately clear what the steps are to do that. It looks like it requires merging some properties from different objects in the firmware update log JSON into a more complex object which matches the format of the backup file JSON. I started trying using jq, but thought you might have something put together already to do the conversion.

Hello @abernix!

Dont worry ill make the backup file for you (if you are curious, the easy way to do this is to run the commands with the dev console of bazecor, to open it press Ctr+Sift+i , then connect to your keyboard and when you are in the editor, type in the console focus_instance.command("keymap.custom 20 12 304 4332 ......"); do this for all the commands listed in the file).

it's like the sending of the custom keymap didn't happen as intended, this case is strange 🤨

Either Way i could reproduce the errors that you had at least in Mac and they were due to bad permissions in the local folder, i'll try to enable the read/write of the json file in the local user folder destined for that task (as it should be happening) but seems other way.

@AlexDygma
Copy link
Member

AlexDygma commented Nov 20, 2020

@AlexDygma
Here is my backup file: https://gist.github.com/abernix/19a4060a59d1d155d7d499eb7c450d27#file-raise-backup-2020-11-20-14_15_22-json-json

Hey @abernix!

Here you have the restore.json file
Restore.json.zip

@abernix
Copy link

abernix commented Nov 20, 2020

Thank you, @AlexDygma! Let me know if there's anything else I can help with debugging this. The only thing I know I did wrong is that I pushed the ESC key down after the "countdown", but I let go of the ESC key immediately after the firmware update started applying and didn't keep it held down until the point in the instructions where it says to release it.

@AlexDygma
Copy link
Member

Thank you, @AlexDygma! Let me know if there's anything else I can help with debugging this. The only thing I know I did wrong is that I pushed the ESC key down after the "countdown", but I let go of the ESC key immediately after the firmware update started applying and didn't keep it held down until the point in the instructions where it says to release it.

It's more stable if you maintain the ESC key pressed, but shouldn't have failed in that way ( leaving out a command without executing it ) i'll probably add code to retry any failures at least once because this should be avoidable.

The rest of the reports tend me to think the file access is not stable.

@Silversong4vr
Copy link

Silversong4vr commented Nov 20, 2020

Can I just say that nowhere during my first setup am I told to create a backup before attempting to update the firmware? This is my first installation and update of Bazecor, but the instructions I have via email with my personalized layers uses the previous version with instructions that are no longer able to be performed by me (i.e. copy content of L0 into Bazecor import by pasting). I "think" I have the Rainbow LED set (seems to be in breathing mode using T8?), have backed up L0 and L1, but am still getting the same error. I have submitted a ticket on Dygma for assistance.
20201120_130453

Raise-backup-2020-11-20-13_45_06.json.zip

@NiftyNeyo
Copy link

Same issue, when doing the firmware upgrade the software attempts to make a backup JSON file in that roaming appdata folder and it just fails every time. I have the original firmware still installed that the first batch of keyboards shipped with and I finally decided to upgrade to this latest software since macro support was added and the software installed but whatever is wrong with this firmware updating process is beyond me.

@FAQinghere
Copy link

Same. Win10. Black raise updated fine. White one resulted in this error. Uninstall and reinstall Bazecor. Still nope. Tried Bootloader mode... Nope.

UI Issues:

  • the dismiss button ('x') does not work on the error message and also persists when changing to different views entirely
  • in Bootloader mode there is no indication of failure, but in the UI the updater counts down endlessly -10, -11, -12...).

@AlexDygma
Copy link
Member

Hello @Silversong4vr @NiftyNeyo @FAQinghere !

Let's recap:

  • The flashing process fails before even starting to flash the keyboard due to being incapable of retrieving the configuration of your Raise to make a backup.
  • It doesn't seem to be a file access issue because the Json files with the logs are being created just fine.
  • Non updated keyboards are failing more than the rest or even exclusively.

This makes me think the error is related to the Macros map restoring functionality added to the flashing process.
Before the current version, macros weren't stored in the backup, but the macro.map function didn't exist in older firmware versions. So right now for me, the most obvious culprit is an old firmware version that didn't have the macros API operational.

To test this out and make the process work, we need to update to a prior version of the firmware first, the easiest way to do this is to get Bazecor 0.2.2 installed and flash your Raise with it first.

Then Re install the latest Bazecor version 0.2.4 and flash again.

this should make the keyboards flashable with the latest Bazecor version.

In the meantime ill add a check in the flashing process to recognize if the keyboard has an old firmware version so it avoids trying to get the macros from it's EEPROM when that's impossible.

Let's fix this! 😄

@pilhuhn
Copy link

pilhuhn commented Nov 23, 2020

@AlexDygma I just tried (on macOS with an original white KS-Dygma): Using bazecor 0.22 worked to flash the 0.22 firmware (it is odd though, that at the end of the flashing the 'updating' box never finished and the Keyboard + Neuron stayed black. Using the LED-cycle key brought back the other modes). Then I reuploaded my Layers from Bazecor.
Next I tried flashing from 0.24, but that showed the same behaviour than before.

@AlexDygma
Copy link
Member

@pilhuhn

Great, 😢, so in your case it should be a issue with the permissions the app has, did you open Bazecor by opening the app folder in finder, holding CTRL and pressing open in the contextual menu? if not the application may not have the required permits (you only have to do this once when you install)

if you did, ill need your log file just to know if it's failing at the same point.

File access should not be an issue, but with the application not being trusted by the O.S., who knows... we will address this in the next milestone btw. (Application credentials)

@NiftyNeyo
Copy link

NiftyNeyo commented Nov 24, 2020

@AlexDygma Flashing my keyboard with the firmware from Bazecor 0.22 first and then flashing it with the firmware from Bazecor 0.24 fixed the issue of being unable to flash my keyboard from version 0.1.0 software. Thanks for troubleshooting this.

@alagopus
Copy link

Thank you @NiftyNeyo for the workaround confirmation! As a consequence, you should keep the 0.2.2 app image around until final issue resolution, just in case you reset you EEPROM to factory defaults.

@NiftyNeyo
Copy link

Sorry I don't know a way that I can show that the workaround was successful. There may be other factors preventing the firmware update but at least in my scenario of being on version 0.1.0 software. The new firmware having macro support and the original not having it was the issue in why the software couldn't complete the backup and flash the device. If you have older keyboards around at Dygma, then I think you could replicate this and verify it.

@AlexDygma
Copy link
Member

AlexDygma commented Nov 25, 2020

Hello @alagopus, @HomerSp, @NiftyNeyo!

Thanks for the commit Homer! 😄 .

Don't Worry Nifty, with your check i managed to replicate the bug at our office so i know exactly why it happens and the code that Homer applied is more than enough to make this work for anyone upgrading from an old version of the firmware.

Still, i need to add a try catch structure to prevent failing when storing or reading back the config file.

i'll do this today, and many more things! for the rest of the week ill push 0.2.5 until completion 😄.

Thanks everyone for your help!

@AlexDygma AlexDygma reopened this Nov 25, 2020
@AlexDygma
Copy link
Member

Re-opening to also include file read/write operations and act if they fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet