fix(nshterm): went out of stack

fix(mavlink_shell): no echo of commands
This commit is contained in:
Marin Doetterer
2026-08-13 18:56:55 +02:00
committed by Peter van der Perk
parent 7a1a17d3e7
commit 8a8f32699b
2 changed files with 10 additions and 2 deletions

View File

@@ -70,6 +70,10 @@ MavlinkShell::~MavlinkShell()
if (_from_shell_fd >= 0) {
close(_from_shell_fd);
}
if (_shell_fds[1] >= 0) {
close(_shell_fds[1]);
}
}
int MavlinkShell::start()
@@ -170,9 +174,8 @@ int MavlinkShell::start()
#endif
//close unused pipe fd's
//close unused pipe fd's; _shell_fds[1] is kept open, write() reuses it to echo input
close(_shell_fds[0]);
close(_shell_fds[1]);
#ifdef __PX4_NUTTX
sched_unlock();
@@ -214,6 +217,10 @@ int MavlinkShell::shell_start_thread(int argc, char *argv[])
size_t MavlinkShell::write(uint8_t *buffer, size_t len)
{
if (::write(_shell_fds[1], buffer, len) < 0) {
PX4_WARN("echo failed");
}
return ::write(_to_shell_fd, buffer, len);
}

View File

@@ -34,6 +34,7 @@ px4_add_module(
MODULE systemcmds__nshterm
MAIN nshterm
PRIORITY "SCHED_PRIORITY_DEFAULT-30"
STACK_MAIN 4096
COMPILE_FLAGS
SRCS
nshterm.cpp