From patchwork Wed Mar 10 16:51:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 47259 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EB230B7CE6 for ; Thu, 11 Mar 2010 03:56:21 +1100 (EST) Received: from localhost ([127.0.0.1]:57889 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpPCl-0000Mz-47 for incoming@patchwork.ozlabs.org; Wed, 10 Mar 2010 11:56:19 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NpP89-0004ph-E7 for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:33 -0500 Received: from [199.232.76.173] (port=58950 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpP88-0004ox-Rn for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:32 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NpP87-0001YQ-GG for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:32 -0500 Received: from e38.co.us.ibm.com ([32.97.110.159]:48691) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NpP87-0001Y4-3J for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:31 -0500 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e38.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o2AGjjhl030508 for ; Wed, 10 Mar 2010 09:45:45 -0700 Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id o2AGpM65242518 for ; Wed, 10 Mar 2010 09:51:24 -0700 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o2AGrdha004892 for ; Wed, 10 Mar 2010 09:53:39 -0700 Received: from localhost.localdomain (dyn95341159.austin.ibm.com [9.53.41.159]) by d03av06.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o2AGrbH1004788; Wed, 10 Mar 2010 09:53:39 -0700 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Wed, 10 Mar 2010 10:51:07 -0600 Message-Id: <1268239869-16058-5-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.6.5.2 In-Reply-To: <1268239869-16058-1-git-send-email-aliguori@us.ibm.com> References: <1268239869-16058-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Anthony Liguori , Gerd Hoffman , Luiz Capitulino Subject: [Qemu-devel] [PATCH 5/7] Expose whether a mouse is an absolute device via QMP and the human monitor. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org For QMP, we just add an attribute which is backwards compatible. For the human monitor, we add (absolute) to the end of the line. Signed-off-by: Anthony Liguori --- input.c | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/input.c b/input.c index cbf55b7..d2a6f26 100644 --- a/input.c +++ b/input.c @@ -195,9 +195,10 @@ static void info_mice_iter(QObject *data, void *opaque) Monitor *mon = opaque; mouse = qobject_to_qdict(data); - monitor_printf(mon, "%c Mouse #%" PRId64 ": %s\n", + monitor_printf(mon, "%c Mouse #%" PRId64 ": %s%s\n", (qdict_get_bool(mouse, "current") ? '*' : ' '), - qdict_get_int(mouse, "index"), qdict_get_str(mouse, "name")); + qdict_get_int(mouse, "index"), qdict_get_str(mouse, "name"), + qdict_get_bool(mouse, "absolute") ? " (absolute)" : ""); } void do_info_mice_print(Monitor *mon, const QObject *data) @@ -224,11 +225,12 @@ void do_info_mice_print(Monitor *mon, const QObject *data) * - "name": mouse's name * - "index": mouse's index * - "current": true if this mouse is receiving events, false otherwise + * - "absolute": true if the mouse generates absolute input events * * Example: * - * [ { "name": "QEMU Microsoft Mouse", "index": 0, "current": false }, - * { "name": "QEMU PS/2 Mouse", "index": 1, "current": true } ] + * [ { "name": "QEMU Microsoft Mouse", "index": 0, "current": false, "absolute": false }, + * { "name": "QEMU PS/2 Mouse", "index": 1, "current": true, "absolute": true } ] */ void do_info_mice(Monitor *mon, QObject **ret_data) { @@ -246,10 +248,14 @@ void do_info_mice(Monitor *mon, QObject **ret_data) QTAILQ_FOREACH(cursor, &mouse_handlers, node) { QObject *obj; - obj = qobject_from_jsonf("{ 'name': %s, 'index': %d, 'current': %i }", + obj = qobject_from_jsonf("{ 'name': %s," + " 'index': %d," + " 'current': %i," + " 'absolute': %i }", cursor->qemu_put_mouse_event_name, cursor->index, - cursor->index == current); + cursor->index == current, + !!cursor->qemu_put_mouse_event_absolute); qlist_append_obj(mice_list, obj); }