Browse Source

mavlink: shell expand locking (#19308)

- on some H7 boards (cuav x7pro tested) there's an occasional hard fault when starting the mavlink shell that is no longer reproducible with the slightly expanded locking
 - this is likely just changing the timing (holding the sched lock for longer), but this should be harmless for now until we can identify the root cause
v1.13.0-BW
Daniel Agar 3 years ago committed by GitHub
parent
commit
6359c8c008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/modules/mavlink/mavlink_main.cpp
  2. 8
      src/modules/mavlink/mavlink_shell.cpp

14
src/modules/mavlink/mavlink_main.cpp

@ -1334,18 +1334,20 @@ MavlinkShell *
Mavlink::get_shell() Mavlink::get_shell()
{ {
if (!_mavlink_shell) { if (!_mavlink_shell) {
_mavlink_shell = new MavlinkShell(); MavlinkShell *shell = new MavlinkShell();
if (!_mavlink_shell) { if (!shell) {
PX4_ERR("Failed to allocate a shell"); PX4_ERR("Failed to allocate a shell");
} else { } else {
int ret = _mavlink_shell->start(); int ret = shell->start();
if (ret != 0) { if (ret == 0) {
_mavlink_shell = shell;
} else {
PX4_ERR("Failed to start shell (%i)", ret); PX4_ERR("Failed to start shell (%i)", ret);
delete _mavlink_shell; delete shell;
_mavlink_shell = nullptr;
} }
} }
} }

8
src/modules/mavlink/mavlink_shell.cpp

@ -148,14 +148,14 @@ int MavlinkShell::start()
close(fd_backups[i]); close(fd_backups[i]);
} }
#ifdef __PX4_NUTTX
sched_unlock();
#endif /* __PX4_NUTTX */
//close unused pipe fd's //close unused pipe fd's
close(_shell_fds[0]); close(_shell_fds[0]);
close(_shell_fds[1]); close(_shell_fds[1]);
#ifdef __PX4_NUTTX
sched_unlock();
#endif /* __PX4_NUTTX */
return ret; return ret;
} }

Loading…
Cancel
Save