Received: from eggs.gnu.org ([2001:4830:134:3::10]:43617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YR3jT-0002ET-Rc for qemu-devel@nongnu.org; Thu, 26 Feb 2015 14:04:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YR3jQ-0000d1-KQ for qemu-devel@nongnu.org; Thu, 26 Feb 2015 14:04:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55879) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YR3jQ-0000cx-DJ for qemu-devel@nongnu.org; Thu, 26 Feb 2015 14:04:20 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1QJ4JJs020263 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 26 Feb 2015 14:04:19 -0500 From: Cole Robinson Date: Thu, 26 Feb 2015 14:02:25 -0500 Message-Id: Subject: [Qemu-devel] [PATCH] hmp: info spice: Show string channel name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 --- 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