aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-06-28 15:14:05 +0200
committerHarald Welte <laforge@osmocom.org>2020-06-29 17:19:14 +0200
commit946eaba82b350ee771010016fef7ca1b986e71ae (patch)
tree6df566dc6e84b6badefb336f14f007fbaca1f1a4
parent7f0847070694459e88607b41eed54ec10a96424c (diff)
move from printf() debug output to libosmocore logging
-rw-r--r--src/intf_line.c19
-rw-r--r--src/log.c5
-rw-r--r--src/log.h1
-rw-r--r--src/usb.c2
4 files changed, 19 insertions, 8 deletions
diff --git a/src/intf_line.c b/src/intf_line.c
index 22d5f55..bc01559 100644
--- a/src/intf_line.c
+++ b/src/intf_line.c
@@ -107,10 +107,12 @@ _e1_rx_hdlcfs(struct e1_ts *ts, uint8_t *buf, int len)
);
if (rv > 0) {
- printf("RX Message: %d %d [ %s]\n", ts->id, rv, osmo_hexdump(ts->rx_buf, rv));
+ LOGP(DXFR, LOGL_DEBUG, "RX Message: %d %d [ %s]\n",
+ ts->id, rv, osmo_hexdump(ts->rx_buf, rv));
write(ts->fd, ts->rx_buf, rv);
} else if (rv < 0 && ts->id == 4) {
- printf("ERR RX: %d %d %d [ %s]\n",rv,oi,cl, osmo_hexdump(buf, len));
+ LOGP(DXFR, LOGL_ERROR, "ERR RX: %d %d %d [ %s]\n",
+ rv,oi,cl, osmo_hexdump(buf, len));
}
oi += cl;
@@ -131,7 +133,8 @@ _e1_tx_hdlcfs(struct e1_ts *ts, uint8_t *buf, int len)
if (!ts->tx_len) {
rv = read(ts->fd, ts->tx_buf, sizeof(ts->tx_buf));
if (rv > 0) {
- printf("TX Message: %d %d [ %s]\n", ts->id, rv, osmo_hexdump(ts->tx_buf, rv));
+ LOGP(DXFR, LOGL_DEBUG, "TX Message: %d %d [ %s]\n",
+ ts->id, rv, osmo_hexdump(ts->tx_buf, rv));
ts->tx_len = rv;
ts->tx_ofs = 0;
}
@@ -144,10 +147,12 @@ _e1_tx_hdlcfs(struct e1_ts *ts, uint8_t *buf, int len)
);
if (rv < 0)
- printf("ERR TX: %d\n", rv);
+ LOGP(DXFR, LOGL_ERROR, "ERR TX: %d\n", rv);
- if (ts->tx_ofs < ts->tx_len)
- printf("TX chunk %d/%d %d [ %s]\n", ts->tx_ofs, ts->tx_len, cl, osmo_hexdump(&buf[ts->tx_ofs], rv));
+ if (ts->tx_ofs < ts->tx_len) {
+ LOGP(DXFR, LOGL_DEBUG, "TX chunk %d/%d %d [ %s]\n",
+ ts->tx_ofs, ts->tx_len, cl, osmo_hexdump(&buf[ts->tx_ofs], rv));
+ }
if (rv > 0)
oo += rv;
@@ -218,7 +223,7 @@ e1_line_demux_in(struct e1_line *line, const uint8_t *buf, int size)
int ftr;
if (size <= 0) {
- printf("IN ERROR: %d\n", size);
+ LOGP(DXFR, LOGL_ERROR, "IN ERROR: %d\n", size);
return -1;
}
diff --git a/src/log.c b/src/log.c
index 805d355..c50efe5 100644
--- a/src/log.c
+++ b/src/log.c
@@ -33,6 +33,11 @@ static const struct log_info_cat default_categories[] = {
.loglevel = LOGL_DEBUG,
.enabled = 1,
},
+ [DXFR] = {
+ .name = "DXFR",
+ .loglevel = LOGL_DEBUG,
+ .enabled = 1,
+ },
};
const struct log_info log_info = {
diff --git a/src/log.h b/src/log.h
index b3bed47..2a9b210 100644
--- a/src/log.h
+++ b/src/log.h
@@ -28,6 +28,7 @@
enum {
DE1D,
+ DXFR,
};
extern const struct log_info log_info;
diff --git a/src/usb.c b/src/usb.c
index ecbb54d..8cf96b4 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -118,7 +118,7 @@ e1_usb_xfer_out(struct e1_usb_flow *flow, uint8_t *buf, int size)
int fts;
if (size <= 0) {
- printf("OUT ERROR: %d\n", size);
+ LOGP(DXFR, LOGL_ERROR, "OUT ERROR: %d\n", size);
return -1;
}