mavlink: consolidated nuttx and posix changes

Removed nuttx and posix specific files for mavlink_ftp and mavlink_receiver.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-04-22 11:08:19 -07:00
parent d63d2f7a61
commit e764c68d0a
6 changed files with 19 additions and 2458 deletions
@@ -820,7 +820,12 @@ MavlinkFTP::_copy_file(const char *src_path, const char *dst_path, size_t length
return -1;
}
dst_fd = ::open(dst_path, O_CREAT | O_TRUNC | O_WRONLY, 0x0777);
dst_fd = ::open(dst_path, O_CREAT | O_TRUNC | O_WRONLY
// POSIX requires the permissions to be supplied if O_CREAT passed
#ifdef __PX4_POSIX
, 0x0777
#endif
);
if (dst_fd < 0) {
op_errno = errno;
::close(src_fd);
File diff suppressed because it is too large Load Diff
@@ -41,7 +41,12 @@
*/
/* XXX trim includes */
#ifdef __PX4_NUTTX
#include <nuttx/config.h>
#include <nuttx/sched.h>
#else
#include <px4_config.h>
#endif
#include <unistd.h>
#include <pthread.h>
#include <stdio.h>
@@ -1495,14 +1500,14 @@ MavlinkReceiver::receive_thread(void *arg)
sprintf(thread_name, "mavlink_rcv_if%d", _mavlink->get_instance_id());
prctl(PR_SET_NAME, thread_name, getpid());
px4_pollfd_struct_t fds[1];
struct pollfd fds[1];
fds[0].fd = uart_fd;
fds[0].events = POLLIN;
ssize_t nread = 0;
while (!_mavlink->_task_should_exit) {
if (px4_poll(fds, 1, timeout) > 0) {
if (poll(fds, 1, timeout) > 0) {
/* non-blocking read. read may return negative values */
if ((nread = ::read(uart_fd, buf, sizeof(buf))) < (ssize_t)sizeof(buf)) {
File diff suppressed because it is too large Load Diff
+1 -5
View File
@@ -38,12 +38,8 @@
MODULE_COMMAND = mavlink_tests
SRCS = mavlink_tests.cpp \
mavlink_ftp_test.cpp \
SRCS += ../mavlink_ftp.cpp \
../mavlink.c
ifeq ($(PX4_TARGET_NUTTX),nuttx)
SRCS += ../mavlink_ftp_nuttx.cpp
else
SRCS += ../mavlink_ftp_posix.cpp
endif
INCLUDE_DIRS += $(MAVLINK_SRC)/include/mavlink
+5 -7
View File
@@ -37,13 +37,9 @@
MODULE_COMMAND = mavlink
ifeq ($(PX4_TARGET_OS),nuttx)
SRCS += mavlink_main_nuttx.cpp \
mavlink_ftp_nuttx.cpp \
mavlink_receiver_nuttx.cpp
SRCS += mavlink_main_nuttx.cpp
else
SRCS += mavlink_main_posix.cpp \
mavlink_ftp_posix.cpp \
mavlink_receiver_posix.cpp
SRCS += mavlink_main_posix.cpp
endif
SRCS += mavlink.c \
@@ -52,7 +48,9 @@ SRCS += mavlink.c \
mavlink_orb_subscription.cpp \
mavlink_messages.cpp \
mavlink_stream.cpp \
mavlink_rate_limiter.cpp
mavlink_rate_limiter.cpp \
mavlink_receiver.cpp \
mavlink_ftp.cpp
INCLUDE_DIRS += $(MAVLINK_SRC)/include/mavlink