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.