diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2017-11-15 09:52:26 +0100 |
---|---|---|
committer | Holger Freyther <holger@freyther.de> | 2017-11-27 09:48:39 +0000 |
commit | 42888ed9470b8217f4abc848ca8a077e17942066 (patch) | |
tree | 7a8842b542ed52dc2f3bd5fd8626f6634026d09e /src/host/layer23/src/mobile | |
parent | 7b64e7dbe9b0d96e53bf2dec243e9af9b2e274ec (diff) |
mobile: Switch from printf to LOGP statements
Add a mobile application logging category and replace printf with
a LOGP. The code is sadly still using exit in the middle of handling.
Change-Id: I71e7f6e6375a485b45bad76ada2be17b0901577d
Diffstat (limited to 'src/host/layer23/src/mobile')
-rw-r--r-- | src/host/layer23/src/mobile/app_mobile.c | 14 | ||||
-rw-r--r-- | src/host/layer23/src/mobile/gsm322.c | 8 | ||||
-rw-r--r-- | src/host/layer23/src/mobile/main.c | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c index e3e948f3..43631f39 100644 --- a/src/host/layer23/src/mobile/app_mobile.c +++ b/src/host/layer23/src/mobile/app_mobile.c @@ -97,7 +97,7 @@ int mobile_signal_cb(unsigned int subsys, unsigned int signal, /* waiting for reset after shutdown */ if (ms->shutdown == 2) { - printf("MS '%s' has been resetted\n", ms->name); + LOGP(DMOB, LOGL_NOTICE, "MS '%s' has been resetted\n", ms->name); ms->shutdown = 3; break; } @@ -175,7 +175,7 @@ int mobile_exit(struct osmocom_ms *ms, int force) } vty_notify(ms, NULL); vty_notify(ms, "Power off!\n"); - printf("Power off! (MS %s)\n", ms->name); + LOGP(DMOB, LOGL_NOTICE, "Power off! (MS %s)\n", ms->name); return 0; } @@ -212,7 +212,7 @@ int mobile_init(struct osmocom_ms *ms) rc = layer2_open(ms, ms->settings.layer2_socket_path); if (rc < 0) { - fprintf(stderr, "Failed during layer2_open()\n"); + LOGP(DMOB, LOGL_ERROR, "Failed during layer2_open()\n"); ms->l2_wq.bfd.fd = -1; mobile_exit(ms, 1); return rc; @@ -234,14 +234,14 @@ int mobile_init(struct osmocom_ms *ms) ms->started = 0; if (!strcmp(ms->settings.imei, "000000000000000")) { - printf("***\nWarning: Mobile '%s' has default IMEI: %s\n", + LOGP(DMOB, LOGL_NOTICE, "***\nWarning: Mobile '%s' has default IMEI: %s\n", ms->name, ms->settings.imei); - printf("This could relate your identitiy to other users with " + LOGP(DMOB, LOGL_NOTICE, "This could relate your identitiy to other users with " "default IMEI.\n***\n"); } l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL); - printf("Mobile '%s' initialized, please start phone now!\n", ms->name); + LOGP(DMOB, LOGL_NOTICE, "Mobile '%s' initialized, please start phone now!\n", ms->name); return 0; } @@ -253,7 +253,7 @@ struct osmocom_ms *mobile_new(char *name) ms = talloc_zero(l23_ctx, struct osmocom_ms); if (!ms) { - fprintf(stderr, "Failed to allocate MS\n"); + LOGP(DMOB, LOGL_ERROR, "Failed to allocate MS: %s\n", name); return NULL; } diff --git a/src/host/layer23/src/mobile/gsm322.c b/src/host/layer23/src/mobile/gsm322.c index 91729d87..6de8becc 100644 --- a/src/host/layer23/src/mobile/gsm322.c +++ b/src/host/layer23/src/mobile/gsm322.c @@ -3584,7 +3584,7 @@ static int gsm322_c_choose_cell(struct osmocom_ms *ms, struct msgb *msg) gsm322_sync_to_cell(cs, NULL, 0); cs->si = cs->list[cs->arfci].sysinfo; if (!cs->si) { - printf("No SI when ret.idle, please fix!\n"); + LOGP(DCS, LOGL_FATAL, "No SI when ret.idle, please fix!\n"); exit(0L); } @@ -3670,7 +3670,7 @@ static int gsm322_c_conn_mode_1(struct osmocom_ms *ms, struct msgb *msg) gsm_print_arfcn(cs->arfcn)); cs->si = cs->list[cs->arfci].sysinfo; if (!cs->si) { - printf("No SI when leaving idle, please fix!\n"); + LOGP(DCS, LOGL_FATAL, "No SI when leaving idle, please fix!\n"); exit(0L); } cs->sync_retries = SYNC_RETRIES; @@ -3700,7 +3700,7 @@ static int gsm322_c_conn_mode_2(struct osmocom_ms *ms, struct msgb *msg) gsm_print_arfcn(cs->arfcn)); cs->si = cs->list[cs->arfci].sysinfo; if (!cs->si) { - printf("No SI when leaving idle, please fix!\n"); + LOGP(DCS, LOGL_FATAL, "No SI when leaving idle, please fix!\n"); exit(0L); } cs->sync_retries = SYNC_RETRIES; @@ -4637,7 +4637,7 @@ printf("%d time to sync again: %u\n", nb->arfcn, now + GSM58_READ_AGAIN - nb->wh cs->arfci = arfcn2index(cs->arfcn); cs->si = cs->list[cs->arfci].sysinfo; if (!cs->si) { - printf("No SI after neighbour scan, please fix!\n"); + LOGP(DNB, LOGL_FATAL, "No SI after neighbour scan, please fix!\n"); exit(0L); } LOGP(DNB, LOGL_INFO, "Syncing back to serving cell\n"); diff --git a/src/host/layer23/src/mobile/main.c b/src/host/layer23/src/mobile/main.c index 91ed3416..8921bd8b 100644 --- a/src/host/layer23/src/mobile/main.c +++ b/src/host/layer23/src/mobile/main.c @@ -70,7 +70,7 @@ int mobile_exit(struct osmocom_ms *ms, int force); const char *debug_default = - "DCS:DNB:DPLMN:DRR:DMM:DSIM:DCC:DMNCC:DSS:DLSMS:DPAG:DSUM:DSAP:DGPS"; + "DCS:DNB:DPLMN:DRR:DMM:DSIM:DCC:DMNCC:DSS:DLSMS:DPAG:DSUM:DSAP:DGPS:DMOB"; const char *openbsc_copyright = "Copyright (C) 2010-2015 Andreas Eversberg, Sylvain Munaut, Holger Freyther, Harald Welte\n" |