qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [PATCH 2/2] Added monitor commands: 'keyboard_set'


From: Markus Armbruster
Subject: Re: [Qemu-devel] Re: [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord'
Date: Wed, 31 Mar 2010 17:31:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Juan Quintela <address@hidden> writes:

> Shahar Havivi <address@hidden> wrote:
>> Two new monitor commands: adding ability to handle which keyboard qemu will
>> use and to see which keyboard are currently available.
>
>> +int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
>> +{
>> +    QEMUPutKbdEntry *cursor;
>> +    int index = qdict_get_int(qdict, "index");
>> +    int found = 0;
>
> found variable is not used.
>
>> +
>> +    if (QTAILQ_EMPTY(&kbd_handlers)) {
>> +        qerror_report(QERR_DEVICE_NOT_FOUND, "keyboard");
>> +        return -1;
>> +    }
>> +
>> +    QTAILQ_FOREACH(cursor, &kbd_handlers, node) {
>> +        if (cursor->index == index) {
>> +            QTAILQ_REMOVE(&kbd_handlers, cursor, node);
>> +            QTAILQ_INSERT_HEAD(&kbd_handlers, cursor, node);
>> +            found = 1;
>
> well it is set :)
>
>> +            break;
>> +        }
>> +    }
>> +
>> +    return 0;
>
> I guess you want to return one error if the index don't exist.
>
>> +}
>
> I still think that adding an "id" property as in markus proposal would
> be neat.  Otherwise I don't know how you are going to distinguish
> between two keyboards with the same name.

If I understand the patch correctly (only time for a quick skim today),
the keyboard receives a numeric ID when it is created, and keyboard_set
identifies it by that ID.  Yes, a user-defined ID would be nicer, and
consistent with how similar things work.  But the numeric ID isn't
*wrong*, as far as I can see.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]