diff options
author | Harald Welte <laforge@gnumonks.org> | 2019-05-30 15:21:45 +0200 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2019-05-31 22:35:31 +0700 |
commit | fd6c211eab32d489a304bb3ae63774887a3d6024 (patch) | |
tree | acb7e2b8cdc50b65d0a0f717c7879d25df95c863 /src/host/trxcon/trx_if.c | |
parent | 1a66c2991cbd90e5bdc51bfcfcfcd851b4abb2a3 (diff) |
trxcon: Suppress POWERON to TRX if we're already powered on.
The existing logic unconditionally wants to send a POWERON command
on TRXC whenever L1CTL_FBSB_REQ is received. That may cause some
problems when sending subsequent L1CTL_FBSB_REQ, e.g. due to signal loss.
Sending POWEROFF when transceiver is not powered on is normal though.
This can happen if trxcon is restarted while fake_trx was running.
The existing FSM state could unfortunately not been used, as it's a
mixture between the TRX connection state and the command/response state.
The current solution is just a work around. We definitely need to
introduce separate state machines for transceiver and its TRXC
interface.
Change-Id: I834e8897b95a2490811319697fc7cab6076db480
Diffstat (limited to 'src/host/trxcon/trx_if.c')
-rw-r--r-- | src/host/trxcon/trx_if.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c index 35ad3c02..ca78349a 100644 --- a/src/host/trxcon/trx_if.c +++ b/src/host/trxcon/trx_if.c @@ -254,6 +254,11 @@ int trx_if_cmd_poweroff(struct trx_instance *trx) int trx_if_cmd_poweron(struct trx_instance *trx) { + if (trx->powered_up) { + /* FIXME: this should be handled by the FSM, not here! */ + LOGP(DTRX, LOGL_ERROR, "Suppressing POWERON as we're already powered up\n"); + return -EAGAIN; + } return trx_ctrl_cmd(trx, 1, "POWERON", ""); } @@ -495,10 +500,14 @@ static int trx_ctrl_read_cb(struct osmo_fd *ofd, unsigned int what) } /* Trigger state machine */ - if (!strncmp(tcm->cmd + 4, "POWERON", 7)) + if (!strncmp(tcm->cmd + 4, "POWERON", 7)) { + trx->powered_up = true; osmo_fsm_inst_state_chg(trx->fsm, TRX_STATE_ACTIVE, 0, 0); - else if (!strncmp(tcm->cmd + 4, "POWEROFF", 8)) + } + else if (!strncmp(tcm->cmd + 4, "POWEROFF", 8)) { + trx->powered_up = false; osmo_fsm_inst_state_chg(trx->fsm, TRX_STATE_IDLE, 0, 0); + } else if (!strncmp(tcm->cmd + 4, "MEASURE", 7)) trx_if_measure_rsp_cb(trx, buf + 14); else if (!strncmp(tcm->cmd + 4, "ECHO", 4)) |