mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-09-23 10:18:30 +08:00
fix(nshterm): went out of stack
fix(mavlink_shell): no echo of commands
This commit is contained in:
committed by
Peter van der Perk
parent
7a1a17d3e7
commit
8a8f32699b
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user