diff --git a/doc/releases/migration-guide-4.3.rst b/doc/releases/migration-guide-4.3.rst index f668d9ef6f561..730ec6a0ed0d4 100644 --- a/doc/releases/migration-guide-4.3.rst +++ b/doc/releases/migration-guide-4.3.rst @@ -41,6 +41,13 @@ Networking Other subsystems **************** +Shell +===== + +* The MQTT topics related to :kconfig:option:`SHELL_BACKEND_MQTT` have been renamed. Renamed + ``_rx`` to ``/sh/rx`` and ``_tx`` to ``/sh/rx``. + (:github:`92677`). + Modules ******* diff --git a/include/zephyr/shell/shell_mqtt.h b/include/zephyr/shell/shell_mqtt.h index 92ce6987efefc..3372730d19d80 100644 --- a/include/zephyr/shell/shell_mqtt.h +++ b/include/zephyr/shell/shell_mqtt.h @@ -25,7 +25,7 @@ extern "C" { #define SH_MQTT_BUFFER_SIZE 64 #define DEVICE_ID_BIN_MAX_SIZE 3 #define DEVICE_ID_HEX_MAX_SIZE ((DEVICE_ID_BIN_MAX_SIZE * 2) + 1) -#define SH_MQTT_TOPIC_MAX_SIZE DEVICE_ID_HEX_MAX_SIZE + 3 +#define SH_MQTT_TOPIC_MAX_SIZE DEVICE_ID_HEX_MAX_SIZE + 6 /* /sh/rx */ extern const struct shell_transport_api shell_mqtt_transport_api; diff --git a/subsys/shell/backends/shell_mqtt.c b/subsys/shell/backends/shell_mqtt.c index d77cbac674237..0e9747d09e6e2 100644 --- a/subsys/shell/backends/shell_mqtt.c +++ b/subsys/shell/backends/shell_mqtt.c @@ -657,8 +657,8 @@ static int init(const struct shell_transport *transport, const void *config, LOG_DBG("Client ID is %s", sh->device_id); - (void)snprintf(sh->pub_topic, SH_MQTT_TOPIC_MAX_SIZE, "%s_tx", sh->device_id); - (void)snprintf(sh->sub_topic, SH_MQTT_TOPIC_MAX_SIZE, "%s_rx", sh->device_id); + (void)snprintf(sh->pub_topic, SH_MQTT_TOPIC_MAX_SIZE, "%s/sh/tx", sh->device_id); + (void)snprintf(sh->sub_topic, SH_MQTT_TOPIC_MAX_SIZE, "%s/sh/rx", sh->device_id); ring_buf_init(&sh->rx_rb, RX_RB_SIZE, sh->rx_rb_buf);