From 513c973f01492b8c575a850714177fc1eefc6eea Mon Sep 17 00:00:00 2001
From: Matthias Grob <maetugr@gmail.com>
Date: Thu, 15 Nov 2018 11:09:54 +0100
Subject: [PATCH] mc_pos_control: assign events field outside of initializer

Necessary because NuttX defines pollfd differend from
the POSIX standard. The difference of field order makes
use of C++ designated initializers to compile for both
platforms impossible.
---
 src/modules/mc_pos_control/mc_pos_control_main.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/modules/mc_pos_control/mc_pos_control_main.cpp b/src/modules/mc_pos_control/mc_pos_control_main.cpp
index db84e09dff..82dadb94c3 100644
--- a/src/modules/mc_pos_control/mc_pos_control_main.cpp
+++ b/src/modules/mc_pos_control/mc_pos_control_main.cpp
@@ -595,7 +595,8 @@ MulticopterPositionControl::run()
 	_att_sp.landing_gear = vehicle_attitude_setpoint_s::LANDING_GEAR_DOWN;
 
 	// setup file descriptor to poll the local position as loop wakeup source
-	px4_pollfd_struct_t poll_fd = {.fd = _local_pos_sub, .events = POLLIN};
+	px4_pollfd_struct_t poll_fd = {.fd = _local_pos_sub};
+	poll_fd.events = POLLIN;
 
 	while (!should_exit()) {
 		// poll for new data on the local position state topic (wait for up to 20ms)
-- 
GitLab