ltq-vdsl-vr9-app: always disconnect on exit

Move the code for disconnection on exit to a separate function, and also
call it in the code path for the "quit" CLI command.

While at it, make the patch description a bit clearer.

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
This commit is contained in:
Jan Hoffmann 2024-07-12 15:49:51 +02:00 committed by Hauke Mehrtens
parent a78ad43d1d
commit 663389c4cf
4 changed files with 37 additions and 25 deletions

View File

@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ltq-vdsl-vr9-app PKG_NAME:=ltq-vdsl-vr9-app
PKG_VERSION:=4.17.18.6 PKG_VERSION:=4.17.18.6
PKG_RELEASE:=6 PKG_RELEASE:=7
PKG_BASE_NAME:=dsl_cpe_control PKG_BASE_NAME:=dsl_cpe_control
PKG_SOURCE:=$(PKG_BASE_NAME)_vrx-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_BASE_NAME)_vrx-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@OPENWRT PKG_SOURCE_URL:=@OPENWRT

View File

@ -1,9 +1,10 @@
This enables automatic connection after the control daemon is started, This enables automatic connection after the control daemon is started,
and also stops the connection on termination. and also stops the connection on termination.
Using the autoboot restart command is necessary because the stop command Using the autoboot restart command (in combination with configuring the
doesn't actually stop the connection, and would also leave the driver in state machine to wait) is necessary because the stop command doesn't
a state where an explicit start command is necessary to connect again. actually stop the connection, and would also leave the driver in a state
where an explicit start command is necessary to connect again.
--- a/src/dsl_cpe_init_cfg.c --- a/src/dsl_cpe_init_cfg.c
+++ b/src/dsl_cpe_init_cfg.c +++ b/src/dsl_cpe_init_cfg.c
@ -18,25 +19,17 @@ a state where an explicit start command is necessary to connect again.
DSL_CPE_LINE_ACTIVATE_CTRL_SET(DSL_G997_INHIBIT_LDSF, DSL_G997_INHIBIT_ACSF, DSL_G997_NORMAL_STARTUP), DSL_CPE_LINE_ACTIVATE_CTRL_SET(DSL_G997_INHIBIT_LDSF, DSL_G997_INHIBIT_ACSF, DSL_G997_NORMAL_STARTUP),
--- a/src/dsl_cpe_control.c --- a/src/dsl_cpe_control.c
+++ b/src/dsl_cpe_control.c +++ b/src/dsl_cpe_control.c
@@ -6515,10 +6515,13 @@ DSL_CPE_STATIC void DSL_CPE_Termination @@ -6491,6 +6491,57 @@ DSL_int32_t DSL_CPE_DeviceInit (
DSL_CPE_STATIC DSL_void_t DSL_CPE_Termination (void) return ret;
{ }
#ifdef INCLUDE_DSL_CPE_CLI_SUPPORT
- DSL_int_t nDevice = 0;
DSL_char_t buf[32] = "quit";
#endif
+DSL_CPE_STATIC DSL_void_t DSL_CPE_ShutdownConnection(void)
+{
+ DSL_Error_t nRet = DSL_SUCCESS; + DSL_Error_t nRet = DSL_SUCCESS;
+ DSL_int_t nDevice = 0; + DSL_int_t nDevice = 0;
+ DSL_AutobootConfig_t sAutobootCfg; + DSL_AutobootConfig_t sAutobootCfg;
+ DSL_AutobootControl_t sAutobootCtl; + DSL_AutobootControl_t sAutobootCtl;
DSL_CPE_Control_Context_t *pCtrlCtx; +
pCtrlCtx = DSL_CPE_GetGlobalContext();
@@ -6527,6 +6530,50 @@ DSL_CPE_STATIC DSL_void_t DSL_CPE_Termi
pCtrlCtx->bRun = DSL_FALSE;
}
+ for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; ++nDevice) + for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; ++nDevice)
+ { + {
+ g_bWaitBeforeConfigWrite[nDevice] = DSL_TRUE; + g_bWaitBeforeConfigWrite[nDevice] = DSL_TRUE;
@ -79,8 +72,27 @@ a state where an explicit start command is necessary to connect again.
+ } + }
+ +
+ DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX + DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX
+ "Autoboot restart executed" DSL_CPE_CRLF)); + "Connection shutdown finished." DSL_CPE_CRLF));
+}
/**
Termination handler. Will clean up in case of ctrl-c.
@@ -6521,6 +6572,8 @@ DSL_CPE_STATIC DSL_void_t DSL_CPE_Termi
DSL_CPE_Control_Context_t *pCtrlCtx;
+ DSL_CPE_ShutdownConnection();
+ +
#ifdef INCLUDE_DSL_CPE_CLI_SUPPORT pCtrlCtx = DSL_CPE_GetGlobalContext();
for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; nDevice++) if (pCtrlCtx != DSL_NULL)
{ {
@@ -7416,6 +7469,9 @@ void DSL_CPE_main(void)
DSL_CPE_STATIC DSL_Error_t DSL_CPE_Control_Exit (DSL_void_t * pContext)
{
dummy_console_t *pConsole = pContext;
+
+ DSL_CPE_ShutdownConnection();
+
pConsole->bRun = DSL_FALSE;
return DSL_SUCCESS;
}

View File

@ -1,6 +1,6 @@
--- a/src/dsl_cpe_control.c --- a/src/dsl_cpe_control.c
+++ b/src/dsl_cpe_control.c +++ b/src/dsl_cpe_control.c
@@ -6504,7 +6504,7 @@ DSL_CPE_STATIC void DSL_CPE_Termination @@ -6555,7 +6555,7 @@ DSL_CPE_STATIC void DSL_CPE_Termination
/* ignore the signal, we'll handle by ourself */ /* ignore the signal, we'll handle by ourself */
signal (sig, SIG_IGN); signal (sig, SIG_IGN);
@ -9,7 +9,7 @@
{ {
DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX "terminated" DSL_CPE_CRLF)); DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX "terminated" DSL_CPE_CRLF));
DSL_CPE_Termination (); DSL_CPE_Termination ();
@@ -6803,6 +6803,7 @@ DSL_int_t dsl_cpe_daemon ( @@ -6809,6 +6809,7 @@ DSL_int_t dsl_cpe_daemon (
#ifndef RTEMS #ifndef RTEMS
signal (SIGINT, DSL_CPE_TerminationHandler); signal (SIGINT, DSL_CPE_TerminationHandler);

View File

@ -10,7 +10,7 @@
DSL_char_t *g_sFirmwareName1 = DSL_NULL; DSL_char_t *g_sFirmwareName1 = DSL_NULL;
DSL_FirmwareFeatures_t g_nFwFeatures1 = {DSL_FW_XDSLMODE_CLEANED, DSL_FW_XDSLFEATURE_CLEANED, DSL_FirmwareFeatures_t g_nFwFeatures1 = {DSL_FW_XDSLMODE_CLEANED, DSL_FW_XDSLFEATURE_CLEANED,
DSL_FW_XDSLFEATURE_CLEANED}; DSL_FW_XDSLFEATURE_CLEANED};
@@ -6806,6 +6809,8 @@ DSL_int_t dsl_cpe_daemon ( @@ -6812,6 +6815,8 @@ DSL_int_t dsl_cpe_daemon (
signal (SIGTERM, DSL_CPE_TerminationHandler); signal (SIGTERM, DSL_CPE_TerminationHandler);
#endif /* RTEMS*/ #endif /* RTEMS*/
@ -19,7 +19,7 @@
/* Open DSL_CPE_MAX_DSL_ENTITIES devices*/ /* Open DSL_CPE_MAX_DSL_ENTITIES devices*/
for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; nDevice++) for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; nDevice++)
{ {
@@ -7260,6 +7265,7 @@ DSL_int_t dsl_cpe_daemon ( @@ -7266,6 +7271,7 @@ DSL_int_t dsl_cpe_daemon (
#endif /* INCLUDE_DSL_CPE_CLI_SUPPORT */ #endif /* INCLUDE_DSL_CPE_CLI_SUPPORT */
DSL_CPE_CONTROL_EXIT: DSL_CPE_CONTROL_EXIT: