<p>Harald Welte has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/14275">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">trxcon: Suppress POWERON to TRX if we're already powered on.<br><br>The existing logic unconditionally wants to send a POWERUP command<br>whenever L1CTL_DM_EST_REQ is received.  That's odd, as it's perfectly<br>legal to establish, then release (DM_REL_REQ) and finally establish<br>another connection.<br><br>The existing fsm state could unfortunately not been used, as it's a<br>mixture between the TRX connection state and the command/response state.<br><br>I'm explicitly not rejecting POWEROFF despite trxcon thinking it's<br>powered up: This can happen if fake_trx is restarted while trxcon<br>is running.<br><br>Change-Id: I834e8897b95a2490811319697fc7cab6076db480<br>---<br>M src/host/trxcon/trx_if.c<br>M src/host/trxcon/trx_if.h<br>2 files changed, 11 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/75/14275/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c</span><br><span>index 35ad3c0..894aed2 100644</span><br><span>--- a/src/host/trxcon/trx_if.c</span><br><span>+++ b/src/host/trxcon/trx_if.c</span><br><span>@@ -254,6 +254,10 @@</span><br><span> </span><br><span> int trx_if_cmd_poweron(struct trx_instance *trx)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+      if (trx->powered_up) {</span><br><span style="color: hsl(120, 100%, 40%);">+             LOGP(DTRX, LOGL_INFO, "Suppressing POWERON as we're already powered up\n");</span><br><span style="color: hsl(120, 100%, 40%);">+             return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span>    return trx_ctrl_cmd(trx, 1, "POWERON", "");</span><br><span> }</span><br><span> </span><br><span>@@ -495,10 +499,14 @@</span><br><span>     }</span><br><span> </span><br><span>        /* Trigger state machine */</span><br><span style="color: hsl(0, 100%, 40%);">-     if (!strncmp(tcm->cmd + 4, "POWERON", 7))</span><br><span style="color: hsl(120, 100%, 40%);">+        if (!strncmp(tcm->cmd + 4, "POWERON", 7)) {</span><br><span style="color: hsl(120, 100%, 40%);">+              trx->powered_up = true;</span><br><span>           osmo_fsm_inst_state_chg(trx->fsm, TRX_STATE_ACTIVE, 0, 0);</span><br><span style="color: hsl(0, 100%, 40%);">-   else if (!strncmp(tcm->cmd + 4, "POWEROFF", 8))</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span style="color: hsl(120, 100%, 40%);">+     else if (!strncmp(tcm->cmd + 4, "POWEROFF", 8)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                trx->powered_up = false;</span><br><span>          osmo_fsm_inst_state_chg(trx->fsm, TRX_STATE_IDLE, 0, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span>    else if (!strncmp(tcm->cmd + 4, "MEASURE", 7))</span><br><span>          trx_if_measure_rsp_cb(trx, buf + 14);</span><br><span>        else if (!strncmp(tcm->cmd + 4, "ECHO", 4))</span><br><span>diff --git a/src/host/trxcon/trx_if.h b/src/host/trxcon/trx_if.h</span><br><span>index 0b3f36f..8655c15 100644</span><br><span>--- a/src/host/trxcon/trx_if.h</span><br><span>+++ b/src/host/trxcon/trx_if.h</span><br><span>@@ -26,6 +26,7 @@</span><br><span>    struct llist_head trx_ctrl_list;</span><br><span>     struct osmo_fsm_inst *fsm;</span><br><span>   uint32_t prev_state;</span><br><span style="color: hsl(120, 100%, 40%);">+  bool powered_up;</span><br><span> </span><br><span>         /* GSM L1 specific */</span><br><span>        uint16_t pm_band_arfcn_start;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/14275">change 14275</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/14275"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmocom-bb </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I834e8897b95a2490811319697fc7cab6076db480 </div>
<div style="display:none"> Gerrit-Change-Number: 14275 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Harald Welte <laforge@gnumonks.org> </div>