qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hmp: info spice: Show string channel name
@ 2015-02-26 19:02 Cole Robinson
  2015-02-26 20:48 ` Eric Blake
  0 siblings, 1 reply; 4+ messages in thread
From: Cole Robinson @ 2015-02-26 19:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: Cole Robinson, Gerd Hoffmann, Markus Armbruster, Luiz Capitulino

Useful for debugging.

https://bugzilla.redhat.com/show_bug.cgi?id=822418
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
 hmp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hmp.c b/hmp.c
index 735097c..93fd5cd 100644
--- a/hmp.c
+++ b/hmp.c
@@ -545,6 +545,11 @@ void hmp_info_spice(Monitor *mon, const QDict *qdict)
 {
     SpiceChannelList *chan;
     SpiceInfo *info;
+    const char *channel_name;
+    /* String representations of SPICE_CHANNEL_* enum */
+    const char * const channel_names[] = {"main", "display", "input", "cursor",
+        "playback", "record", "tunnel", "smartcard", "usbredir", "port",
+        "webdav"};
 
     info = qmp_query_spice(NULL);
 
@@ -581,6 +586,14 @@ void hmp_info_spice(Monitor *mon, const QDict *qdict)
                            chan->value->connection_id);
             monitor_printf(mon, "     channel: %" PRId64 ":%" PRId64 "\n",
                            chan->value->channel_type, chan->value->channel_id);
+
+            channel_name = "unknown";
+            if (chan->value->channel_type > 0 &&
+                chan->value->channel_type <= sizeof(channel_names)) {
+                channel_name = channel_names[chan->value->channel_type - 1];
+            }
+
+            monitor_printf(mon, "     channel name: %s\n", channel_name);
         }
     }
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-27 14:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-26 19:02 [Qemu-devel] [PATCH] hmp: info spice: Show string channel name Cole Robinson
2015-02-26 20:48 ` Eric Blake
2015-02-27  7:35   ` Gerd Hoffmann
2015-02-27 14:56     ` Cole Robinson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).