diff --git a/libraries/AP_SerialManager/AP_SerialManager.cpp b/libraries/AP_SerialManager/AP_SerialManager.cpp index f0d208605f..d24ef69f5e 100644 --- a/libraries/AP_SerialManager/AP_SerialManager.cpp +++ b/libraries/AP_SerialManager/AP_SerialManager.cpp @@ -355,6 +355,18 @@ void AP_SerialManager::init() state[7].uart = hal.uartH; // serial7 #endif +#ifdef HAL_OTG1_CONFIG + /* + prevent users from changing USB protocol to other than + MAVLink. This fixes an issue where users trying to get SLCAN + change SERIAL0_PROTOCOL to 22 and find they can no longer connect + */ + if (state[0].protocol != SerialProtocol_MAVLink && + state[0].protocol != SerialProtocol_MAVLink2) { + state[0].protocol.set(SerialProtocol_MAVLink2); + } +#endif + #if SERIALMANAGER_NUM_PORTS > 0 if (state[0].uart == nullptr) { init_console();