-
Notifications
You must be signed in to change notification settings - Fork 1.4k
samples: nrf_rpc: ps: Support for disabling RPC communication #25160
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
Conversation
CI InformationTo view the history of this post, click the 'edited' button above Inputs:Sources:sdk-nrf: PR head: 6439e00e806dbf27b44f9f90d1936e4f35e0d9cd more detailssdk-nrf:
nrfxlib:
Github labels
List of changed files detected by CI (5)Outputs:ToolchainVersion: cfa6b06338 Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
|
The following west manifest projects have changed revision in this Pull Request:
✅ All manifest checks OK Note: This message is automatically posted and updated by the Manifest GitHub Action. |
|
You can find the documentation preview for this PR here. |
08b0a7c to
957f474
Compare
subsys/nrf_rpc/nrf_rpc_os.c
Outdated
| msg->data = data; | ||
| msg->len = len; | ||
| (void)k_condvar_signal(&msg->event); | ||
|
|
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.
accidental newline?
| #if defined(CONFIG_NRF_RPC_UTILS_SYSTEM_HEALTH) | ||
| SHELL_CMD_ARG(system_health, NULL, "Get system health", cmd_system_health, 0, 0), | ||
| #endif | ||
| SHELL_CMD_ARG(rpc, NULL, "Control RPC subsystem ", cmd_rpc, 2, 0), |
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.
Using rpc as subcommand would result in usage like: rpc rpc 1, maybe we can use something like control? e.g. rpc control enable/disable (these are parsed properly by shell_strtobool())
| if (argc > 1) { | ||
| bool enable; | ||
|
|
||
| enable = shell_strtobool(argv[1], 10, &err); |
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.
The call can be moved to declaration of bool enable above
|
|
||
| static int cmd_rpc(const struct shell *sh, size_t argc, char *argv[]) | ||
| { | ||
| static bool enabled; |
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.
Wouldn't it be initialized to false before the first call so if you call the command without any argument it will say that RPC is disabled despite it is succesfuly running?
subsys/nrf_rpc/nrf_rpc_cbkproxy.c
Outdated
|
|
||
| static uint32_t next_free_in_slot; | ||
|
|
||
| void ot_rpc_cbproxy_clear(void *context) |
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.
It can be static
957f474 to
885201f
Compare
subsys/nrf_rpc/nrf_rpc_cbkproxy.c
Outdated
|
|
||
| static uint32_t next_free_in_slot; | ||
|
|
||
| static void ot_rpc_cbproxy_clear(void *context) |
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.
This feature is not limited to OT, so the naming is confusing.
885201f to
b2d9731
Compare
Added functions to stop and restore RPC communication. Stopping the communication automatically times out all pending tasks and prevents new communication. Init messages, errors and acks are still allowed. This is intended to allow smooth recovery after failures. Additionally all calbacks that use common API may be cleared. Signed-off-by: Marek Porwisz <[email protected]>
b2d9731 to
6439e00
Compare
Added support for stopping and restoring the RPC communication.
See also nrfconnect/sdk-nrfxlib#1886
If the RPC server becomes unresponsive it needs to be reset. In order to do this apart from releasing all the client threads waiting, callback tables need to be cleared as well.
Added cleanup handler registration that clears entire callback table when RPC communication is stopped.