On 29/05/12 21:24, Luiz Capitulino wrote:
On Tue, 29 May 2012 20:17:53 +0800
Amos Kong<ak...@redhat.com> wrote:
On 05/29/2012 07:57 PM, Amos Kong wrote:
On 05/25/2012 09:14 PM, Anthony Liguori wrote:
On 05/24/2012 10:51 PM, Eric Blake wrote:
On 05/24/2012 09:32 PM, Amos Kong wrote:
Convert 'sendkey' to use. do_sendkey() depends on some variables
in monitor.c, so reserve qmp_sendkey() to monitor.c Rename
'string' to 'keys', rename 'hold_time' to 'hold-time'
Signed-off-by: Amos Kong<ak...@redhat.com>
+## +# @sendkey: +# +# Send keys to VM. +# +# @keys: key
sequence +# @hold-time: time to delay key up events +# +#
Returns: Nothing on success +# If key is unknown or
redundant, QERR_INVALID_PARAMETER +# If key is invalid,
QERR_INVALID_PARAMETER_VALUE +# +# Notes: Send @var{keys} to the
emulator. @var{keys} could be the name of the +# key or
the raw value in either decimal or hexadecimal format. Use +#
@code{-} to press several keys simultaneously. +# +# Since:
0.14.0 +## +{ 'command': 'sendkey', 'data': {'keys': 'str',
'*hold-time': 'int'} }
Rather than making 'keys' a free-form string where qemu then has
to parse '-' to separate keys, should we instead make it a JSON
array? For example,
{ "execute":"sendky", "data":{ "keys":["ctrl", "alt", "del"],
"hold-time":200 } }
Actually, we should do:
{ 'enum': 'KeyCode', 'data': [ 'map', 'exclam', 'at', 'numbersign',
...] }
{ 'command': 'sendkey', 'data': { 'keys': [ 'KeyCode' ],
'*hold-time': 'int' } }
^^^
It doesn't work. "KeyCodeList" could not be defined automatically. I
try to add a type definition to make it works, is it ok?
Looks like we don't support enum lists yet, so the right thing to do is to add
it.
I can do it if you want, or you could give it a try.
I would like to try it.
{ 'enum': 'Keycode',
'data': [ 'shift', 'shift_r', 'alt', 'alt_r', 'altgr', 'altgr_r',
......
'lf', 'help', 'meta_l', 'meta_r', 'compose' ] }
{ 'type': 'KeyCodes',
'data': { 'name', 'Keycode' } }
{ 'command': 'sendkey',
'data': { 'keys': ['KeyCodes'], '*hold-time': 'int' } }
New problems: special character '<' could not be added to enum, other
characters are fine.
Shouldn't the enum contain only symbolic names?
qapi-types.h:
typedef enum KeyCodes
{
KEY_CODES_SHIFT = 0,
KEY_CODES_SHIFT_R = 1,
KEY_CODES_ALT = 2,
....
KEY_CODES_< = ..
^^^ problem should exist here
--
Amos.