Max has submitted this change and it was merged. Change subject: Prepare for BTS attribute reporting via OML ......................................................................
Prepare for BTS attribute reporting via OML * move BTS model name resolution into separate function * add convenience wrappers for BTS type and number fo TRX and use then in L1 interface Change-Id: I4649100df8f1b8e095f210fc294567ba014c0b6a Related: OS#1614 --- M src/osmo-bts-sysmo/l1_if.c M src/osmo-bts-sysmo/misc/sysmobts_mgr.c M src/osmo-bts-sysmo/misc/sysmobts_mgr_nl.c M src/osmo-bts-sysmo/misc/sysmobts_par.c M src/osmo-bts-sysmo/misc/sysmobts_par.h 5 files changed, 39 insertions(+), 25 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index 8eb6fcc..85fa3d7 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -1553,7 +1553,7 @@ eeprom_SysInfo_t sysinfo; int val, rc; - rc = sysmobts_par_get_int(SYSMOBTS_PAR_MODEL_NR, &val); + rc = sysmobts_get_type(&val); if (rc < 0) return rc; fl1h->hw_info.model_nr = val; @@ -1563,7 +1563,7 @@ return rc; fl1h->hw_info.model_flags = val; - rc = sysmobts_par_get_int(SYSMOBTS_PAR_TRX_NR, &val); + rc = sysmobts_get_trx(&val); if (rc < 0) return rc; fl1h->hw_info.trx_nr = val; diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr.c index e9c59bc..6fadf0f 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr.c @@ -90,13 +90,13 @@ { int rc; - rc = sysmobts_par_get_int(SYSMOBTS_PAR_MODEL_NR, &bts_type); + rc = sysmobts_get_type(&bts_type); if (rc < 0) { fprintf(stderr, "Failed to get model number.\n"); return -1; } - rc = sysmobts_par_get_int(SYSMOBTS_PAR_TRX_NR, &trx_number); + rc = sysmobts_get_trx(&trx_number); if (rc < 0) { fprintf(stderr, "Failed to get the trx number.\n"); return -1; diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_nl.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_nl.c index f41bec2..48a0312 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_nl.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_nl.c @@ -108,26 +108,7 @@ snprintf(ser_str, sizeof(ser_str), "%d", serno); /* fetch the model and trx number */ - switch(sysmobts_bts_type()) { - case 0: - case 0xffff: - case 1002: - model_name = "sysmoBTS 1002"; - break; - case 2050: - if (sysmobts_trx_number() == 0) - model_name = "sysmoBTS 2050 (master)"; - else if (sysmobts_trx_number() == 1) - model_name = "sysmoBTS 2050 (slave)"; - else - model_name = "sysmoBTS 2050 (unknown)"; - break; - default: - model_name = "Unknown"; - break; - } - - + model_name = sysmobts_model(sysmobts_bts_type(), sysmobts_trx_number()); fetched_info = 1; } diff --git a/src/osmo-bts-sysmo/misc/sysmobts_par.c b/src/osmo-bts-sysmo/misc/sysmobts_par.c index 98fe02b..de81fff 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_par.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_par.c @@ -324,6 +324,37 @@ return 0; } +int sysmobts_get_type(int *bts_type) +{ + return sysmobts_par_get_int(SYSMOBTS_PAR_MODEL_NR, bts_type); +} + +int sysmobts_get_trx(int *trx_number) +{ + return sysmobts_par_get_int(SYSMOBTS_PAR_TRX_NR, trx_number); +} + +char *sysmobts_model(int bts_type, int trx_num) +{ + switch(bts_type) { + case 0: + case 0xffff: + case 1002: + return "sysmoBTS 1002"; + case 2050: + switch(trx_num) { + case 0: + return "sysmoBTS 2050 (master)"; + case 1: + return "sysmoBTS 2050 (slave)"; + default: + return "sysmoBTS 2050 (unknown)"; + } + default: + return "Unknown"; + } +} + int sysmobts_par_set_net(struct sysmobts_net_cfg *cfg) { struct sysmobts_eeprom *ee = get_eeprom(1); diff --git a/src/osmo-bts-sysmo/misc/sysmobts_par.h b/src/osmo-bts-sysmo/misc/sysmobts_par.h index 5a603cc..52bf67d 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_par.h +++ b/src/osmo-bts-sysmo/misc/sysmobts_par.h @@ -30,7 +30,9 @@ unsigned int size); int sysmobts_par_get_net(struct sysmobts_net_cfg *cfg); int sysmobts_par_set_net(struct sysmobts_net_cfg *cfg); - +int sysmobts_get_type(int *bts_type); +int sysmobts_get_trx(int *trx_number); +char *sysmobts_model(int bts_type, int trx_num); int sysmobts_par_is_int(enum sysmobts_par par); #endif -- To view, visit https://gerrit.osmocom.org/2574 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4649100df8f1b8e095f210fc294567ba014c0b6a Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max <msur...@sysmocom.de> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msur...@sysmocom.de>