diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-12-04 16:37:24 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-12-07 11:15:02 +0100 |
commit | 441d82add9afbc75dc3e9fe45a80ce3ff8f8b15e (patch) | |
tree | 6f8834a171d3298e56914442352625c7d5ebb1eb | |
parent | contrib: fix makedistcheck with disabled systemd (diff) | |
download | OsmoTRX-441d82add9afbc75dc3e9fe45a80ce3ff8f8b15e.tar.xz OsmoTRX-441d82add9afbc75dc3e9fe45a80ce3ff8f8b15e.zip |
Add TRXCTRL log category
This log category is applied to messages related to TRX CTRL socket
interface, and it's printed in yellow, same color used in osmo-bts-trx
for TRX category (so same messages are printed with same color in both
sides).
Change-Id: I98ec5e416272783ad3fbadf70478a4e48ae64983
-rw-r--r-- | CommonLibs/debug.c | 6 | ||||
-rw-r--r-- | CommonLibs/debug.h | 1 | ||||
-rw-r--r-- | Transceiver52M/Transceiver.cpp | 14 |
3 files changed, 14 insertions, 7 deletions
diff --git a/CommonLibs/debug.c b/CommonLibs/debug.c index c6de21a..294924d 100644 --- a/CommonLibs/debug.c +++ b/CommonLibs/debug.c @@ -10,6 +10,12 @@ static const struct log_info_cat default_categories[] = { .color = NULL, .enabled = 1, .loglevel = LOGL_NOTICE, }, + [DTRXCTRL] = { + .name = "DTRXCTRL", + .description = "TRX CTRL interface", + .color = "\033[1;33m", + .enabled = 1, .loglevel = LOGL_NOTICE, + }, [DDEV] = { .name = "DDEV", .description = "Device/Driver specific code", diff --git a/CommonLibs/debug.h b/CommonLibs/debug.h index f8f6239..a5b9271 100644 --- a/CommonLibs/debug.h +++ b/CommonLibs/debug.h @@ -5,6 +5,7 @@ extern const struct log_info log_info; /* Debug Areas of the code */ enum { DMAIN, + DTRXCTRL, DDEV, DLMS, }; diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 8702fb6..8b950f7 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -715,13 +715,13 @@ void Transceiver::driveControl(size_t chan) /* Verify a command signature */ if (strncmp(buffer, "CMD ", 4)) { - LOG(WARNING) << "bogus message on control interface"; + LOGC(DTRXCTRL, WARNING) << "bogus message on control interface"; return; } /* Set command pointer */ command = buffer + 4; - LOG(INFO) << "chan " << chan << ": command is " << command; + LOGC(DTRXCTRL, INFO) << "chan " << chan << ": command is " << command; if (match_cmd(command, "POWEROFF", NULL)) { stop(); @@ -800,7 +800,7 @@ void Transceiver::driveControl(size_t chan) sscanf(params, "%d", &freqKhz); mRxFreq = freqKhz * 1e3; if (!mRadioInterface->tuneRx(mRxFreq, chan)) { - LOG(ALERT) << "RX failed to tune"; + LOGC(DTRXCTRL, ALERT) << "RX failed to tune"; sprintf(response,"RSP RXTUNE 1 %d",freqKhz); } else @@ -811,7 +811,7 @@ void Transceiver::driveControl(size_t chan) sscanf(params, "%d", &freqKhz); mTxFreq = freqKhz * 1e3; if (!mRadioInterface->tuneTx(mTxFreq, chan)) { - LOG(ALERT) << "TX failed to tune"; + LOGC(DTRXCTRL, ALERT) << "TX failed to tune"; sprintf(response,"RSP TXTUNE 1 %d",freqKhz); } else @@ -823,7 +823,7 @@ void Transceiver::driveControl(size_t chan) if (TSC > 7) { sprintf(response, "RSP SETTSC 1 %d", TSC); } else { - LOG(NOTICE) << "Changing TSC from " << mTSC << " to " << TSC; + LOGC(DTRXCTRL, NOTICE) << "Changing TSC from " << mTSC << " to " << TSC; mTSC = TSC; sprintf(response,"RSP SETTSC 0 %d", TSC); } @@ -833,7 +833,7 @@ void Transceiver::driveControl(size_t chan) int timeslot; sscanf(params, "%d %d", ×lot, &corrCode); if ((timeslot < 0) || (timeslot > 7)) { - LOG(WARNING) << "bogus message on control interface"; + LOGC(DTRXCTRL, WARNING) << "bogus message on control interface"; sprintf(response,"RSP SETSLOT 1 %d %d",timeslot,corrCode); return; } @@ -848,7 +848,7 @@ void Transceiver::driveControl(size_t chan) mWriteBurstToDiskMask = mask; sprintf(response,"RSP _SETBURSTTODISKMASK 0 %d",mask); } else { - LOG(WARNING) << "bogus command " << command << " on control interface."; + LOGC(DTRXCTRL, WARNING) << "bogus command " << command << " on control interface."; sprintf(response,"RSP ERR 1"); } |