aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-23 09:45:55 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-01-06 19:14:30 +0100
commita70c8f1c8ae5b222008888d98bdf7deee411d2e3 (patch)
treed2bc8a467bcd9f2197ff5a844540f66e92dfc50c /src
parent0ae0c43883fa3c60ed3adf9703236db873b4229f (diff)
sysmobts: Start the calibration the first time the link is up
After a reboot the system might have been off for a long time and the currently used value might be wrong. Remember that we never ran the calibration and execute it on start.
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr.h1
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr_calib.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr.h b/src/osmo-bts-sysmo/misc/sysmobts_mgr.h
index 3999ffb4..2d060843 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr.h
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr.h
@@ -84,6 +84,7 @@ struct sysmobts_mgr_instance {
enum sysmobts_temp_state state;
struct {
+ int initial_calib_started;
int is_up;
struct osmo_timer_list recon_timer;
struct ipa_client_conn *bts_conn;
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_calib.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_calib.c
index 5e16f8dd..964a9b6c 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_calib.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_calib.c
@@ -22,6 +22,7 @@
*/
#include "misc/sysmobts_mgr.h"
+#include "misc/sysmobts_misc.h"
#include "osmo-bts/msg_utils.h"
#include <osmocom/core/logging.h>
@@ -199,6 +200,8 @@ int sysmobts_mgr_calib_run(struct sysmobts_mgr_instance *mgr)
return -2;
}
+ /* From now on everything will be handled from the failure */
+ mgr->calib.initial_calib_started = 1;
mgr_gps_open(mgr);
return 0;
}
@@ -451,6 +454,9 @@ static void bts_updown_cb(struct ipa_client_conn *link, int up)
mgr->calib.is_up = 1;
mgr->calib.last_seqno = 0;
calib_state_reset(mgr);
+
+ if (!mgr->calib.initial_calib_started)
+ sysmobts_mgr_calib_run(mgr);
} else {
mgr->calib.is_up = 0;
schedule_bts_connect(mgr);
@@ -460,6 +466,12 @@ static void bts_updown_cb(struct ipa_client_conn *link, int up)
int sysmobts_mgr_calib_init(struct sysmobts_mgr_instance *mgr)
{
+ if (!is_sbts2050_master()) {
+ LOGP(DCALIB, LOGL_NOTICE,
+ "Calib is only possible on the sysmoBTS2050 master\n");
+ return 0;
+ }
+
mgr->calib.bts_conn = ipa_client_conn_create(tall_mgr_ctx, NULL, 0,
"localhost", 4238,
bts_updown_cb, bts_read_cb,