aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-litecell15/main.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-06-10 22:26:35 +0200
committerHarald Welte <laforge@gnumonks.org>2018-09-16 10:45:01 +0000
commit19795c5ab22b6502f543a44b30224ad57befafa4 (patch)
treefdaed4eff953681c8a28e70e0e9766cd8d619baa /src/osmo-bts-litecell15/main.c
parenta8041edb5be3ae82bef97106b783ea4ec15e2a21 (diff)
lc15: rewrite and refactor code to print hwversion description
Also print a newline at the end of print_hwversion(). In the process of rewrite, fix several warnings in the few lines of this functions: osmo-bts/src/osmo-bts-litecell15/main.c: In function ‘print_hwversion’: osmo-bts/src/osmo-bts-litecell15/main.c:162:12: warning: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Wrestrict] snprintf(model_name, sizeof(model_name), "%s Rev %c", ^~~~~~~~~~ model_name, (char)rev); ~~~~~~~~~~ osmo-bts/src/osmo-bts-litecell15/main.c:168:12: warning: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Wrestrict] snprintf(model_name, sizeof(model_name), "%s (%05X)", ^~~~~~~~~~ model_name, model); ~~~~~~~~~~ osmo-bts/src/osmo-bts-litecell15/main.c:162:47: warning: ‘ Rev ’ directive output may be truncated writing 5 bytes into a region of size between 1 and 64 [-Wformat-truncation=] snprintf(model_name, sizeof(model_name), "%s Rev %c", ^~~~~ osmo-bts/src/osmo-bts-litecell15/main.c:162:3: note: ‘snprintf’ output between 7 and 70 bytes into a destination of size 64 snprintf(model_name, sizeof(model_name), "%s Rev %c", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ model_name, (char)rev); ~~~~~~~~~~~~~~~~~~~~~~ osmo-bts/src/osmo-bts-litecell15/main.c:168:47: warning: ‘ (’ directive output may be truncated writing 2 bytes into a region of size between 1 and 64 [-Wformat-truncation=] snprintf(model_name, sizeof(model_name), "%s (%05X)", ^~ osmo-bts/src/osmo-bts-litecell15/main.c:168:44: note: using the range [0, 4294967295] for directive argument snprintf(model_name, sizeof(model_name), "%s (%05X)", ^~~~~~~~~~~ osmo-bts/src/osmo-bts-litecell15/main.c:168:3: note: ‘snprintf’ output between 9 and 75 bytes into a destination of size 64 snprintf(model_name, sizeof(model_name), "%s (%05X)", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ model_name, model); ~~~~~~~~~~~~~~~~~~ Change-Id: I079b056a04fe77d2f7f361ff5899232cb70b5a93
Diffstat (limited to 'src/osmo-bts-litecell15/main.c')
-rw-r--r--src/osmo-bts-litecell15/main.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/osmo-bts-litecell15/main.c b/src/osmo-bts-litecell15/main.c
index 030c3efd..de175e34 100644
--- a/src/osmo-bts-litecell15/main.c
+++ b/src/osmo-bts-litecell15/main.c
@@ -151,25 +151,8 @@ void bts_model_print_help()
static void print_hwversion()
{
- int rev;
- int model;
- static char model_name[64] = {0, };
-
- snprintf(model_name, sizeof(model_name), "NuRAN Litecell 1.5 BTS");
-
- rev = lc15bts_rev_get();
- if (rev >= 0) {
- snprintf(model_name, sizeof(model_name), "%s Rev %c",
- model_name, (char)rev);
- }
-
- model = lc15bts_model_get();
- if (model >= 0) {
- snprintf(model_name, sizeof(model_name), "%s (%05X)",
- model_name, model);
- }
-
- printf(model_name);
+ printf(get_hwversion_desc());
+ printf("\n");
}
int bts_model_handle_options(int argc, char **argv)