particle-iot / particle-cli

Command Line Interface for Particle Cloud and devices
Apache License 2.0
212 stars 92 forks source link

Simplify the generic helper that takes care of Protected Devices #759

Closed keeramis closed 2 months ago

keeramis commented 2 months ago

Description

See - https://github.com/particle-iot/particle-cli/pull/753 See - https://github.com/particle-iot/particle-cli/pull/754

Simplify the generic wrapper that takes care of Protected Devices.

  1. Skips checking Device Protection for gen2 devices (both dfu and normal modes)
  2. A Protected Device is put into Service Mode to run a CLI operation and after that CLI command execution finishes (either success/error), we expect the device to be ready to take a control request to turn off Service Mode. It's the responsibility of the module (usb, serial, flash, etc...) to exit the CLI command execution with a device that is able to take control requests in normal mode (or simply be ready in dfu mode)

How to Test

Unfortunately, this is a stand alone PR. Since usb module already uses this helper, run any particle usb xxx commands to test this out on your Protected Device.

Your device should be Protected at the start of the test. Run any particle usb xxx command. The command should run fine. After the command finishes, check particle device-protection status and your device should now be a Protected Device.

Related Issues / Discussions

A small part of https://app.shortcut.com/particle/story/129067/add-generic-helpers-for-a-device-to-put-into-service-mode-and-back-to-perform-a-cli-operation See - https://github.com/particle-iot/particle-cli/pull/753 See - https://github.com/particle-iot/particle-cli/pull/754

Completeness