Change in osmo-trx[master]: Add CTRL 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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Dec 4 15:38:47 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/12120


Change subject: Add CTRL log category
......................................................................

Add CTRL 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/20/12120/1

diff --git a/CommonLibs/debug.c b/CommonLibs/debug.c
index c6de21a..dc5ecaa 100644
--- a/CommonLibs/debug.c
+++ b/CommonLibs/debug.c
@@ -10,6 +10,12 @@
 		.color = NULL,
 		.enabled = 1, .loglevel = LOGL_NOTICE,
 	},
+	[DCTRL] = {
+			.name = "DCTRL",
+			.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..a6fea6b 100644
--- a/CommonLibs/debug.h
+++ b/CommonLibs/debug.h
@@ -5,6 +5,7 @@
 /* Debug Areas of the code */
 enum {
 	DMAIN,
+	DCTRL,
 	DDEV,
 	DLMS,
 };
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 8702fb6..6dae66f 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(DCTRL, WARNING) << "bogus message on control interface";
     return;
   }
 
   /* Set command pointer */
   command = buffer + 4;
-  LOG(INFO) << "chan " << chan << ": command is " << command;
+  LOGC(DCTRL, 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(DCTRL, 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(DCTRL, 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(DCTRL, 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(DCTRL, 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(DCTRL, 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: newchange
Gerrit-Change-Id: I98ec5e416272783ad3fbadf70478a4e48ae64983
Gerrit-Change-Number: 12120
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181204/03f04c32/attachment.htm>


More information about the gerrit-log mailing list