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

Feature/sc 122867/make particle usb flash be aware of device #681

Conversation

hugomontero
Copy link
Contributor

@hugomontero hugomontero commented Oct 16, 2023

Description

This PR will make flash --usb be aware of the device mode and the platform depending on the binary to be flashed.

How to Test

DFU

  1. Connect several devices to the computer
  2. put all the devices in normal mode
  3. Attempt to flash an specific user-part application and platform
  4. Put different devices (with different platforms) in DFU mode including your device
  5. Repeat step 3
  6. Put some devices (with the same platform) in DFU mode
  7. Repeat step 3

outcome

  • After step 2 you will see an error indicating your device needs to be in DFU
  • After step 4 your device will start flashing
  • After step 6 you will see a list of devices in DFU mode that has the required platform for the user application you attempt to flash

Tinker

  1. Connect several devices to the computer
  2. put all the devices in normal mode
  3. Attempt to flash the known application:flash --usb tinker
  4. Put different devices (with different platforms) in DFU mode including your device
  5. Repeat step 3

outcome

  • After step 2 you will see an error indicating your device needs to be in DFU
  • After step 4 you will see a list of devices in DFU mode no matter the platform

Explanation:
Tinker word doesn't have anything that we could guess the platform the user wants to flash. That's the reason we show all connected devices with DFU mode actived.

Normal mode / listening

  1. Connect several devices to the computer
  2. put all the devices in DFU mode
  3. Attempt to flash a bootloader file for an specific device
  4. Put different devices (with different platforms) in NORMAL/LISTENING mode including your device
  5. Repeat step 3
  6. Put some devices (with the same platform) in NORMAL/LISTENING mode
  7. Repeat step 3

outcome

  • After step 2 you will see an error indicating your device needs to be in NORMAL mode
  • After step 4 your device will start flashing
  • After step 6 you will see a list of devices in DFU mode that has the required platform for the user application you attempt to flash

Regression testing

  1. Attempt to update your device: npm start -- update
  2. Attempt to flash local your device (3rd Party OTA): npm start -- flash --local ...

Related Issues / Discussions

Story details: https://app.shortcut.com/particle/story/122867

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

@hugomontero hugomontero force-pushed the feature/sc-122867/make-particle-usb-flash-be-aware-of-device branch from b4fc847 to 2c7a99d Compare October 16, 2023 14:04
Copy link
Member

@monkbroc monkbroc left a comment

Choose a reason for hiding this comment

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

This isn't ready to merge. It broke the auto DFU switch in particle flash --local

$ particle flash --local
? Which device would you like to select?
  extra_p2 [0a10aced202194944a02c5f4] (Photon 2 / P2) 
❯ <unknown> [18002b000247353138383138] (Photon, LISTENING) 
Flashing photon 18002b000247353138383138
!!! The device needs to be in DFU mode for this command.

> To put your device in DFU manually, please:

1) Press and hold both the RESET and MODE/SETUP buttons simultaneously.

2) Release only the RESET button while continuing to hold the MODE/SETUP button.

3) Release the MODE/SETUP button once the device begins to blink yellow.

Put the device in DFU mode and try again

@hugomontero
Copy link
Contributor Author

This isn't ready to merge. It broke the auto DFU switch in particle flash --local

$ particle flash --local
? Which device would you like to select?
  extra_p2 [0a10aced202194944a02c5f4] (Photon 2 / P2) 
❯ <unknown> [18002b000247353138383138] (Photon, LISTENING) 
Flashing photon 18002b000247353138383138
!!! The device needs to be in DFU mode for this command.

> To put your device in DFU manually, please:

1) Press and hold both the RESET and MODE/SETUP buttons simultaneously.

2) Release only the RESET button while continuing to hold the MODE/SETUP button.

3) Release the MODE/SETUP button once the device begins to blink yellow.

Put the device in DFU mode and try again

I think this message is regarding the photon with version lt 2.0.0 will ask you to put your device in DFU manually.
I did a change because the message > This version of Device OS doesn't support automatically switching to DFU mode. were not displayed given a bad call to the message function

Copy link
Member

@monkbroc monkbroc left a comment

Choose a reason for hiding this comment

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

This is good with the last fix

@hugomontero hugomontero force-pushed the feature/sc-122867/make-particle-usb-flash-be-aware-of-device branch from e8a2a3b to 6dc10f8 Compare October 16, 2023 20:27
@hugomontero hugomontero changed the base branch from fix/improve-device-selector-output to master October 16, 2023 20:27
@hugomontero hugomontero force-pushed the feature/sc-122867/make-particle-usb-flash-be-aware-of-device branch 2 times, most recently from 510e162 to 54faf90 Compare October 16, 2023 20:32
@hugomontero hugomontero force-pushed the feature/sc-122867/make-particle-usb-flash-be-aware-of-device branch from 54faf90 to 74b1a01 Compare October 16, 2023 20:50
@hugomontero hugomontero merged commit 36251ff into master Oct 16, 2023
4 of 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.

None yet

2 participants