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

Handle multi-step flashing on Protected Devices #766

Conversation

keeramis
Copy link
Contributor

@keeramis keeramis commented Aug 21, 2024

Description

This is only applicable for device-os 6.1.1 and lower.

The flashing operation is a multi-step process where each step obtains the device handle, sets the device to the appropriate mode (normal or DFU) based on the binary type, and then flashes the binary onto the device.

Currently, a generic wrapper is used to manage Protected Devices, placing the device in Service Mode only once at the beginning of the flashing process. However, this approach has a limitation: the devices on 6.1.0 and 6.0.0 exit Service Mode and return to a Protected state after flashing the bootloader. You could think of starting in DFU mode, but these device-os versions don't work well on Protected Devices in DFU mode.

The PR throws a downgrade error on Protected Devices if downgrading device-os from 6.1.1 to either 6.1.0 or 6.0.0.

One alternative to downgrade is to convert the Protected Device to Open Device via cloud, and then downgrade via CLI.

How to Test

  1. Flash 6.1.1 on your device. Enable Device Protection on it.
  2. Upgrade to develop-6.x or 6.1.1 again -> It will work
  3. Downgrade to 6.1.0 again -> It won't work

Related Issues / Discussions

Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA
  • Problem and solution clearly stated
  • Tests have been provided
  • Docs have been updated
  • CI is passing

@keeramis keeramis changed the title Feature/automatic service mode fix multi step flashing Fix multi step flashing on Protected Devices Aug 22, 2024
@keeramis keeramis changed the title Fix multi step flashing on Protected Devices Fix multi-step flashing on Protected Devices Aug 22, 2024
@keeramis keeramis changed the title Fix multi-step flashing on Protected Devices Handle multi-step flashing on Protected Devices Aug 22, 2024
@keeramis keeramis changed the base branch from master to feature/automatic-service-mode August 22, 2024 20:39
@keeramis keeramis force-pushed the feature/automatic-service-mode-fix-multi-step-flashing branch 2 times, most recently from 07bd6f6 to 2092ab3 Compare August 22, 2024 20:50
// device could be open after the last iteration
if (device && device.isOpen) {
await device.close();
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a part of the PR description. I needed this because I was noticing that if the device never responds to a control request, for example, the UI is hanging there. The UI should return to the next line.

@keeramis keeramis requested a review from wraithan August 22, 2024 20:54
@keeramis keeramis marked this pull request as ready for review August 22, 2024 20:54
@keeramis keeramis force-pushed the feature/automatic-service-mode-fix-multi-step-flashing branch from d051d05 to be167b7 Compare August 22, 2024 20:54
@keeramis keeramis force-pushed the feature/automatic-service-mode-fix-multi-step-flashing branch from 0081010 to b7968ed Compare August 22, 2024 23:05
@keeramis keeramis merged commit 344a52f into feature/automatic-service-mode Aug 22, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants