aboutsummaryrefslogtreecommitdiffstats
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-09 21:57:13 +0100
commitd8d5f5904fa83786b01dbf77593232eb6f6954bc (patch)
treefb5c3cd899ee23df17eff517eb22ced46e70b074
parent9acc82ce4a01d502db1be8cdf15d2328ae181c5c (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.
-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 3999ffb..2d06084 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 5e16f8d..964a9b6 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,