-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Bluetooth: tester: Add support for BTP_GAP_SET_POWERED command #67359
Bluetooth: tester: Add support for BTP_GAP_SET_POWERED command #67359
Conversation
Hello @zhaynxp, and thank you very much for your first pull request to the Zephyr project! |
The issue this PR solves is #67346 , please help to review, thanks! |
@zhaynxp you can link a PR to an issue using one of the GH keywords in your PR description: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue |
f520dad
to
8d1e3ef
Compare
@Thalley , thanks for your comments, have linked issue to this PR. |
Hi, I don't think zephyr should implement this command, it is meant for systems that can disable controller only (ie. Linux) without shutting down whole host/apps stack. And you also disable already registered services on power off. If you need to disable bluetooth in zephyr I think correct way would be to implement service unregister functions and than BTP user can unregister services (including GAP which could disable bluetooth subsystem). Just note that unregister functions would have to properly cleanup things as current implementation only have stubs for services unregister (as we don't really use it in autopts for now) |
8d1e3ef
to
3a94633
Compare
Hi @Thalley , thanks! I've submitted new commit message to link issue, please help check and review. Thanks! |
Hi @sjanc , thanks a lot for your suggestion, we'd deprecated the BTP_GAP_SET_POWERED command, and use Unregister GAP Service command(00 04 ff 01 00 01) instead to shutdown whole Bluetooth Subsystem, it will act as main switch to power off BT controller and clean up app+host stack layer resources, and will call |
Dear Reviewers, Since this PR is on top of PR #64599 which completed bsim test recently and ready to merge soon if no accident, want to check what's your opinion on this PR? Is it ok to merge after PR #64599 merged and all checks passed? We have a tight schedule to upstream these PRs, so please kindly share your views and let us know any pending items on our side, thanks a lot! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments, but ideally @sjanc is the one that really needs to look at this
b9e780a
to
c00a6c3
Compare
Dear Reviewers, Would you please help to review solution in this PR? Since currently no unregister services will be called by autopts or other vendor, also obviously bt_tester lacks such an interface to call |
Please be patient :) I don't have any significant change requests, but @sjanc is effectively the maintainer of the BT tester, so I'd like to wait for him to provide a review. |
Hi, sorry for late response, BTP protocol doesn't allow for implicit unregistering of services Since Zephyr's host doesn't really allow for shutdown, but rather full re-init, my suggestion would be to implement this per service. As GAP profile is kinda special it may for example return error as long as any other service is stil registered. And than that specifics can be handled in test system that is using tester application. Other option could be extending BTP to allow for this behavior (eg a command in core service) but I don't have clear idea on how such command should look like (probably should allow for some customization to accommodate for various stacks) |
Hi @sjanc , thanks for your reply. so you mean should not unregister other services inside unregister GAP service? and it should be the test system or user who use bt_tester themselves to unregister the registered services one by one, right? |
Hi @sjanc , As introduced in #67346 , our demand is to have an interface to call |
Hi, Okay, so I thought about this, double checked APIs and discussed this with with Emil. It is not ideal but best we can get regarding BTP and what Zephyr offers. Just make sure to properly toggle BTP_GAP_SETTINGS_POWERED BTP setting when doing so (via BTP_GAP_EV_NEW_SETTINGS event) |
It is, however, very important to note that bt_disable() followed by a bt_enable() does not mimic a reboot. At best it mimics this in the controller, but there are data in the host that is not cleared (most notably registered services, callbacks, etc. (anything that can be changed before calling bt_enable())). |
c00a6c3
to
4824e40
Compare
8a7bc80
to
c3ba9d7
Compare
Thank you very much for the confirmation, agree that currently the set powered command seems to be the most appropriate for the power on/off controller scenario. Well understand it's not system/BT reboot, but can help controller reboot without touch app layer resources. Have submitted the PR for review, kindly pls help to review and approve, let us know any comments. |
c3ba9d7
to
9bba095
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enable set powered command bit in supported_commands(), otherwise looks OK to me
Fill BTP_GAP_SET_POWERED command to support power on/off BT controller Fixes: zephyrproject-rtos#67346 Signed-off-by: Ying Zhang <[email protected]>
9bba095
to
4f16914
Compare
thanks sjanc for the reminder ! Have corrected this |
Hi @zhaynxp! To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge. Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁 |
Fill BTP_GAP_SET_POWERED command to support power on/off BLE controller independently
Fixes: #67346
Signed-off-by: Ying Zhang [email protected]