diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-05-06 14:57:06 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-05-06 14:57:06 +0200 |
commit | 1d6b9fae037422f4c61bdd7ee1a5ea0803a59726 (patch) | |
tree | de9eee67d075d1e5b04746e40d14dc16bebd09db /src/drivers/px4io | |
parent | 13ad95169f1da852f0a641e270669f2f4f3c5ece (diff) | |
download | px4-firmware-1d6b9fae037422f4c61bdd7ee1a5ea0803a59726.tar.gz px4-firmware-1d6b9fae037422f4c61bdd7ee1a5ea0803a59726.tar.bz2 px4-firmware-1d6b9fae037422f4c61bdd7ee1a5ea0803a59726.zip |
Fix in-air restarts, protect against an external MAVLink sender exploiting the restart mechanism
Diffstat (limited to 'src/drivers/px4io')
-rw-r--r-- | src/drivers/px4io/px4io.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 8458c2fdb..aec6dd3b7 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -683,6 +683,25 @@ PX4IO::init() /* send command to arm system via command API */ vehicle_command_s cmd; + /* send this to itself */ + param_t sys_id_param = param_find("MAV_SYS_ID"); + param_t comp_id_param = param_find("MAV_COMP_ID"); + + int32_t sys_id; + int32_t comp_id; + + if (param_get(sys_id_param, &sys_id)) { + errx(1, "PRM SYSID"); + } + + if (param_get(comp_id_param, &comp_id)) { + errx(1, "PRM CMPID"); + } + + cmd.target_system = sys_id; + cmd.target_component = comp_id; + cmd.source_system = sys_id; + cmd.source_component = comp_id; /* request arming */ cmd.param1 = 1.0f; cmd.param2 = 0; @@ -692,10 +711,7 @@ PX4IO::init() cmd.param6 = 0; cmd.param7 = 0; cmd.command = VEHICLE_CMD_COMPONENT_ARM_DISARM; - // cmd.target_system = status.system_id; - // cmd.target_component = status.component_id; - // cmd.source_system = status.system_id; - // cmd.source_component = status.component_id; + /* ask to confirm command */ cmd.confirmation = 1; |