summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMDLZCOOL <[email protected]>2026-10-09 14:40:49 +0800
committersakumisu <[email protected]>2026-10-09 15:48:58 +0800
commitef9313da753d39404abcf37d43c0a4915ef2bdd6 (patch)
treef463ae835d1c1d098a73e20b6d7927abcb00c97f /platform
parent4f59d17d5cb064849492756a1a9a626f87c5feef (diff)
fix(platform/rtthread): fix build error and make rtthread usbd adb shell run
Signed-off-by: MDLZCOOL <[email protected]>
Diffstat (limited to 'platform')
-rw-r--r--platform/rtthread/rt_usbd_adb_msh.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/platform/rtthread/rt_usbd_adb_msh.c b/platform/rtthread/rt_usbd_adb_msh.c
index 46ce2608..fa483675 100644
--- a/platform/rtthread/rt_usbd_adb_msh.c
+++ b/platform/rtthread/rt_usbd_adb_msh.c
@@ -9,6 +9,11 @@
#include "usbd_core.h"
#include "usbd_adb.h"
+#ifdef RT_USING_FINSH
+#include <shell.h>
+#include <finsh.h>
+#endif
+
#ifndef CONFIG_USBDEV_SHELL_RX_BUFSIZE
#define CONFIG_USBDEV_SHELL_RX_BUFSIZE (2048)
#endif
@@ -111,7 +116,12 @@ static void adb_shell_on_close(uint32_t remoteid)
static void adb_shell_on_write(uint32_t remoteid, const uint8_t *data, uint32_t len)
{
- rt_ringbuffer_put(&g_usbd_adb_shell.rx_rb, data, len);
+ rt_size_t put;
+
+ put = rt_ringbuffer_put(&g_usbd_adb_shell.rx_rb, data, len);
+ if (g_usbd_adb_shell.parent.rx_indicate != RT_NULL) {
+ g_usbd_adb_shell.parent.rx_indicate(&g_usbd_adb_shell.parent, put);
+ }
}
static const struct adb_service adb_shell_service = {
@@ -147,10 +157,12 @@ static int adb_exit(int argc, char **argv)
(void)argc;
(void)argv;
- usbd_adb_close(ADB_SHELL_LOALID);
+ usbd_adb_close(ADB_LOCALID_SHELL);
- finsh_set_device(RT_CONSOLE_DEVICE_NAME);
- rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
+ if (rt_console_get_device() != rt_device_find(RT_CONSOLE_DEVICE_NAME)) {
+ rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
+ finsh_set_device(RT_CONSOLE_DEVICE_NAME);
+ }
return 0;
}