monitor: add trace option to debug server-client protocol
[platform/core/uifw/libtdm.git] / src / tdm_monitor_server.c
index d12a9eb..2df4dd3 100644 (file)
@@ -54,6 +54,23 @@ _tdm_monitor_server_query(unsigned int pid, char *cwd, int argc, char *argv[], c
 }
 
 static void
+_tdm_monitor_server_protocol_trace(unsigned int pid, char *cwd, int argc, char *argv[], char *reply, int *len, tdm_display *dpy)
+{
+       int enable;
+
+       if (argc < 3) {
+               _tdm_monitor_server_usage(argv[0], reply, len);
+               return;
+       }
+
+       enable = atoi(argv[2]);
+
+       tdm_event_loop_trace_enable(dpy, enable);
+
+       TDM_SNPRINTF(reply, len, "protocol trace: '%s'\n", (enable) ? "enabled" : "disabled");
+}
+
+static void
 _tdm_monitor_server_dpms(unsigned int pid, char *cwd, int argc, char *argv[], char *reply, int *len, tdm_display *dpy)
 {
        tdm_output *output;
@@ -463,6 +480,12 @@ static struct {
                "show tdm output, layer information", NULL, NULL
        },
        {
+               "trace", _tdm_monitor_server_protocol_trace,
+               "enable/disable the wl protocol",
+               "<enable>",
+               "0 or 1"
+       },
+       {
                "dpms", _tdm_monitor_server_dpms,
                "set output dpms", "<output_idx>:<dpms>", "0:3 or 0:0"
        },