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

Add new DFU string index to show device state #2807

Merged
merged 2 commits into from
Aug 1, 2024

Conversation

keeramis
Copy link
Contributor

Problem

Currently, there is no way to distinguish between Open and Protected Devices in Service Mode when the device is in DFU mode by checking the DFU segments

Solution

Add a new string index which can be queried by reading the string descriptor that gives the device state

Steps to Test

  1. Build and flash this bootloader
  2. Use particle-usb to test this. Accurate device state detection for devices in DFU particle-usb#115

Example App

void setup() {
  /* A minimal example app is super helpful 
   * for testing new features and fixes. 
   * A link to a Docs PR is even better!
   */
}

void loop() {

}

References

Links to the Community, Docs, Other Issues, etc..


Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • Added documentation
  • Added to CHANGELOG.md after merging (add links to docs and issues)

@keeramis keeramis changed the base branch from develop to develop-6.x July 26, 2024 20:43
@avtolstoy
Copy link
Member

@keeramis Looks like this is failing on Gen 4 platforms:

make -s clean all PLATFORM_ID=32 COMPILE_LTO=n DEBUG_BUILD=n MODULAR=y USE_SWD_JTAG=n USE_SWD=n APP=tinker
  /firmware/modules/tron/system-part1/makefile /firmware/modules/tron/user-part/makefile
./src/rtl872x/usbd_device.cpp: In function 'char* {anonymous}::device_state_as_string(char*)':
./src/rtl872x/usbd_device.cpp:53:16: error: 'security_mode_get' was not declared in this scope
   53 |     int mode = security_mode_get(nullptr);
      |                ^~~~~~~~~~~~~~~~~
./src/rtl872x/usbd_device.cpp:56:19: error: 'security_mode_is_overridden' was not declared in this scope
   56 |       memcpy(buf, security_mode_is_overridden() ? "sm=s" : "sm=o", 4);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~

@keeramis keeramis marked this pull request as ready for review July 30, 2024 02:13
@keeramis keeramis force-pushed the feature/add-new-dfu-string-index branch from 65b668e to eadbe6f Compare July 30, 2024 02:15
@keeramis keeramis requested a review from avtolstoy July 30, 2024 04:15
@keeramis
Copy link
Contributor Author

Fixed the error. It was missing the header file. I tested on my Argon and my P2.

@keeramis keeramis merged commit a6e4efd into develop-6.x Aug 1, 2024
13 checks passed
@keeramis keeramis deleted the feature/add-new-dfu-string-index branch August 1, 2024 01:31
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