aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mm-at-serial-port.c8
-rw-r--r--src/mm-modem.c21
-rw-r--r--src/mm-port.c11
-rw-r--r--src/mm-qcdm-serial-port.c8
4 files changed, 42 insertions, 6 deletions
diff --git a/src/mm-at-serial-port.c b/src/mm-at-serial-port.c
index 1a518f59..068450d2 100644
--- a/src/mm-at-serial-port.c
+++ b/src/mm-at-serial-port.c
@@ -273,6 +273,7 @@ debug_log (MMSerialPort *port, const char *prefix, const char *buf, gsize len)
{
static GString *debug = NULL;
const char *s;
+ GTimeVal tv;
if (!debug)
debug = g_string_sized_new (256);
@@ -295,7 +296,12 @@ debug_log (MMSerialPort *port, const char *prefix, const char *buf, gsize len)
}
g_string_append_c (debug, '\'');
- g_debug ("(%s): %s", mm_port_get_device (MM_PORT (port)), debug->str);
+ g_get_current_time (&tv);
+ g_debug ("<%ld.%ld> (%s): %s",
+ tv.tv_sec,
+ tv.tv_usec,
+ mm_port_get_device (MM_PORT (port)),
+ debug->str);
g_string_truncate (debug, 0);
}
diff --git a/src/mm-modem.c b/src/mm-modem.c
index 5bc970c6..57e715d3 100644
--- a/src/mm-modem.c
+++ b/src/mm-modem.c
@@ -18,6 +18,7 @@
#include <string.h>
#include <dbus/dbus-glib.h>
#include "mm-modem.h"
+#include "mm-options.h"
#include "mm-errors.h"
#include "mm-callback-info.h"
#include "mm-marshal.h"
@@ -643,10 +644,22 @@ mm_modem_set_state (MMModem *self,
dbus_path = (const char *) g_object_get_data (G_OBJECT (self), DBUS_PATH_TAG);
if (dbus_path) {
- g_message ("Modem %s: state changed (%s -> %s)",
- dbus_path,
- state_to_string (old_state),
- state_to_string (new_state));
+ if (mm_options_debug ()) {
+ GTimeVal tv;
+
+ g_get_current_time (&tv);
+ g_debug ("<%ld.%ld> Modem %s: state changed (%s -> %s)",
+ tv.tv_sec,
+ tv.tv_usec,
+ dbus_path,
+ state_to_string (old_state),
+ state_to_string (new_state));
+ } else {
+ g_message ("Modem %s: state changed (%s -> %s)",
+ dbus_path,
+ state_to_string (old_state),
+ state_to_string (new_state));
+ }
}
}
}
diff --git a/src/mm-port.c b/src/mm-port.c
index 7e8edc4f..afaab98b 100644
--- a/src/mm-port.c
+++ b/src/mm-port.c
@@ -19,6 +19,7 @@
#include <string.h>
#include "mm-port.h"
+#include "mm-options.h"
G_DEFINE_TYPE (MMPort, mm_port, G_TYPE_OBJECT)
@@ -140,6 +141,16 @@ mm_port_set_connected (MMPort *self, gboolean connected)
if (priv->connected != connected) {
priv->connected = connected;
g_object_notify (G_OBJECT (self), MM_PORT_CONNECTED);
+ if (mm_options_debug()) {
+ GTimeVal tv;
+
+ g_get_current_time (&tv);
+ g_debug ("<%ld.%ld> (%s): port now %s",
+ tv.tv_sec,
+ tv.tv_usec,
+ priv->device,
+ connected ? "connected" : "disconnected");
+ }
}
}
diff --git a/src/mm-qcdm-serial-port.c b/src/mm-qcdm-serial-port.c
index 93fc98f5..3937c948 100644
--- a/src/mm-qcdm-serial-port.c
+++ b/src/mm-qcdm-serial-port.c
@@ -157,6 +157,7 @@ debug_log (MMSerialPort *port, const char *prefix, const char *buf, gsize len)
{
static GString *debug = NULL;
const char *s = buf;
+ GTimeVal tv;
if (!debug)
debug = g_string_sized_new (512);
@@ -166,7 +167,12 @@ debug_log (MMSerialPort *port, const char *prefix, const char *buf, gsize len)
while (len--)
g_string_append_printf (debug, " %02x", (guint8) (*s++ & 0xFF));
- g_debug ("(%s): %s", mm_port_get_device (MM_PORT (port)), debug->str);
+ g_get_current_time (&tv);
+ g_debug ("<%ld.%ld> (%s): %s",
+ tv.tv_sec,
+ tv.tv_usec,
+ mm_port_get_device (MM_PORT (port)),
+ debug->str);
g_string_truncate (debug, 0);
}