Received: from eggs.gnu.org ([2001:4830:134:3::10]:53079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwtiZ-0001XL-Ml for qemu-devel@nongnu.org; Tue, 17 Jun 2014 09:46:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwtiS-0002dP-1u for qemu-devel@nongnu.org; Tue, 17 Jun 2014 09:46:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwtiR-0002dJ-Pp for qemu-devel@nongnu.org; Tue, 17 Jun 2014 09:46:23 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5HDkMGV015698 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 17 Jun 2014 09:46:23 -0400 Date: Tue, 17 Jun 2014 10:46:09 -0300 From: Marcelo Tosatti Message-ID: <20140617134609.GB16748@amt.cnet> References: <20140616231509.GA24935@amt.cnet> <53A02DB9.5060404@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53A02DB9.5060404@redhat.com> Subject: Re: [Qemu-devel] [PATCH] add input-send-event command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Luiz Capitulino , qemu-devel , Gerd Hoffmann On Tue, Jun 17, 2014 at 05:59:53AM -0600, Eric Blake wrote: > On 06/16/2014 05:15 PM, Marcelo Tosatti wrote: > > > > Which allows specification of absolute/relative, > > up/down and console parameters. > > > > Suggested by Gerd Hoffman. > > > > --- > > Needs S-o-B. > > > qapi-schema.json | 18 ++++++++++++++++ > > qmp-commands.hx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > ui/input.c | 31 ++++++++++++++++++++++++++++ > > 3 files changed, 108 insertions(+) > > > > Index: qemu/qapi-schema.json > > =================================================================== > > --- qemu.orig/qapi-schema.json 2014-06-16 20:12:51.049064621 -0300 > > +++ qemu/qapi-schema.json 2014-06-16 20:13:42.886920723 -0300 > > @@ -4722,3 +4722,21 @@ > > 'btn' : 'InputBtnEvent', > > 'rel' : 'InputMoveEvent', > > 'abs' : 'InputMoveEvent' } } > > + > > +## > > +# @input-send-event > > +# > > +# Send input event(s) to guest. > > +# > > +# @console: Which console to send event(s) to. > > Is it worth requiring console, or can it be optional and default to the > first available console (usually console 0)? It is required. Would rather not allow the user to send a command to an console without knowing what console that is. > > +# > > +# @events: List of InputEvent union. > > +# > > +# Returns: Nothing on success. > > +# > > +# Since: 2.1 > > +# > > +## > > +{ 'command': 'input-send-event', > > + 'data': { 'console':'int', 'events': [ 'InputEvent' ] } } > > See my other mail about possibly extending the InputEvent union (or > creating a new subtype) to add delays into the mix. > > > > +Example (2): > > + > > +Press ctrl-alt-del. > > + > > +-> { "execute": "input-send-event", > > + "arguments": { "console": 0, "events": [ > > + { "type": "key", "data" : { "down": true, > > + "key": {"type": "qcode", "data": "ctrl" } } }, > > + { "type": "key", "data" : { "down": true, > > + "key": {"type": "qcode", "data": "alt" } } }, > > + { "type": "key", "data" : { "down": true, > > + "key": {"type": "qcode", "data": "delete" } } } ] } } > > +<- { "return": {} } > > Don't you also need to send the key-release events (again, possibly > after a pause), for this to work? No, key signals on "down". > > + if (!qemu_input_find_handler(1 << event->kind, con)) { > > + error_setg(errp, "Input handler not found for" > > + "event type %s", > > Typo: s/forevent/for event/ Yes there is another missing space, thanks.