aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-11-14 20:00:23 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2019-11-14 20:02:45 +0100
commitd0a2caa021b66d1f5272004c42c817c068be5dc9 (patch)
tree99d52a190e5bd30ed429aaabc87e299975221693 /src
parent38c12e9df9355d7ac6c925296188398904e8fa3f (diff)
power_control.c: Fix ms pwr ctrl skipped if MS doesn't support announced MS Power Level
Diffstat (limited to 'src')
-rw-r--r--src/common/l1sap.c1
-rw-r--r--src/common/power_control.c15
2 files changed, 14 insertions, 2 deletions
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 7bf0b09a..4937d1e5 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1647,6 +1647,7 @@ int l1sap_chan_act(struct gsm_bts_trx *trx, uint8_t chan_nr, struct tlv_parsed *
lchan->sacch_deact = 0;
lchan->s = lchan->ts->trx->bts->radio_link_timeout;
+ lchan->ms_power_ctrl.last_received = -1; /* mark no ms power received yet */
rc = l1sap_chan_act_dact_modify(trx, chan_nr, PRIM_INFO_ACTIVATE, 0);
if (rc)
diff --git a/src/common/power_control.c b/src/common/power_control.c
index 574825e5..129334e7 100644
--- a/src/common/power_control.c
+++ b/src/common/power_control.c
@@ -53,8 +53,19 @@ int lchan_ms_pwr_ctrl(struct gsm_lchan *lchan,
/* The phone hasn't reached the power level yet.
TODO: store .last and check if MS is trying to move towards current. */
- if (lchan->ms_power_ctrl.current != ms_power)
- return 0;
+ if (lchan->ms_power_ctrl.current != ms_power) {
+ if (lchan->ms_power_ctrl.last_received == -1 ||
+ lchan->ms_power_ctrl.last_received != ms_power) {
+ /* MS Power still changing, keep current power level */
+ lchan->ms_power_ctrl.last_received = ms_power;
+ return 0;
+ }
+ /* else: we are stuck with some received MS Power level
+ different than the one we announce, probably because the MS
+ doesn't support that exact one so it picked the nearest one
+ */
+ lchan->ms_power_ctrl.last_received = ms_power;
+ }
/* How many dBs measured power should be increased (+) or decreased (-)
to reach expected power. */