From afff64532062fec1f3fb90bec183550d6050fd9a Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Wed, 8 Dec 2021 11:53:30 -0500 Subject: [PATCH] fix incorrect location of mode check for hotspots; --- host/Host.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/host/Host.cpp b/host/Host.cpp index 42dcbe0e..db40181b 100644 --- a/host/Host.cpp +++ b/host/Host.cpp @@ -544,19 +544,7 @@ int Host::run() g_killed = true; } - // check if the modem is a hotspot - if (m_modem->isHotspot()) { - if (m_dmrEnabled && m_p25Enabled) { - ::LogError(LOG_HOST, "Dual-mode (DMR and P25) is not supported for hotspots!"); - g_killed = true; - } - else { - if (!m_fixedMode) { - ::LogInfoEx(LOG_HOST, "Host is running on a hotspot modem! Fixed mode is forced."); - m_fixedMode = true; - } - } - } + bool killed = false; if (!g_killed) { // fixed more or P25 control channel will force a state change @@ -595,11 +583,26 @@ int Host::run() break; } + // check if the modem is a hotspot (this check must always be done after late init) + if (m_modem->isHotspot()) + { + if (m_dmrEnabled && m_p25Enabled) { + ::LogError(LOG_HOST, "Dual-mode (DMR and P25) is not supported for hotspots!"); + g_killed = true; + killed = true; + } + else { + if (!m_fixedMode) { + ::LogInfoEx(LOG_HOST, "Host is running on a hotspot modem! Fixed mode is forced."); + m_fixedMode = true; + } + } + } + ::LogInfoEx(LOG_HOST, "Host is up and running"); stopWatch.start(); } - bool killed = false; bool hasTxShutdown = false; // Macro to interrupt a running P25 control channel transmission @@ -1933,6 +1936,8 @@ void Host::setState(uint8_t state) m_modeTimer.stop(); if (m_state == HOST_STATE_QUIT) { + ::LogInfoEx(LOG_HOST, "Host is shutting down"); + if (m_modem != NULL) { m_modem->close(); delete m_modem;