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

Move DeviceInfoProvider to common code and use it in linux and NRF. #18687

Merged
merged 12 commits into from
May 25, 2022

Conversation

andy31415
Copy link
Contributor

@andy31415 andy31415 commented May 20, 2022

Problem

#17596 reports that DeviceInfoProvider is not supported in nrfconnect (specifically supported locales list is empty).

This fixes #17596.

Change overview

Move DeviceInfoProvider implementation as an example provider and make use of it in linux and nrf.

Tried to preserve existing behavior and have linux (and darwin app main as a sideffect) support deviceinfo provider. Ameba uses a custom build script that is out of the tree, so I could not update that one).

Testing

Ran

#!/usr/bin/env bash

set -ex

function finish {
  echo "STATUS: $?"
}

trap finish EXIT

export NODEID=$RANDOM

export THREAD_CRED=hex:... # my test thread credentials here
export CHIP_TOOL="./out/linux-x64-chip-tool-ipv6only/chip-tool"

log_file="run_log_$(date +'%Y-%m-%d_%H-%M-%S').txt"
rm /tmp/chip_*

echo "NODE ID USED: $NODEID" | tee $log_file

echo "=============================================================" >>$log_file
echo $CHIP_TOOL pairing ble-thread $NODEID $THREAD_CRED 20202021 3840 | tee -a $log_file
$CHIP_TOOL pairing ble-thread $NODEID $THREAD_CRED 20202021 3840  >>$log_file

echo "=============================================================" >>$log_file
echo $CHIP_TOOL localizationconfiguration read supported-locales $NODEID 0 | tee -a $log_file
$CHIP_TOOL localizationconfiguration read supported-locales $NODEID 0 | tee -a $log_file | grep 'CHIP:DMG:'

and saw output that was non-empty:

...
[1653067684.692432][838470:838477] CHIP:DMG:                    AttributeDataIB =
[1653067684.692434][838470:838477] CHIP:DMG:                    {
[1653067684.692436][838470:838477] CHIP:DMG:                            DataVersion = 0x2179c2af,
[1653067684.692438][838470:838477] CHIP:DMG:                            AttributePathIB =
[1653067684.692440][838470:838477] CHIP:DMG:                            {
[1653067684.692442][838470:838477] CHIP:DMG:                                    Endpoint = 0x0,
[1653067684.692444][838470:838477] CHIP:DMG:                                    Cluster = 0x2b,
[1653067684.692447][838470:838477] CHIP:DMG:                                    Attribute = 0x0000_0001,
[1653067684.692448][838470:838477] CHIP:DMG:                                    ListIndex = Null,
[1653067684.692450][838470:838477] CHIP:DMG:                            }
[1653067684.692453][838470:838477] CHIP:DMG:
[1653067684.692456][838470:838477] CHIP:DMG:                                    Data = "ja-JP",
[1653067684.692458][838470:838477] CHIP:DMG:                    },
[1653067684.692462][838470:838477] CHIP:DMG:
[1653067684.692463][838470:838477] CHIP:DMG:            },
[1653067684.692468][838470:838477] CHIP:DMG:
[1653067684.692470][838470:838477] CHIP:DMG:    ],
[1653067684.692494][838470:838477] CHIP:DMG:
[1653067684.692497][838470:838477] CHIP:DMG:    SuppressResponse = true,
[1653067684.692499][838470:838477] CHIP:DMG:    InteractionModelRevision = 1
[1653067684.692501][838470:838477] CHIP:DMG: }
[1653067684.693219][838470:838470] CHIP:DMG: IM WH moving to [Uninitialized]
[1653067684.693221][838470:838470] CHIP:DMG: IM WH moving to [Uninitialized]
[1653067684.693222][838470:838470] CHIP:DMG: IM WH moving to [Uninitialized]
[1653067684.693223][838470:838470] CHIP:DMG: IM WH moving to [Uninitialized]
[1653067684.693225][838470:838470] CHIP:DMG: All ReadHandler-s are clean, clear GlobalDirtySet
+ finish
+ echo 'STATUS: 0'
STATUS: 0

LuDuda
LuDuda previously requested changes May 24, 2022
Copy link
Contributor

@LuDuda LuDuda left a comment

Choose a reason for hiding this comment

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

Thank you @andy31415 for contribution.

I agree with Boris, that this should not be implemented in the platform layer.

Providing example implementation of DeviceInfoProvider for all platforms seems to be better solution (similarly what we do in attestation credentials SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());)

@andy31415 andy31415 changed the title Implement DeviceInfoProvider for Zephyr Move DeviceInfoProvider to common code and use it in linux and NRF. May 24, 2022
@andy31415
Copy link
Contributor Author

Thank you @andy31415 for contribution.

I agree with Boris, that this should not be implemented in the platform layer.

Providing example implementation of DeviceInfoProvider for all platforms seems to be better solution (similarly what we do in attestation credentials SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());)

@LuDuda I just updated the PR and moved things to a common layer.

NRF uses a custom cmake build which required a bit of updating. Please take a look.

@andy31415 andy31415 dismissed stale reviews from bzbarsky-apple and LuDuda May 24, 2022 14:06

Updated code to centralize the provider implementation

examples/providers/BUILD.gn Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented May 24, 2022

PR #18687: Size comparison from 352333a to 09540af

Increases (1 build for linux)
platform target config section 352333a 09540af change % change
linux thermostat-no-ble arm64 (read only) 2357644 2358036 392 0.0
.text 1981024 1981424 400 0.0
Decreases (2 builds for linux)
platform target config section 352333a 09540af change % change
linux chip-tool-no-interactive-ipv6only arm64 (read only) 9234132 9226420 -7712 -0.1
(read/write) 645937 645249 -688 -0.1
.bss 42225 42209 -16 -0.0
.data 1192 1176 -16 -1.3
.data.rel.ro 583656 583080 -576 -0.1
.got 15016 14936 -80 -0.5
.rodata 448564 448228 -336 -0.1
.text 7322180 7316212 -5968 -0.1
thermostat-no-ble arm64 (read/write) 177409 177393 -16 -0.0
.bss 88193 88177 -16 -0.0
.rodata 147596 147588 -8 -0.0
Full report (19 builds for cc13x2_26x2, cyw30739, k32w, linux, mbed, p6, telink)
platform target config section 352333a 09540af change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 669447 669447 0 0.0
(read/write) 182408 182408 0 0.0
.bss 74836 74836 0 0.0
.data 3404 3404 0 0.0
.rodata 100783 100783 0 0.0
.text 568440 568440 0 0.0
lock-ftd LP_CC2652R7 (read only) 676199 676199 0 0.0
(read/write) 166648 166648 0 0.0
.bss 72884 72884 0 0.0
.data 3236 3236 0 0.0
.rodata 94679 94679 0 0.0
.text 581036 581036 0 0.0
lock-mtd LP_CC2652R7 (read only) 625607 625607 0 0.0
(read/write) 145716 145716 0 0.0
.bss 68620 68620 0 0.0
.data 3236 3236 0 0.0
.rodata 94559 94559 0 0.0
.text 530556 530556 0 0.0
pump-app LP_CC2652R7 (read only) 676075 676075 0 0.0
(read/write) 168196 168196 0 0.0
.bss 73284 73284 0 0.0
.data 3272 3272 0 0.0
.rodata 88899 88899 0 0.0
.text 586692 586692 0 0.0
pump-controller-app LP_CC2652R7 (read only) 654035 654035 0 0.0
(read/write) 189836 189836 0 0.0
.bss 73140 73140 0 0.0
.data 3232 3232 0 0.0
.rodata 83675 83675 0 0.0
.text 569880 569880 0 0.0
shell LP_CC2652R7 (read only) 662470 662470 0 0.0
(read/write) 184944 184944 0 0.0
.bss 77196 77196 0 0.0
.data 3408 3408 0 0.0
.rodata 97750 97750 0 0.0
.text 564492 564492 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 624630 624630 0 0.0
.app_xip_area 527908 527908 0 0.0
.bss 79364 79364 0 0.0
.data 708 708 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 627298 627298 0 0.0
.app_xip_area 532048 532048 0 0.0
.bss 77924 77924 0 0.0
.data 672 672 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 571066 571066 0 0.0
.app_xip_area 466132 466132 0 0.0
.bss 87312 87312 0 0.0
.data 584 584 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
k32w light k32w061+release (read/write) 682968 682968 0 0.0
.bss 80432 80432 0 0.0
.data 2016 2016 0 0.0
.text 598816 598816 0 0.0
lock k32w061+release (read/write) 728996 728996 0 0.0
.bss 80856 80856 0 0.0
.data 1976 1976 0 0.0
.text 644460 644460 0 0.0
linux chip-tool-no-interactive-ipv6only arm64 (read only) 9234132 9226420 -7712 -0.1
(read/write) 645937 645249 -688 -0.1
.bss 42225 42209 -16 -0.0
.data 1192 1176 -16 -1.3
.data.rel.ro 583656 583080 -576 -0.1
.dynamic 560 560 0 0.0
.got 15016 14936 -80 -0.5
.init 24 24 0 0.0
.init_array 184 184 0 0.0
.rodata 448564 448228 -336 -0.1
.text 7322180 7316212 -5968 -0.1
thermostat-no-ble arm64 (read only) 2357644 2358036 392 0.0
(read/write) 177409 177393 -16 -0.0
.bss 88193 88177 -16 -0.0
.data 1520 1520 0 0.0
.data.rel.ro 79896 79896 0 0.0
.dynamic 560 560 0 0.0
.got 4768 4768 0 0.0
.init 24 24 0 0.0
.init_array 376 376 0 0.0
.rodata 147596 147588 -8 -0.0
.text 1981024 1981424 400 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2419208 2419208 0 0.0
.bss 202860 202860 0 0.0
.data 5872 5872 0 0.0
.text 1381852 1381852 0 0.0
p6 all-clusters-app default (read/write) 2541288 2541288 0 0.0
.bss 137360 137360 0 0.0
.data 2808 2808 0 0.0
.text 1499552 1499552 0 0.0
light-app default (read/write) 2424616 2424616 0 0.0
.bss 129696 129696 0 0.0
.data 2608 2608 0 0.0
.text 1382880 1382880 0 0.0
lock-app default (read/write) 2435176 2435176 0 0.0
.bss 129504 129504 0 0.0
.data 2568 2568 0 0.0
.text 1393440 1393440 0 0.0
telink light-switch-app tlsr9518adk80d (read/write) 782860 782860 0 0.0
bss 70828 70828 0 0.0
noinit 40416 40416 0 0.0
text 553468 553468 0 0.0
lighting-app tlsr9518adk80d (read/write) 802884 802884 0 0.0
bss 71080 71080 0 0.0
noinit 40416 40416 0 0.0
text 570202 570202 0 0.0

@github-actions
Copy link

github-actions bot commented May 24, 2022

PR #18687: Size comparison from 352333a to 9d880d3

Increases above 0.2%:

platform target config section 352333a 9d880d3 change % change
nrfconnect lighting-app nrf52840dk_nrf52840 rodata 122412 122844 432 0.4
nrf52840dk_nrf52840+rpc rodata 113540 113968 428 0.4
nrf52840dongle_nrf52840 rodata 92220 92652 432 0.5
nrf5340dk_nrf5340_cpuapp rodata 115168 115600 432 0.4
Increases (5 builds for linux, nrfconnect)
platform target config section 352333a 9d880d3 change % change
linux thermostat-no-ble arm64 (read only) 2357644 2358036 392 0.0
.text 1981024 1981424 400 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 1151795 1153675 1880 0.2
rodata 122412 122844 432 0.4
text 808452 809904 1452 0.2
nrf52840dk_nrf52840+rpc (read/write) 1116067 1117943 1876 0.2
rodata 113540 113968 428 0.4
text 780892 782344 1452 0.2
nrf52840dongle_nrf52840 (read/write) 1059427 1061291 1864 0.2
rodata 92220 92652 432 0.5
text 736872 738292 1420 0.2
nrf5340dk_nrf5340_cpuapp (read/write) 1054170 1056066 1896 0.2
rodata 115168 115600 432 0.4
text 718548 720000 1452 0.2
Decreases (2 builds for linux)
platform target config section 352333a 9d880d3 change % change
linux chip-tool-no-interactive-ipv6only arm64 (read only) 9234132 9226420 -7712 -0.1
(read/write) 645937 645249 -688 -0.1
.bss 42225 42209 -16 -0.0
.data 1192 1176 -16 -1.3
.data.rel.ro 583656 583080 -576 -0.1
.got 15016 14936 -80 -0.5
.rodata 448564 448228 -336 -0.1
.text 7322180 7316212 -5968 -0.1
thermostat-no-ble arm64 (read/write) 177409 177393 -16 -0.0
.bss 88193 88177 -16 -0.0
.rodata 147596 147588 -8 -0.0
Full report (35 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 352333a 9d880d3 change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 669447 669447 0 0.0
(read/write) 182408 182408 0 0.0
.bss 74836 74836 0 0.0
.data 3404 3404 0 0.0
.rodata 100783 100783 0 0.0
.text 568440 568440 0 0.0
lock-ftd LP_CC2652R7 (read only) 676199 676199 0 0.0
(read/write) 166648 166648 0 0.0
.bss 72884 72884 0 0.0
.data 3236 3236 0 0.0
.rodata 94679 94679 0 0.0
.text 581036 581036 0 0.0
lock-mtd LP_CC2652R7 (read only) 625607 625607 0 0.0
(read/write) 145716 145716 0 0.0
.bss 68620 68620 0 0.0
.data 3236 3236 0 0.0
.rodata 94559 94559 0 0.0
.text 530556 530556 0 0.0
pump-app LP_CC2652R7 (read only) 676075 676075 0 0.0
(read/write) 168196 168196 0 0.0
.bss 73284 73284 0 0.0
.data 3272 3272 0 0.0
.rodata 88899 88899 0 0.0
.text 586692 586692 0 0.0
pump-controller-app LP_CC2652R7 (read only) 654035 654035 0 0.0
(read/write) 189836 189836 0 0.0
.bss 73140 73140 0 0.0
.data 3232 3232 0 0.0
.rodata 83675 83675 0 0.0
.text 569880 569880 0 0.0
shell LP_CC2652R7 (read only) 662470 662470 0 0.0
(read/write) 184944 184944 0 0.0
.bss 77196 77196 0 0.0
.data 3408 3408 0 0.0
.rodata 97750 97750 0 0.0
.text 564492 564492 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 624630 624630 0 0.0
.app_xip_area 527908 527908 0 0.0
.bss 79364 79364 0 0.0
.data 708 708 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 627298 627298 0 0.0
.app_xip_area 532048 532048 0 0.0
.bss 77924 77924 0 0.0
.data 672 672 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 571066 571066 0 0.0
.app_xip_area 466132 466132 0 0.0
.bss 87312 87312 0 0.0
.data 584 584 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 916036 916036 0 0.0
(read/write) 133452 133452 0 0.0
.bss 131392 131392 0 0.0
.data 2060 2060 0 0.0
.text 916028 916028 0 0.0
BRD4161A+rpc (read only) 950224 950224 0 0.0
(read/write) 150136 150136 0 0.0
.bss 147872 147872 0 0.0
.data 2264 2264 0 0.0
.text 950216 950216 0 0.0
BRD4161A+rs911x (read only) 790596 790596 0 0.0
(read/write) 129720 129720 0 0.0
.bss 127652 127652 0 0.0
.data 2068 2068 0 0.0
.text 790588 790588 0 0.0
lock-app BRD4161A+wf200 (read only) 947048 947048 0 0.0
(read/write) 124188 124188 0 0.0
.bss 122164 122164 0 0.0
.data 2024 2024 0 0.0
.text 947040 947040 0 0.0
window-app BRD4161A (read only) 897244 897244 0 0.0
(read/write) 133504 133504 0 0.0
.bss 131456 131456 0 0.0
.data 2048 2048 0 0.0
.text 897236 897236 0 0.0
esp32 all-clusters-app c3devkit (read only) 1002992 1002992 0 0.0
(read/write) 1479978 1479978 0 0.0
.dram0.bss 69392 69392 0 0.0
.dram0.data 14624 14624 0 0.0
.flash.rodata 210536 210536 0 0.0
.flash.text 1002992 1002992 0 0.0
.iram0.text 62954 62954 0 0.0
m5stack (read only) 1057795 1057795 0 0.0
(read/write) 481992 481992 0 0.0
.dram0.bss 74912 74912 0 0.0
.dram0.data 34200 34200 0 0.0
.flash.rodata 240884 240884 0 0.0
.flash.text 1052411 1052411 0 0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w061+release (read/write) 682968 682968 0 0.0
.bss 80432 80432 0 0.0
.data 2016 2016 0 0.0
.text 598816 598816 0 0.0
lock k32w061+release (read/write) 728996 728996 0 0.0
.bss 80856 80856 0 0.0
.data 1976 1976 0 0.0
.text 644460 644460 0 0.0
linux chip-tool-no-interactive-ipv6only arm64 (read only) 9234132 9226420 -7712 -0.1
(read/write) 645937 645249 -688 -0.1
.bss 42225 42209 -16 -0.0
.data 1192 1176 -16 -1.3
.data.rel.ro 583656 583080 -576 -0.1
.dynamic 560 560 0 0.0
.got 15016 14936 -80 -0.5
.init 24 24 0 0.0
.init_array 184 184 0 0.0
.rodata 448564 448228 -336 -0.1
.text 7322180 7316212 -5968 -0.1
thermostat-no-ble arm64 (read only) 2357644 2358036 392 0.0
(read/write) 177409 177393 -16 -0.0
.bss 88193 88177 -16 -0.0
.data 1520 1520 0 0.0
.data.rel.ro 79896 79896 0 0.0
.dynamic 560 560 0 0.0
.got 4768 4768 0 0.0
.init 24 24 0 0.0
.init_array 376 376 0 0.0
.rodata 147596 147588 -8 -0.0
.text 1981024 1981424 400 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2419208 2419208 0 0.0
.bss 202860 202860 0 0.0
.data 5872 5872 0 0.0
.text 1381852 1381852 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1184523 1184523 0 0.0
bss 139560 139560 0 0.0
rodata 153684 153684 0 0.0
text 812436 812436 0 0.0
lighting-app nrf52840dk_nrf52840 (read/write) 1151795 1153675 1880 0.2
bss 142156 142156 0 0.0
rodata 122412 122844 432 0.4
text 808452 809904 1452 0.2
nrf52840dk_nrf52840+rpc (read/write) 1116067 1117943 1876 0.2
bss 142392 142392 0 0.0
rodata 113540 113968 428 0.4
text 780892 782344 1452 0.2
nrf52840dongle_nrf52840 (read/write) 1059427 1061291 1864 0.2
bss 149364 149364 0 0.0
rodata 92220 92652 432 0.5
text 736872 738292 1420 0.2
nrf5340dk_nrf5340_cpuapp (read/write) 1054170 1056066 1896 0.2
bss 138356 138356 0 0.0
rodata 115168 115600 432 0.4
text 718548 720000 1452 0.2
lock-app nrf52840dk_nrf52840 (read/write) 1094955 1094955 0 0.0
bss 132076 132076 0 0.0
rodata 135468 135468 0 0.0
text 748764 748764 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 997658 997658 0 0.0
bss 128308 128308 0 0.0
rodata 128272 128272 0 0.0
text 659004 659004 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 1074679 1074679 0 0.0
bss 132320 132320 0 0.0
rodata 118208 118208 0 0.0
text 745408 745408 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 1054399 1054399 0 0.0
bss 131844 131844 0 0.0
rodata 113928 113928 0 0.0
text 729832 729832 0 0.0
p6 all-clusters-app default (read/write) 2541288 2541288 0 0.0
.bss 137360 137360 0 0.0
.data 2808 2808 0 0.0
.text 1499552 1499552 0 0.0
light-app default (read/write) 2424616 2424616 0 0.0
.bss 129696 129696 0 0.0
.data 2608 2608 0 0.0
.text 1382880 1382880 0 0.0
lock-app default (read/write) 2435176 2435176 0 0.0
.bss 129504 129504 0 0.0
.data 2568 2568 0 0.0
.text 1393440 1393440 0 0.0
telink light-switch-app tlsr9518adk80d (read/write) 782860 782860 0 0.0
bss 70828 70828 0 0.0
noinit 40416 40416 0 0.0
text 553468 553468 0 0.0
lighting-app tlsr9518adk80d (read/write) 802884 802884 0 0.0
bss 71080 71080 0 0.0
noinit 40416 40416 0 0.0
text 570202 570202 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.

[SQA]-THREAD In (TC-LO-2.1) Supported-locals has no entries.
5 participants