From 589501a487339fed6b07ba323dd262fccd2cbb1c Mon Sep 17 00:00:00 2001 From: chao an Date: Thu, 27 Nov 2025 21:37:45 +0800 Subject: [PATCH] drivers/rpmsg/ping: skip rpmsg ping send if endpoint is not ready rpmsg ping send blocks for 15 seconds until the ept is ready, which is not ideal for applications that need to monitor ping status. In this PR, we will check if the ept is ready to avoid prolonged blocking in the underlying driver. Signed-off-by: chao an --- drivers/rpmsg/rpmsg_ping.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/rpmsg/rpmsg_ping.c b/drivers/rpmsg/rpmsg_ping.c index 8e315ee89a1..e34375f5596 100644 --- a/drivers/rpmsg/rpmsg_ping.c +++ b/drivers/rpmsg/rpmsg_ping.c @@ -126,6 +126,11 @@ static int rpmsg_ping_once(FAR struct rpmsg_endpoint *ept, int len, FAR struct rpmsg_ping_msg_s *msg; int ret; + if (!is_rpmsg_ept_ready(ept)) + { + return -ENOTCONN; + } + msg = rpmsg_get_tx_payload_buffer(ept, buf_len, true); if (!msg) { @@ -162,7 +167,7 @@ static int rpmsg_ping_once(FAR struct rpmsg_endpoint *ept, int len, msg->cookie = (uintptr_t)&sem; nxsem_init(&sem, 0, 0); - ret = rpmsg_send_nocopy(ept, msg, msg->len); + ret = rpmsg_sendto_nocopy(ept, msg, msg->len, ept->dest_addr); if (ret >= 0) { nxsem_wait_uninterruptible(&sem); @@ -172,7 +177,7 @@ static int rpmsg_ping_once(FAR struct rpmsg_endpoint *ept, int len, } else { - ret = rpmsg_send_nocopy(ept, msg, msg->len); + ret = rpmsg_sendto_nocopy(ept, msg, msg->len, ept->dest_addr); } if (ret < 0)