[layer23] Cleanup of various 'printf' debugging
authorAndreas.Eversberg <jolly@eversberg.eu>
Sun, 26 Sep 2010 22:02:32 +0000 (22:02 +0000)
committerAndreas.Eversberg <jolly@eversberg.eu>
Sun, 26 Sep 2010 22:02:32 +0000 (22:02 +0000)
src/host/layer23/src/common/l1ctl.c
src/host/layer23/src/common/lapdm.c
src/host/layer23/src/mobile/gsm322.c
src/host/layer23/src/mobile/gsm48_rr.c

index 6664363..21ee996 100644 (file)
@@ -87,8 +87,8 @@ static int rx_l1_fbsb_conf(struct osmocom_ms *ms, struct msgb *msg)
        dl = (struct l1ctl_info_dl *) msg->l1h;
        sb = (struct l1ctl_fbsb_conf *) dl->payload;
 
-       printf("snr=%04x, arfcn=%u result=%u\n", dl->snr, ntohs(dl->band_arfcn),
-               sb->result);
+       LOGP(DL1C, LOGL_INFO, "snr=%04x, arfcn=%u result=%u\n", dl->snr,
+               ntohs(dl->band_arfcn), sb->result);
 
        if (sb->result != 0) {
                LOGP(DL1C, LOGL_ERROR, "FBSB RESP: result=%u\n", sb->result);
@@ -260,7 +260,7 @@ int l1ctl_tx_fbsb_req(struct osmocom_ms *ms, uint16_t arfcn,
        struct msgb *msg;
        struct l1ctl_fbsb_req *req;
 
-       printf("Sync Req\n");
+       LOGP(DL1C, LOGL_INFO, "Sync Req\n");
 
        msg = osmo_l1_alloc(L1CTL_FBSB_REQ);
        if (!msg)
@@ -290,7 +290,7 @@ int l1ctl_tx_ccch_mode_req(struct osmocom_ms *ms, uint8_t ccch_mode)
        struct msgb *msg;
        struct l1ctl_ccch_mode_req *req;
 
-       printf("CCCH Mode Req\n");
+       LOGP(DL1C, LOGL_INFO, "CCCH Mode Req\n");
 
        msg = osmo_l1_alloc(L1CTL_CCCH_MODE_REQ);
        if (!msg)
@@ -308,7 +308,7 @@ int l1ctl_tx_tch_mode_req(struct osmocom_ms *ms, uint8_t tch_mode)
        struct msgb *msg;
        struct l1ctl_tch_mode_req *req;
 
-       printf("TCH Mode Req\n");
+       LOGP(DL1C, LOGL_INFO, "TCH Mode Req\n");
 
        msg = osmo_l1_alloc(L1CTL_TCH_MODE_REQ);
        if (!msg)
@@ -396,8 +396,8 @@ int l1ctl_tx_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
        if (!msg)
                return -1;
 
-       printf("Tx Dedic.Mode Est Req (arfcn=%u, chan_nr=0x%02x)\n",
-               band_arfcn, chan_nr);
+       LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Est Req (arfcn=%u, "
+               "chan_nr=0x%02x)\n", band_arfcn, chan_nr);
 
        memset(&ms->meas, 0, sizeof(ms->meas));
 
@@ -426,7 +426,7 @@ int l1ctl_tx_dm_est_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn,
        if (!msg)
                return -1;
 
-       printf("Tx Dedic.Mode Est Req (maio=%u, hsn=%u, "
+       LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Est Req (maio=%u, hsn=%u, "
                "chan_nr=0x%02x)\n", maio, hsn, chan_nr);
 
        memset(&ms->meas, 0, sizeof(ms->meas));
@@ -459,7 +459,7 @@ int l1ctl_tx_dm_freq_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
        if (!msg)
                return -1;
 
-       printf("Tx Dedic.Mode Freq Req (arfcn=%u, fn=%d)\n",
+       LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Freq Req (arfcn=%u, fn=%d)\n",
                band_arfcn, fn);
 
        ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
@@ -488,7 +488,7 @@ int l1ctl_tx_dm_freq_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn,
        if (!msg)
                return -1;
 
-       printf("Tx Dedic.Mode Freq Req (maio=%u, hsn=%u, "
+       LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Freq Req (maio=%u, hsn=%u, "
                "fn=%d)\n", maio, hsn, fn);
 
        ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
@@ -518,7 +518,7 @@ int l1ctl_tx_dm_rel_req(struct osmocom_ms *ms)
        if (!msg)
                return -1;
 
-       printf("Tx Dedic.Mode Rel Req\n");
+       LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Rel Req\n");
 
        memset(&ms->meas, 0, sizeof(ms->meas));
 
@@ -565,7 +565,7 @@ static int rx_l1_sim_conf(struct osmocom_ms *ms, struct msgb *msg)
        uint16_t len = msg->len - sizeof(struct l1ctl_hdr);
        uint8_t *data = msg->data + sizeof(struct l1ctl_hdr);
        
-       printf("SIM %s\n", hexdump(data, len));
+       LOGP(DL1C, LOGL_INFO, "SIM %s\n", hexdump(data, len));
        
        /* pull the L1 header from the msgb */
        msgb_pull(msg, sizeof(struct l1ctl_hdr));
@@ -587,7 +587,7 @@ int l1ctl_tx_pm_req_range(struct osmocom_ms *ms, uint16_t arfcn_from,
        if (!msg)
                return -1;
 
-       printf("Tx PM Req (%u-%u)\n", arfcn_from, arfcn_to);
+       LOGP(DL1C, LOGL_INFO, "Tx PM Req (%u-%u)\n", arfcn_from, arfcn_to);
        pm = (struct l1ctl_pm_req *) msgb_put(msg, sizeof(*pm));
        pm->type = 1;
        pm->range.band_arfcn_from = htons(arfcn_from);
@@ -606,7 +606,7 @@ int l1ctl_tx_reset_req(struct osmocom_ms *ms, uint8_t type)
        if (!msg)
                return -1;
 
-       printf("Tx Reset Req (%u)\n", type);
+       LOGP(DL1C, LOGL_INFO, "Tx Reset Req (%u)\n", type);
        res = (struct l1ctl_reset *) msgb_put(msg, sizeof(*res));
        res->type = type;
 
@@ -616,7 +616,7 @@ int l1ctl_tx_reset_req(struct osmocom_ms *ms, uint8_t type)
 /* Receive L1CTL_RESET_IND */
 static int rx_l1_reset(struct osmocom_ms *ms)
 {
-       printf("Layer1 Reset indication\n");
+       LOGP(DL1C, LOGL_INFO, "Layer1 Reset indication\n");
        dispatch_signal(SS_L1CTL, S_L1CTL_RESET, ms);
 
        return 0;
@@ -647,14 +647,14 @@ static int rx_l1_ccch_mode_conf(struct osmocom_ms *ms, struct msgb *msg)
        struct l1ctl_ccch_mode_conf *conf;
 
        if (msgb_l3len(msg) < sizeof(*conf)) {
-               LOGP(DL1C, LOGL_ERROR, "MODE CONF: MSG too short %u\n",
+               LOGP(DL1C, LOGL_ERROR, "CCCH MODE CONF: MSG too short %u\n",
                        msgb_l3len(msg));
                return -1;
        }
 
        conf = (struct l1ctl_ccch_mode_conf *) msg->l1h;
 
-       printf("mode=%u\n", conf->ccch_mode);
+       LOGP(DL1C, LOGL_INFO, "CCCH MODE CONF: mode=%u\n", conf->ccch_mode);
 
        mc.ccch_mode = conf->ccch_mode;
        mc.ms = ms;
@@ -670,14 +670,14 @@ static int rx_l1_tch_mode_conf(struct osmocom_ms *ms, struct msgb *msg)
        struct l1ctl_tch_mode_conf *conf;
 
        if (msgb_l3len(msg) < sizeof(*conf)) {
-               LOGP(DL1C, LOGL_ERROR, "MODE CONF: MSG too short %u\n",
+               LOGP(DL1C, LOGL_ERROR, "TCH MODE CONF: MSG too short %u\n",
                        msgb_l3len(msg));
                return -1;
        }
 
        conf = (struct l1ctl_tch_mode_conf *) msg->l1h;
 
-       printf("mode=%u\n", conf->tch_mode);
+       LOGP(DL1C, LOGL_INFO, "TCH MODE CONF: mode=%u\n", conf->tch_mode);
 
        mc.tch_mode = conf->tch_mode;
        mc.ms = ms;
@@ -743,7 +743,7 @@ int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg)
                rc = rx_l1_sim_conf(ms, msg);
                break;
        default:
-               fprintf(stderr, "Unknown MSG: %u\n", l1h->msg_type);
+               LOGP(DL1C, LOGL_ERROR, "Unknown MSG: %u\n", l1h->msg_type);
                msgb_free(msg);
                break;
        }
index 3ee157d..b199c62 100644 (file)
@@ -1788,7 +1788,10 @@ static int rslms_send_i(struct lapdm_msg_ctx *mctx)
                length = left;
                if (length > mctx->n201 - 3)
                        length = mctx->n201 - 3;
-printf("msg-len %d sent %d left %d N201 %d length %d first byte %02x\n", msgb_l3len(dl->send_buffer), dl->send_out, left, mctx->n201, length, dl->send_buffer->l3h[0]);
+               LOGP(DLAPDM, LOGL_INFO, "msg-len %d sent %d left %d N201 %d "
+                       "length %d first byte %02x\n",
+                       msgb_l3len(dl->send_buffer), dl->send_out, left,
+                       mctx->n201, length, dl->send_buffer->l3h[0]);
                /* If message in send-buffer is completely sent */
                if (left == 0) {
                        msgb_free(dl->send_buffer);
index 3b707f5..cdb8d1a 100644 (file)
@@ -249,7 +249,6 @@ static int gsm322_sync_to_cell(struct gsm322_cellsel *cs)
                LOGP(DCS, LOGL_INFO, "No sysinfo, ccch mode NONE\n");
                cs->ccch_mode = CCCH_MODE_NONE;
        }
-//     printf("s->ccch_conf %d\n", cs->si->ccch_conf);
 
        l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL);
        return l1ctl_tx_fbsb_req(ms, cs->arfcn,
index bc30d06..e1d37c0 100644 (file)
@@ -522,8 +522,8 @@ static int gsm48_send_rsl(struct osmocom_ms *ms, uint8_t msg_type,
        struct gsm48_rrlayer *rr = &ms->rrlayer;
 
        if (!msg->l3h) {
-               printf("FIX l3h\n");
-               exit (0);
+               LOGP(DRR, LOGL_ERROR, "FIX l3h\n");
+               return -EINVAL;
        }
        rsl_rll_push_l3(msg, msg_type, rr->cd_now.chan_nr,
                rr->cd_now.link_id, 1);
@@ -1895,7 +1895,6 @@ static int gsm48_rr_rx_sysinfo2(struct osmocom_ms *ms, struct msgb *msg)
                        "message.\n");
                return -EINVAL;
        }
-//printf("len = %d\n", MIN(msgb_l3len(msg), sizeof(s->si2_msg)));
 
        if (!memcmp(si, s->si2_msg, MIN(msgb_l3len(msg), sizeof(s->si2_msg))))
                return 0;
@@ -3153,7 +3152,8 @@ static int gsm48_rr_activate_channel(struct osmocom_ms *ms,
        /* establish */
        LOGP(DRR, LOGL_INFO, "establishing channel in dedicated mode\n");
        rsl_dec_chan_nr(cd->chan_nr, &ch_type, &ch_subch, &ch_ts);
-       printf("Channel type %d, subch %d, ts %d\n", ch_type, ch_subch, ch_ts);
+       LOGP(DRR, LOGL_INFO, " Channel type %d, subch %d, ts %d, mode %d\n",
+               cd->mode, ch_type, ch_subch, ch_ts);
        if (cd->h)
                l1ctl_tx_dm_est_req_h1(ms, cd->maio, cd->hsn,
                        ma, ma_len, cd->chan_nr, cd->tsc);