Received: from eggs.gnu.org ([208.118.235.92]:54107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF7rt-0005Wi-Ph for qemu-devel@nongnu.org; Fri, 21 Sep 2012 14:22:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TF7rs-0003GR-Ob for qemu-devel@nongnu.org; Fri, 21 Sep 2012 14:22:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF7rs-0003GE-GS for qemu-devel@nongnu.org; Fri, 21 Sep 2012 14:22:24 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8LIMNuj002941 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 21 Sep 2012 14:22:23 -0400 From: Markus Armbruster References: <1348239340-29021-1-git-send-email-lcapitulino@redhat.com> <1348239340-29021-3-git-send-email-lcapitulino@redhat.com> <505C965B.1050504@redhat.com> <20120921134234.5d836bc5@doriath.home> <20120921142634.2d4707c4@doriath.home> Date: Fri, 21 Sep 2012 20:20:15 +0200 In-Reply-To: <20120921142634.2d4707c4@doriath.home> (Luiz Capitulino's message of "Fri, 21 Sep 2012 14:26:34 -0300") Message-ID: <87wqzn2q74.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 2/3] qmp: qmp_send_key(): accept key codes in hex List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: akong@redhat.com, Eric Blake , qemu-devel@nongnu.org, avi@redhat.com Luiz Capitulino writes: > On Fri, 21 Sep 2012 13:42:34 -0300 > Luiz Capitulino wrote: > >> On Fri, 21 Sep 2012 10:31:23 -0600 >> Eric Blake wrote: >> >> > On 09/21/2012 08:55 AM, Luiz Capitulino wrote: >> > > This commit fixes the problem by adding hex value support down >> > > the QMP interface, qmp_send_key(). >> > > >> > >> > > +++ b/qapi-schema.json >> > > @@ -2588,12 +2588,25 @@ >> > > 'lf', 'help', 'meta_l', 'meta_r', 'compose' ] } >> > > >> > > ## >> > > +# @KeyValue >> > > +# >> > > +# Represents a keyboard key. >> > > +# >> > > +# Since: 1.3.0 >> > > +## >> > > +{ 'union': 'KeyValue', >> > > + 'data': { >> > > + 'hex': 'int', >> > >> > Don't you find it a bit odd to name this 'hex', even though it works to >> > do 'hex':32 as a synonym for 'hex':0x20? Should we instead name it >> > 'value', since we don't care in what base the value was represented, >> > only that JSON was able to decode the base into a value? >> >> Yes, that's a good point. I'll respin. > > Actually, this also has drawbacks: > > keylist->value->kind = KEY_VALUE_KIND_VALUE; > keylist->value->value = value; > > Value, value, value... Value, value, value! > > I thought about renaming QKeyCode to KeyName and KeyValue to KeyCode, the > problem though (apart from the code churn caused by the renaming) is that > KeyName doesn't make much sense in C as it's all integers. > > Any better ideas? keylist->value->kind = KEY_VALUE_KIND_NUM; keylist->value->num = num;