Change in osmo-trx[master]: Add TRXCTRL log category

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Dec 8 19:36:34 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/12120 )

Change subject: Add TRXCTRL log category
......................................................................

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
---
M CommonLibs/debug.c
M CommonLibs/debug.h
M Transceiver52M/Transceiver.cpp
3 files changed, 14 insertions(+), 7 deletions(-)

Approvals:
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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 @@
 		.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 @@
 /* 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 @@
 
   /* 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 @@
     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 @@
     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 @@
     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 @@
     int  timeslot;
     sscanf(params, "%d %d", &timeslot, &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 @@
     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");
   }
 

-- 
To view, visit https://gerrit.osmocom.org/12120
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I98ec5e416272783ad3fbadf70478a4e48ae64983
Gerrit-Change-Number: 12120
Gerrit-PatchSet: 5
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-CC: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181208/3634cbff/attachment.htm>


More information about the gerrit-log mailing list