diff mbox series

[v2,09/14] qmiqrtr: Enable io debugging only if OFONO_QMI_IO_DEBUG is set

Message ID 20240625164158.1170937-9-denkenz@gmail.com (mailing list archive)
State Accepted
Commit 37662676bce0ca2cf968abd1b44802245dcf6eb1
Headers show
Series [v2,01/14] qmi: Introduce SERVICE_VERSION macro | expand

Commit Message

Denis Kenzior June 25, 2024, 4:41 p.m. UTC
QRTR/QMI protocol details are now mostly stable to the point that
hexdumping what is being sent / received over the wire is just noise.
qmi_qrtr_node now supports setting separate debug handlers for the
underlying object and the low-level IO.  If OFONO_QMI_DEBUG environment
variable is set, enable debugging for core QRTR/QMI implementation but
disable low-level IO debugging.  If IO debugging is desired, use the
OFONO_QMI_IO_DEBUG environment variable.
---
 plugins/qrtrqmi.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/plugins/qrtrqmi.c b/plugins/qrtrqmi.c
index 4117cac11423..b64ab355a2e8 100644
--- a/plugins/qrtrqmi.c
+++ b/plugins/qrtrqmi.c
@@ -52,13 +52,20 @@  struct qrtrqmi_data {
 	bool have_voice : 1;
 };
 
-static void qrtrqmi_debug(const char *str, void *user_data)
+static void qrtrqmi_io_debug(const char *str, void *user_data)
 {
 	const char *prefix = user_data;
 
 	ofono_info("%s%s", prefix, str);
 }
 
+static void qrtrqmi_debug(const char *str, void *user_data)
+{
+	const char *prefix = user_data;
+
+	ofono_debug("%s%s", prefix, str);
+}
+
 /*
  * Probe the modem.  The following modem properties are expected to be set
  * in order to initialize the driver properly:
@@ -213,7 +220,11 @@  static int qrtrqmi_enable(struct ofono_modem *modem)
 		return -EIO;
 
 	if (getenv("OFONO_QMI_DEBUG"))
-		qmi_qrtr_node_set_debug(data->node, qrtrqmi_debug, "QRTR: ");
+		qmi_qrtr_node_set_debug(data->node, qrtrqmi_debug, "");
+
+	if (getenv("OFONO_QMI_IO_DEBUG"))
+		qmi_qrtr_node_set_io_debug(data->node,
+						qrtrqmi_io_debug, "QRTR: ");
 
 	r = qmi_qrtr_node_lookup(data->node, lookup_done, modem, NULL);
 	if (!r)