Skip to content

[all-devices-app] Remove dependency on global LinuxDeviceOptions and add --KVS, --discriminator, --vendor-id and --product-id support#71735

Open
soares-sergio wants to merge 16 commits intoproject-chip:masterfrom
soares-sergio:all_devices_kvs
Open

[all-devices-app] Remove dependency on global LinuxDeviceOptions and add --KVS, --discriminator, --vendor-id and --product-id support#71735
soares-sergio wants to merge 16 commits intoproject-chip:masterfrom
soares-sergio:all_devices_kvs

Conversation

@soares-sergio
Copy link
Copy Markdown
Contributor

@soares-sergio soares-sergio commented Apr 22, 2026

This PR refactors all-devices-app to remove its reliance on the global LinuxDeviceOptions singleton and centralizes its specific providers in the all-devices-common directory.

Key Changes

Configuration and Options

  • Bypassed the shared platform ParseArguments function.
  • Added support for the --KVS option, allowing specification of a custom Key-Value Store file path.
  • Retained support for --discriminator by parsing it locally with validation (ensuring 12-bit value).
  • Added support for --vendor-id and --product-id options to override default values dynamically.
  • Added support for the --port option to override the default Matter port (5540), allowing multiple instances to run without port conflicts.
  • Refactored AppOptions to use a local AppConfig struct instead of global state.
  • Addressed review comments by making GetConfig() return a const reference and restoring the default device fallback ("contact-sensor" on endpoint 1).
  • Renamed deviceConfigs to deviceTypeEntries for consistency with DeviceTypeParser.

Providers

  • Created DeviceInstanceInfoProviderImpl in all-devices-common (moved and renamed from AppDeviceInstanceInfoProvider) to handle VID/PID overrides via dependency injection.
  • Created DeviceInfoProviderImpl in all-devices-common to provide supported locales, fixed labels, etc., removing the dependency on examples/providers/AllClustersExampleDeviceInfoProviderImpl and AllDevicesExampleDeviceInfoProviderImpl.
  • Deleted AllDevicesExampleDeviceInfoProviderImpl from examples/providers/ as it is no longer needed.

Build System

  • Added BUILD.gn in examples/all-devices-app/all-devices-common/ to manage the new providers.
  • Updated examples/all-devices-app/posix/BUILD.gn and examples/providers/BUILD.gn to reflect the provider changes.

Testing

  • Verified by running instances of the application with distinct KVS files, discriminators, custom VID/PID, and custom port:
    • Example: ./all-devices-app --KVS out/test_kvs/kvs3.ini --discriminator 1234 --vendor-id 0x6006 --product-id 0xFE00 --port 5555
  • Verified that the app bound to the custom port using ss command.
  • Successfully commissioned instances using chip-tool with pairing onnetwork-long.
    • Note: Since overriding the Vendor ID causes an expected Device Attestation failure, --bypass-attestation-verifier true was used with chip-tool.
  • Verified that the Basic Information cluster correctly reported the overridden values.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the application options into a centralized AppConfig structure and introduces new command-line arguments for the KVS path and setup discriminator. The review feedback highlights the need for robust input validation on the discriminator value to prevent unexpected behavior, suggests returning a const reference from GetConfig to prevent accidental modifications, and points out that the refactoring removed default device configuration logic which could cause issues when no arguments are provided.

Comment thread examples/all-devices-app/posix/app_options/AppOptions.cpp Outdated
Comment thread examples/all-devices-app/posix/app_options/AppOptions.h Outdated
Comment thread examples/all-devices-app/posix/app_options/AppOptions.h Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2026

PR #71735: Size comparison from e2dc005 to 723d1e8

Full report (34 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
platform target config section e2dc005 723d1e8 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1090754 1090754 0 0.0
RAM 144930 144930 0 0.0
bl616 lighting-app bl616+thread FLASH 1102236 1102236 0 0.0
RAM 104344 104344 0 0.0
bl616+wifi+shell FLASH 1589180 1589180 0 0.0
RAM 98240 98240 0 0.0
bl702 lighting-app bl702+eth FLASH 1053924 1053924 0 0.0
RAM 108549 108549 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 892608 892608 0 0.0
RAM 105940 105940 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 776024 776024 0 0.0
RAM 103492 103492 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 788564 788564 0 0.0
RAM 108684 108684 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 735708 735708 0 0.0
RAM 97516 97516 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 717756 717756 0 0.0
RAM 97644 97644 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 562722 562722 0 0.0
RAM 205072 205072 0 0.0
lock CC3235SF_LAUNCHXL FLASH 594586 594586 0 0.0
RAM 205272 205272 0 0.0
efr32 lock-app BRD4187C FLASH 993264 993264 0 0.0
RAM 131352 131352 0 0.0
BRD4338a FLASH 797485 797485 0 0.0
RAM 243452 243452 0 0.0
window-app BRD4187C FLASH 1099104 1099096 -8 -0.0
RAM 130392 130392 0 0.0
esp32 all-clusters-app c3devkit DRAM 99164 99164 0 0.0
FLASH 1607386 1607386 0 0.0
IRAM 94776 94776 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 866560 866560 0 0.0
RAM 162404 162404 0 0.0
nxp contact mcxw71+release FLASH 742664 742664 0 0.0
RAM 67160 67160 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1717796 1717796 0 0.0
RAM 214628 214628 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1615228 1615228 0 0.0
RAM 211500 211500 0 0.0
light cy8ckit_062s2_43012 FLASH 1469428 1469428 0 0.0
RAM 197548 197548 0 0.0
lock cy8ckit_062s2_43012 FLASH 1502404 1502404 0 0.0
RAM 225276 225276 0 0.0
qpg lighting-app qpg6200+debug FLASH 843068 843068 0 0.0
RAM 127956 127956 0 0.0
lock-app qpg6200+debug FLASH 781644 781644 0 0.0
RAM 118904 118904 0 0.0
realtek light-switch-app rtl8777g FLASH 682856 682856 0 0.0
RAM 101824 101824 0 0.0
lighting-app rtl8777g FLASH 726760 726760 0 0.0
RAM 102164 102164 0 0.0
stm32 light STM32WB5MM-DK FLASH 477348 477348 0 0.0
RAM 141604 141604 0 0.0
telink bridge-app tl7218x FLASH 730678 730678 0 0.0
RAM 95932 95932 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 850378 850378 0 0.0
RAM 44400 44400 0 0.0
tl7218x FLASH 841784 841784 0 0.0
RAM 99796 99796 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 730300 730300 0 0.0
RAM 56064 56064 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 793526 793526 0 0.0
RAM 75248 75248 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 730198 730198 0 0.0
RAM 33544 33544 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 613126 613126 0 0.0
RAM 118632 118632 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 839918 839922 4 0.0
RAM 97504 97504 0 0.0

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.81%. Comparing base (336a23c) to head (a1b4f94).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...on/devices/device-type-parser/DeviceTypeParser.cpp 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #71735      +/-   ##
==========================================
- Coverage   54.81%   54.81%   -0.01%     
==========================================
  Files        1603     1603              
  Lines      109834   109834              
  Branches    13452    13452              
==========================================
- Hits        60203    60202       -1     
- Misses      49631    49632       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@soares-sergio soares-sergio changed the title Refactor all-devices-app to remove reliance on global options and add KVS support [all-devices-app] Add --KVS, --discriminator, --vendor-id and --product-id support May 1, 2026
@soares-sergio soares-sergio changed the title [all-devices-app] Add --KVS, --discriminator, --vendor-id and --product-id support [all-devices-app] Remove dependency on global LinuxDeviceOptions and add --KVS, --discriminator, --vendor-id and --product-id support May 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

PR #71735: Size comparison from c383110 to 39d9976

Full report (3 builds for realtek, stm32)
platform target config section c383110 39d9976 change % change
realtek light-switch-app rtl8777g FLASH 684856 684856 0 0.0
RAM 101832 101832 0 0.0
lighting-app rtl8777g FLASH 728888 728888 0 0.0
RAM 102164 102164 0 0.0
stm32 light STM32WB5MM-DK FLASH 477536 477536 0 0.0
RAM 141604 141604 0 0.0

@mergify mergify Bot added the conflict label May 1, 2026
@mergify mergify Bot removed the conflict label May 1, 2026
@soares-sergio soares-sergio marked this pull request as ready for review May 1, 2026 21:12
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

PR #71735: Size comparison from f76eca9 to f3d0dd9

Full report (6 builds for cc32xx, nrfconnect, realtek, stm32)
platform target config section f76eca9 f3d0dd9 change % change
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 562954 562954 0 0.0
RAM 205072 205072 0 0.0
lock CC3235SF_LAUNCHXL FLASH 594778 594778 0 0.0
RAM 205272 205272 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 866848 866848 0 0.0
RAM 162405 162405 0 0.0
realtek light-switch-app rtl8777g FLASH 684856 684856 0 0.0
RAM 101832 101832 0 0.0
lighting-app rtl8777g FLASH 728888 728888 0 0.0
RAM 102164 102164 0 0.0
stm32 light STM32WB5MM-DK FLASH 477536 477536 0 0.0
RAM 141604 141604 0 0.0

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

PR #71735: Size comparison from f76eca9 to a1b4f94

Full report (34 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
platform target config section f76eca9 a1b4f94 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1090952 1090952 0 0.0
RAM 144930 144930 0 0.0
bl616 lighting-app bl616+thread FLASH 1102444 1102444 0 0.0
RAM 104344 104344 0 0.0
bl616+wifi+shell FLASH 1589396 1589396 0 0.0
RAM 98240 98240 0 0.0
bl702 lighting-app bl702+eth FLASH 1054120 1054120 0 0.0
RAM 108549 108549 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 892916 892916 0 0.0
RAM 105940 105940 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 776208 776208 0 0.0
RAM 103492 103492 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 788700 788700 0 0.0
RAM 108684 108684 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 735844 735844 0 0.0
RAM 97516 97516 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 717908 717908 0 0.0
RAM 97644 97644 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 562954 562954 0 0.0
RAM 205072 205072 0 0.0
lock CC3235SF_LAUNCHXL FLASH 594778 594778 0 0.0
RAM 205272 205272 0 0.0
efr32 lock-app BRD4187C FLASH 993564 993564 0 0.0
RAM 131352 131352 0 0.0
BRD4338a FLASH 797629 797621 -8 -0.0
RAM 243452 243452 0 0.0
window-app BRD4187C FLASH 1099356 1099356 0 0.0
RAM 130392 130392 0 0.0
esp32 all-clusters-app c3devkit DRAM 99164 99164 0 0.0
FLASH 1607700 1607700 0 0.0
IRAM 94776 94776 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 866848 866848 0 0.0
RAM 162405 162405 0 0.0
nxp contact mcxw71+release FLASH 742752 742752 0 0.0
RAM 67160 67160 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1717988 1717988 0 0.0
RAM 214628 214628 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1615260 1615260 0 0.0
RAM 211500 211500 0 0.0
light cy8ckit_062s2_43012 FLASH 1469492 1469492 0 0.0
RAM 197548 197548 0 0.0
lock cy8ckit_062s2_43012 FLASH 1502460 1502460 0 0.0
RAM 225276 225276 0 0.0
qpg lighting-app qpg6200+debug FLASH 843276 843276 0 0.0
RAM 127956 127956 0 0.0
lock-app qpg6200+debug FLASH 781852 781852 0 0.0
RAM 118904 118904 0 0.0
realtek light-switch-app rtl8777g FLASH 684856 684856 0 0.0
RAM 101832 101832 0 0.0
lighting-app rtl8777g FLASH 728888 728888 0 0.0
RAM 102164 102164 0 0.0
stm32 light STM32WB5MM-DK FLASH 477536 477536 0 0.0
RAM 141604 141604 0 0.0
telink bridge-app tl7218x FLASH 730954 730954 0 0.0
RAM 95932 95932 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 850702 850702 0 0.0
RAM 44408 44408 0 0.0
tl7218x FLASH 842108 842108 0 0.0
RAM 99796 99796 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 730638 730638 0 0.0
RAM 56064 56064 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 793864 793864 0 0.0
RAM 75248 75248 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 730536 730536 0 0.0
RAM 33544 33544 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 613450 613450 0 0.0
RAM 118632 118632 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 840222 840226 4 0.0
RAM 97504 97504 0 0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant