aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-26 16:26:03 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-26 16:27:36 +0100
commit5a906c7b725af6d73d5b38f666833d1e56c3a673 (patch)
treeb745541205b8cc23f821fa66380c4cad61e32e8e
parent50dc96507caba9480938eb3d9d0db9236f877b49 (diff)
sysmobts: WIP: allow to use the serial number as unit id
-rw-r--r--include/osmo-bts/gsm_data.h1
-rw-r--r--src/osmo-bts-sysmo/sysmobts_vty.c46
2 files changed, 47 insertions, 0 deletions
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index 5e0af77..0ff8ccc 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -84,6 +84,7 @@ struct gsm_bts_role_bts {
/* used by the sysmoBTS to adjust band */
uint8_t auto_band;
+ uint8_t unitid_use_eeprom;
};
enum lchan_ciph_state {
diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c
index 8b617d7..0fe4d36 100644
--- a/src/osmo-bts-sysmo/sysmobts_vty.c
+++ b/src/osmo-bts-sysmo/sysmobts_vty.c
@@ -43,6 +43,7 @@
#include <osmo-bts/logging.h>
#include <osmo-bts/vty.h>
+#include "misc/sysmobts_par.h"
#include "femtobts.h"
#include "l1_if.h"
#include "utils.h"
@@ -84,6 +85,47 @@ DEFUN(cfg_bts_no_auto_band, cfg_bts_no_auto_band_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_bts_unit_id, cfg_bts_unit_id_cmd,
+ "ipa unit-id eeprom",
+ "ip.access RSL commands\n"
+ "Set the Unit ID of this BTS\n"
+ "Use serial number as Unit ID\n")
+{
+ int serial_nr, rc;
+ struct gsm_bts *bts = vty->index;
+ struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
+
+ rc = sysmobts_par_get_int(SYSMOBTS_PAR_SERNR, &serial_nr);
+ if (rc != 0) {
+ vty_out(vty, "Failed to read serial number%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if (serial_nr < 0) {
+ vty_out(vty, "Serial number(%d) not valid%s",
+ serial_nr, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ btsb->unitid_use_eeprom = 1;
+ bts->ip_access.bts_id = 0;
+ bts->ip_access.site_id = serial_nr;
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_no_unit_id, cfg_bts_no_unit_id_cmd,
+ "no ipa unit-id eeprom",
+ NO_STR "ip.access RSL commands\n"
+ "Set the Unit ID of this BTS\n"
+ "Use serial number as Unit ID\n")
+{
+ struct gsm_bts *bts = vty->index;
+ struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
+
+ btsb->unitid_use_eeprom = 0;
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_trx_gsmtap_sapi, cfg_trx_gsmtap_sapi_cmd,
"HIDDEN", "HIDDEN")
{
@@ -495,6 +537,8 @@ void bts_model_config_write_bts(struct vty *vty, struct gsm_bts *bts)
if (btsb->auto_band)
vty_out(vty, " auto-band%s", VTY_NEWLINE);
+ if (btsb->unitid_use_eeprom)
+ vty_out(vty, " ipa unit-id eeprom%s", VTY_NEWLINE);
}
/* FIXME: move to libosmocore ? */
@@ -608,6 +652,8 @@ int bts_model_vty_init(struct gsm_bts *bts)
install_element(BTS_NODE, &cfg_bts_auto_band_cmd);
install_element(BTS_NODE, &cfg_bts_no_auto_band_cmd);
+ install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
+ install_element(BTS_NODE, &cfg_bts_no_unit_id_cmd);
install_element(TRX_NODE, &cfg_trx_clkcal_cmd);
install_element(TRX_NODE, &cfg_trx_clkcal_eeprom_cmd);