summaryrefslogtreecommitdiff
path: root/mesh/util.c
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2020-05-30 21:41:24 -0700
committerBrian Gix <brian.gix@intel.com>2020-06-01 10:23:10 -0700
commitc0509b127a1a37ceb7a01e73e124766766e9684f (patch)
tree3da1f9ba4bc8530907c90698a4f1dcb7c0b273ad /mesh/util.c
parent2a0ae8294b52864db38dee9b94c2c3368a4f79c8 (diff)
downloadbluez-c0509b127a1a37ceb7a01e73e124766766e9684f.tar.gz
mesh: Helper packet print should depend on debug setting
This changes the utility function print_packet() to check if daemon is running in debug mode.
Diffstat (limited to 'mesh/util.c')
-rw-r--r--mesh/util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mesh/util.c b/mesh/util.c
index 43340f159..7d283331a 100644
--- a/mesh/util.c
+++ b/mesh/util.c
@@ -34,10 +34,15 @@
#include "mesh/util.h"
+static bool debug_enabled;
+
void print_packet(const char *label, const void *data, uint16_t size)
{
struct timeval pkt_time;
+ if (!debug_enabled)
+ return;
+
gettimeofday(&pkt_time, NULL);
if (size > 0) {
@@ -154,3 +159,9 @@ void del_path(const char *path)
{
nftw(path, del_fobject, 5, FTW_DEPTH | FTW_PHYS);
}
+
+void enable_debug(void)
+{
+ debug_enabled = true;
+ l_debug_enable("*");
+}