mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 18:13:34 +08:00
mavlink: check type on instance getting by device or network port
otherwise serial mavlink running in first will occupy default net port 14556 and could be wrongly used for stream configuring instead or udp mavlink running in first will occupy default serial "/dev/ttyS1"and could be wrongly used for stream configuring instead issue #15558
This commit is contained in:
@@ -331,7 +331,7 @@ Mavlink::get_instance_for_device(const char *device_name)
|
||||
Mavlink *inst;
|
||||
|
||||
LL_FOREACH(::_mavlink_instances, inst) {
|
||||
if (strcmp(inst->_device_name, device_name) == 0) {
|
||||
if ((inst->_protocol == Protocol::SERIAL) && (strcmp(inst->_device_name, device_name) == 0)) {
|
||||
return inst;
|
||||
}
|
||||
}
|
||||
@@ -346,7 +346,7 @@ Mavlink::get_instance_for_network_port(unsigned long port)
|
||||
Mavlink *inst;
|
||||
|
||||
LL_FOREACH(::_mavlink_instances, inst) {
|
||||
if (inst->_network_port == port) {
|
||||
if ((inst->_protocol == Protocol::UDP) && (inst->_network_port == port)) {
|
||||
return inst;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user