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

[Linux] Handle BLE adapter re-appearance due to BlueZ restart #32847

Merged
merged 5 commits into from
Apr 23, 2024

Conversation

arkq
Copy link
Contributor

@arkq arkq commented Apr 4, 2024

Problem

In case of BlueZ restart (e.g. due to a crash and restart by systemd), all D-Bus proxy objects need to be refreshed (they keep unique name of watched D-Bus client). Otherwise, BLE functionality will be permanently broken in Matter SDK, until restart of the application.

Changes

Implement logic for kPlatformLinuxBLEAdapterAdded and kPlatformLinuxBLEAdapterRemoved signals. In case of adapter disappearance, BlueZ integration is shutdown and BLE subsystem is disabled. Later when the adapter appears again, the BLE state machine re-registers with BlueZ in order to get new D-Bus unique name. The shutdown procedure does not stop timers, so the overall timeouts for BLE-related actions are not affected by adapter re-appearance.

Testing

Manually tested LE advertising after BlueZ restart:

  1. Restart BlueZ in the middle of advertising - overall advertising time is still 15 minutes.
  2. Restart BlueZ after advertising is stopped - advertising is not started again.

Copy link

github-actions bot commented Apr 4, 2024

PR #32847: Size comparison from 6a7961d to 7ba16fb

Increases (11 builds for linux)
platform target config section 6a7961d 7ba16fb change % change
linux air-purifier-app debug (read only) 2643693 2644397 704 0.0
.text 2280469 2281173 704 0.0
all-clusters-app debug (read only) 5952281 5952985 704 0.0
.text 5167731 5168435 704 0.0
all-clusters-minimal-app debug (read only) 5232433 5233137 704 0.0
.text 4707571 4708275 704 0.0
bridge-app debug (read only) 4625897 4626601 704 0.0
.text 4174627 4175331 704 0.0
chip-tool debug (read only) 12080665 12081337 672 0.0
.text 10921699 10922403 704 0.0
chip-tool-ipv6only arm64 (read only) 11400868 11401316 448 0.0
.got 17112 17120 8 0.0
.text 10163272 10163736 464 0.0
lighting-app debug+rpc+ui (read only) 5548793 5549497 704 0.0
.text 4947283 4947987 704 0.0
lock-app debug (read only) 4690865 4691569 704 0.0
.text 4222963 4223667 704 0.0
shell debug (read only) 2918161 2918865 704 0.0
.text 2557890 2558594 704 0.0
tv-app debug (read only) 5761073 5761745 672 0.0
.text 5225299 5226003 704 0.0
tv-casting-app debug (read only) 9890993 9891697 704 0.0
.text 9041379 9042083 704 0.0
Decreases (4 builds for efr32, linux)
platform target config section 6a7961d 7ba16fb change % change
efr32 lock-app BRD4338a (read/write) 959872 959864 -8 -0.0
.text 700108 700100 -8 -0.0
linux chip-tool debug .rodata 450585 450553 -32 -0.0
chip-tool-ipv6only arm64 (read/write) 590384 589912 -472 -0.1
.rodata 355860 355828 -32 -0.0
tv-app debug .rodata 292522 292490 -32 -0.0
Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
platform target config section 6a7961d 7ba16fb change % change
bl602 lighting-app bl602 (read/write) 1442278 1442278 0 0.0
.bss 85432 85432 0 0.0
.data 9504 9504 0 0.0
.rodata 158976 158976 0 0.0
.text 1107698 1107698 0 0.0
bl602+mfd (read/write) 1456694 1456694 0 0.0
.bss 85600 85600 0 0.0
.data 9480 9480 0 0.0
.rodata 157936 157936 0 0.0
.text 1123014 1123014 0 0.0
bl602+rpc (read/write) 1489918 1489918 0 0.0
.bss 93480 93480 0 0.0
.data 9880 9880 0 0.0
.rodata 166544 166544 0 0.0
.text 1139344 1139344 0 0.0
bl702 lighting-app bl702 (read only) 3478 3478 0 0.0
(read/write) 1206971 1206971 0 0.0
.bss 11217 11217 0 0.0
.data 3688 3688 0 0.0
.rodata 108336 108336 0 0.0
.text 976846 976846 0 0.0
bl702+mfd (read only) 3478 3478 0 0.0
(read/write) 1217783 1217783 0 0.0
.bss 11393 11393 0 0.0
.data 3664 3664 0 0.0
.rodata 107276 107276 0 0.0
.text 988598 988598 0 0.0
bl702+rpc (read only) 3478 3478 0 0.0
(read/write) 1298707 1298707 0 0.0
.bss 19701 19701 0 0.0
.data 4224 4224 0 0.0
.rodata 123708 123708 0 0.0
.text 1051810 1051810 0 0.0
bl706-eth (read/write) 1024405 1024405 0 0.0
.bss 23792 23792 0 0.0
.data 3264 3264 0 0.0
.rodata 101660 101660 0 0.0
.text 767702 767702 0 0.0
bl706-wifi (read/write) 1259078 1259078 0 0.0
.bss 10677 10677 0 0.0
.data 3696 3696 0 0.0
.rodata 122660 122660 0 0.0
.text 999606 999606 0 0.0
bl702l lighting-app bl702l (read only) 512 512 0 0.0
(read/write) 1176312 1176312 0 0.0
.bss 16428 16428 0 0.0
.data 5048 5048 0 0.0
.rodata 102340 102340 0 0.0
.text 969712 969712 0 0.0
bl702l+mfd (read only) 512 512 0 0.0
(read/write) 1187716 1187716 0 0.0
.bss 16604 16604 0 0.0
.data 5032 5032 0 0.0
.rodata 101280 101280 0 0.0
.text 982032 982032 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 (read only) 782004 782004 0 0.0
(read/write) 168824 168824 0 0.0
.bss 90780 90780 0 0.0
.data 3584 3584 0 0.0
.rodata 82532 82532 0 0.0
.text 699204 699204 0 0.0
lock-ftd LP_EM_CC1354P10_6 (read only) 798156 798156 0 0.0
(read/write) 178976 178976 0 0.0
.bss 100948 100948 0 0.0
.data 3576 3576 0 0.0
.rodata 76684 76684 0 0.0
.text 721204 721204 0 0.0
lock-mtd LP_EM_CC1354P10_6 (read only) 786796 786796 0 0.0
(read/write) 173416 173416 0 0.0
.bss 95388 95388 0 0.0
.data 3576 3576 0 0.0
.rodata 103436 103436 0 0.0
.text 683092 683092 0 0.0
pump-app LP_EM_CC1354P10_6 (read only) 739092 739092 0 0.0
(read/write) 167784 167784 0 0.0
.bss 89520 89520 0 0.0
.data 3568 3568 0 0.0
.rodata 78196 78196 0 0.0
.text 660628 660628 0 0.0
pump-controller-app LP_EM_CC1354P10_6 (read only) 724748 724748 0 0.0
(read/write) 168000 168000 0 0.0
.bss 89736 89736 0 0.0
.data 3568 3568 0 0.0
.rodata 73972 73972 0 0.0
.text 650508 650508 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL (read only) 586194 586194 0 0.0
(read/write) 208080 208080 0 0.0
.bss 201308 201308 0 0.0
.data 1648 1648 0 0.0
.rodata 87418 87418 0 0.0
.text 496652 496652 0 0.0
lock CC3235SF_LAUNCHXL (read only) 630986 630986 0 0.0
(read/write) 208336 208336 0 0.0
.bss 201712 201712 0 0.0
.data 1504 1504 0 0.0
.rodata 107762 107762 0 0.0
.text 521100 521100 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 569263 569263 0 0.0
.app_xip_area 459181 459181 0 0.0
.bss 64908 64908 0 0.0
.data 752 752 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 551519 551519 0 0.0
.app_xip_area 436765 436765 0 0.0
.bss 69572 69572 0 0.0
.data 760 760 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor cyw930739m2evb_01 (read/write) 572335 572335 0 0.0
.app_xip_area 463757 463757 0 0.0
.bss 63444 63444 0 0.0
.data 712 712 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
switch cyw930739m2evb_01 (read/write) 564551 564551 0 0.0
.app_xip_area 452781 452781 0 0.0
.bss 66556 66556 0 0.0
.data 792 792 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4187C (read/write) 1113488 1113488 0 0.0
.bss 195272 195272 0 0.0
.data 3432 3432 0 0.0
.text 914764 914764 0 0.0
lock-app BRD4338a (read/write) 959872 959864 -8 -0.0
.bss 210204 210204 0 0.0
.data 30192 30192 0 0.0
.text 700108 700100 -8 -0.0
window-app BRD4187C (read/write) 1160704 1160704 0 0.0
.bss 167600 167600 0 0.0
.data 3336 3336 0 0.0
.text 989748 989748 0 0.0
esp32 all-clusters-app c3devkit (read only) 1213272 1213272 0 0.0
(read/write) 1750240 1750240 0 0.0
.dram0.bss 74384 74384 0 0.0
.dram0.data 13628 13628 0 0.0
.flash.rodata 252704 252704 0 0.0
.flash.text 1213272 1213272 0 0.0
.iram0.text 75530 75530 0 0.0
m5stack (read only) 1255087 1255087 0 0.0
(read/write) 536396 536396 0 0.0
.dram0.bss 81064 81064 0 0.0
.dram0.data 35180 35180 0 0.0
.flash.rodata 284232 284232 0 0.0
.flash.text 1248923 1248923 0 0.0
.iram0.text 125403 125403 0 0.0
linux air-purifier-app debug (read only) 2643693 2644397 704 0.0
(read/write) 130032 130032 0 0.0
.bss 46736 46736 0 0.0
.data 2272 2272 0 0.0
.data.rel.ro 75080 75080 0 0.0
.dynamic 608 608 0 0.0
.got 4520 4520 0 0.0
.init 27 27 0 0.0
.init_array 792 792 0 0.0
.rodata 184208 184208 0 0.0
.text 2280469 2281173 704 0.0
all-clusters-app debug (read only) 5952281 5952985 704 0.0
(read/write) 481536 481536 0 0.0
.bss 135072 135072 0 0.0
.data 4560 4560 0 0.0
.data.rel.ro 334472 334472 0 0.0
.dynamic 624 624 0 0.0
.got 5328 5328 0 0.0
.init 27 27 0 0.0
.init_array 1432 1432 0 0.0
.rodata 349744 349744 0 0.0
.text 5167731 5168435 704 0.0
all-clusters-minimal-app debug (read only) 5232433 5233137 704 0.0
(read/write) 237488 237488 0 0.0
.bss 127904 127904 0 0.0
.data 4464 4464 0 0.0
.data.rel.ro 98056 98056 0 0.0
.dynamic 624 624 0 0.0
.got 5248 5248 0 0.0
.init 27 27 0 0.0
.init_array 1160 1160 0 0.0
.rodata 288714 288714 0 0.0
.text 4707571 4708275 704 0.0
bridge-app debug (read only) 4625897 4626601 704 0.0
(read/write) 218336 218336 0 0.0
.bss 118400 118400 0 0.0
.data 6240 6240 0 0.0
.data.rel.ro 86976 86976 0 0.0
.dynamic 624 624 0 0.0
.got 5216 5216 0 0.0
.init 27 27 0 0.0
.init_array 856 856 0 0.0
.rodata 229546 229546 0 0.0
.text 4174627 4175331 704 0.0
chip-tool debug (read only) 12080665 12081337 672 0.0
(read/write) 523032 523032 0 0.0
.bss 94680 94680 0 0.0
.data 5122 5122 0 0.0
.data.rel.ro 416000 416000 0 0.0
.dynamic 624 624 0 0.0
.got 5736 5736 0 0.0
.init 27 27 0 0.0
.init_array 824 824 0 0.0
.rodata 450585 450553 -32 -0.0
.text 10921699 10922403 704 0.0
chip-tool-ipv6only arm64 (read only) 11400868 11401316 448 0.0
(read/write) 590384 589912 -472 -0.1
.bss 103736 103736 0 0.0
.data 4512 4512 0 0.0
.data.rel.ro 455952 455952 0 0.0
.dynamic 512 512 0 0.0
.got 17112 17120 8 0.0
.init 24 24 0 0.0
.init_array 280 280 0 0.0
.rodata 355860 355828 -32 -0.0
.text 10163272 10163736 464 0.0
lighting-app debug+rpc+ui (read only) 5548793 5549497 704 0.0
(read/write) 227096 227096 0 0.0
.bss 119336 119336 0 0.0
.data 4864 4864 0 0.0
.data.rel.ro 95376 95376 0 0.0
.dynamic 672 672 0 0.0
.got 5856 5856 0 0.0
.init 27 27 0 0.0
.init_array 968 968 0 0.0
.rodata 353396 353396 0 0.0
.text 4947283 4947987 704 0.0
lock-app debug (read only) 4690865 4691569 704 0.0
(read/write) 205552 205552 0 0.0
.bss 113696 113696 0 0.0
.data 4160 4160 0 0.0
.data.rel.ro 81016 81016 0 0.0
.dynamic 624 624 0 0.0
.got 5168 5168 0 0.0
.init 27 27 0 0.0
.init_array 872 872 0 0.0
.rodata 255242 255242 0 0.0
.text 4222963 4223667 704 0.0
ota-provider-app debug (read only) 4307129 4307129 0 0.0
(read/write) 194224 194224 0 0.0
.bss 113472 113472 0 0.0
.data 4368 4368 0 0.0
.data.rel.ro 70448 70448 0 0.0
.dynamic 624 624 0 0.0
.got 4536 4536 0 0.0
.init 27 27 0 0.0
.init_array 744 744 0 0.0
.rodata 208458 208458 0 0.0
.text 3904163 3904163 0 0.0
ota-requestor-app debug (read only) 4436793 4436793 0 0.0
(read/write) 198592 198592 0 0.0
.bss 114368 114368 0 0.0
.data 4768 4768 0 0.0
.data.rel.ro 73552 73552 0 0.0
.dynamic 624 624 0 0.0
.got 4472 4472 0 0.0
.init 27 27 0 0.0
.init_array 792 792 0 0.0
.rodata 214698 214698 0 0.0
.text 4023043 4023043 0 0.0
shell debug (read only) 2918161 2918865 704 0.0
(read/write) 156936 156936 0 0.0
.bss 62544 62544 0 0.0
.data 1424 1424 0 0.0
.data.rel.ro 87168 87168 0 0.0
.dynamic 592 592 0 0.0
.got 4056 4056 0 0.0
.init 27 27 0 0.0
.init_array 1104 1104 0 0.0
.rodata 185568 185568 0 0.0
.text 2557890 2558594 704 0.0
thermostat-no-ble arm64 (read only) 4426556 4426556 0 0.0
(read/write) 244720 244720 0 0.0
.bss 121976 121976 0 0.0
.data 3392 3392 0 0.0
.data.rel.ro 104312 104312 0 0.0
.dynamic 512 512 0 0.0
.got 8712 8712 0 0.0
.init 24 24 0 0.0
.init_array 448 448 0 0.0
.rodata 159988 159988 0 0.0
.text 3929976 3929976 0 0.0
tv-app debug (read only) 5761073 5761745 672 0.0
(read/write) 353200 353200 0 0.0
.bss 244240 244240 0 0.0
.data 6560 6560 0 0.0
.data.rel.ro 95128 95128 0 0.0
.dynamic 624 624 0 0.0
.got 5464 5464 0 0.0
.init 27 27 0 0.0
.init_array 1176 1176 0 0.0
.rodata 292522 292490 -32 -0.0
.text 5225299 5226003 704 0.0
tv-casting-app debug (read only) 9890993 9891697 704 0.0
(read/write) 340784 340784 0 0.0
.bss 156080 156080 0 0.0
.data 3008 3008 0 0.0
.data.rel.ro 174816 174816 0 0.0
.dynamic 624 624 0 0.0
.got 5040 5040 0 0.0
.init 27 27 0 0.0
.init_array 1208 1208 0 0.0
.rodata 382904 382904 0 0.0
.text 9041379 9042083 704 0.0
mbed lock-app-release cy8cproto_062_4343w (read only) 6224 6224 0 0.0
(read/write) 2534280 2534280 0 0.0
.bss 220472 220472 0 0.0
.data 5216 5216 0 0.0
.text 1496964 1496964 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read only) 4 4 0 0.0
(read/write) 1064288 1064288 0 0.0
bss 133107 133107 0 0.0
rodata 102960 102960 0 0.0
text 781000 781000 0 0.0
nrf7002dk_nrf5340_cpuapp (read only) 4 4 0 0.0
(read/write) 1225388 1225388 0 0.0
bss 127163 127163 0 0.0
rodata 151304 151304 0 0.0
text 796892 796892 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read only) 4 4 0 0.0
(read/write) 1011768 1011768 0 0.0
bss 131965 131965 0 0.0
rodata 90224 90224 0 0.0
text 742364 742364 0 0.0
nxp contact k32w0+release (read only) 574508 574508 0 0.0
(read/write) 79988 79988 0 0.0
.bss 67824 67824 0 0.0
.data 2180 2180 0 0.0
.text 573972 573972 0 0.0
k32w1+release (read only) 1024 1024 0 0.0
(read/write) 701468 701468 0 0.0
.bss 71176 71176 0 0.0
.data 2856 2856 0 0.0
.text 588056 588056 0 0.0
light k32w0+release (read only) 608520 608520 0 0.0
(read/write) 79464 79464 0 0.0
.bss 67280 67280 0 0.0
.data 2200 2200 0 0.0
.text 607984 607984 0 0.0
k32w1+release (read only) 1024 1024 0 0.0
(read/write) 793368 793368 0 0.0
.bss 80728 80728 0 0.0
.data 2056 2056 0 0.0
.text 671216 671216 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 (read only) 832280 832280 0 0.0
(read/write) 1802580 1802580 0 0.0
.bss 198372 198372 0 0.0
.data 2688 2688 0 0.0
.text 1593132 1593132 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 (read only) 835432 835432 0 0.0
(read/write) 1724468 1724468 0 0.0
.bss 195252 195252 0 0.0
.data 2656 2656 0 0.0
.text 1518172 1518172 0 0.0
light cy8ckit_062s2_43012 (read only) 842160 842160 0 0.0
(read/write) 1643204 1643204 0 0.0
.bss 188716 188716 0 0.0
.data 2464 2464 0 0.0
.text 1443636 1443636 0 0.0
lock cy8ckit_062s2_43012 (read only) 815096 815096 0 0.0
(read/write) 1671988 1671988 0 0.0
.bss 215788 215788 0 0.0
.data 2456 2456 0 0.0
.text 1445356 1445356 0 0.0
qpg lighting-app qpg6105+debug (read/write) 1131728 1131728 0 0.0
.bss 102572 102572 0 0.0
.data 844 844 0 0.0
.text 644112 644112 0 0.0
lock-app qpg6105+debug (read/write) 1091544 1091544 0 0.0
.bss 97236 97236 0 0.0
.data 856 856 0 0.0
.text 603924 603924 0 0.0
stm32 light STM32WB5MM-DK (read/write) 603189 603189 0 0.0
.bss 128436 128436 0 0.0
.data 676 676 0 0.0
.rodata 80108 80108 0 0.0
.text 384224 384224 0 0.0
telink air-quality-sensor-app tlsr9528a_retention (read only) 51774 51774 0 0.0
(read/write) 825414 825414 0 0.0
bss 49708 49708 0 0.0
text 617796 617796 0 0.0
all-clusters-app tlsr9518adk80d (read only) 29042 29042 0 0.0
(read/write) 1094444 1094444 0 0.0
bss 101804 101804 0 0.0
text 795116 795116 0 0.0
all-clusters-minimal-app tlsr9528a (read only) 47960 47960 0 0.0
(read/write) 1051980 1051980 0 0.0
bss 110100 110100 0 0.0
text 766506 766506 0 0.0
bridge-app tlsr9518adk80d (read only) 29042 29042 0 0.0
(read/write) 912420 912420 0 0.0
bss 93140 93140 0 0.0
text 653704 653704 0 0.0
contact-sensor-app tlsr9528a_retention (read only) 51774 51774 0 0.0
(read/write) 827070 827070 0 0.0
bss 49748 49748 0 0.0
text 619518 619518 0 0.0
light-switch-app-ota-shell-factory-data tlsr9528a (read only) 51584 51584 0 0.0
(read/write) 930592 930592 0 0.0
bss 77488 77488 0 0.0
text 698172 698172 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d (read only) 29122 29122 0 0.0
(read/write) 1075720 1075720 0 0.0
bss 100212 100212 0 0.0
text 779222 779222 0 0.0
lock-app-dfu tlsr9528a (read only) 51584 51584 0 0.0
(read/write) 905252 905252 0 0.0
bss 69220 69220 0 0.0
text 654998 654998 0 0.0
ota-requestor-app tlsr9518adk80d (read only) 29042 29042 0 0.0
(read/write) 931424 931424 0 0.0
bss 92712 92712 0 0.0
text 672824 672824 0 0.0
pump-app tlsr9258a_retention (read only) 51774 51774 0 0.0
(read/write) 829778 829778 0 0.0
bss 49856 49856 0 0.0
text 622558 622558 0 0.0
pump-controller-app tlsr9518adk80d (read only) 31872 31872 0 0.0
(read/write) 793344 793344 0 0.0
bss 56056 56056 0 0.0
text 593236 593236 0 0.0
shell tlsr9518adk80d (read only) 29042 29042 0 0.0
(read/write) 675888 675888 0 0.0
bss 73412 73412 0 0.0
text 461650 461650 0 0.0
smoke_co_alarm-app tlsr9528a_retention (read only) 51774 51774 0 0.0
(read/write) 835102 835102 0 0.0
bss 51388 51388 0 0.0
text 626382 626382 0 0.0
temperature-measurement-app-mars-ota tlsr9518adk80d (read only) 32220 32220 0 0.0
(read/write) 853313 853313 0 0.0
bss 59532 59532 0 0.0
text 637946 637946 0 0.0
thermostat tlsr9518adk80d (read only) 31872 31872 0 0.0
(read/write) 819040 819040 0 0.0
bss 56352 56352 0 0.0
text 612952 612952 0 0.0
window-covering tlsr9258a (read only) 51584 51584 0 0.0
(read/write) 837124 837124 0 0.0
bss 68128 68128 0 0.0
text 628200 628200 0 0.0

Copy link
Contributor

@yunhanw-google yunhanw-google left a comment

Choose a reason for hiding this comment

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

thanks!

@mergify mergify bot merged commit e47f748 into project-chip:master Apr 23, 2024
66 checks passed
@arkq arkq deleted the linux-bluez-cleanup branch April 23, 2024 11:44
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.

3 participants