From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nx1TU-0005JX-S6 for qemu-devel@nongnu.org; Wed, 31 Mar 2010 13:13:04 -0400 Received: from [140.186.70.92] (port=54391 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nx1TP-0005EY-V0 for qemu-devel@nongnu.org; Wed, 31 Mar 2010 13:13:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nx1TO-0001Mo-9N for qemu-devel@nongnu.org; Wed, 31 Mar 2010 13:12:59 -0400 Received: from mail-pz0-f185.google.com ([209.85.222.185]:62893) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nx1TO-0001MX-3a for qemu-devel@nongnu.org; Wed, 31 Mar 2010 13:12:58 -0400 Received: by pzk15 with SMTP id 15so346117pzk.29 for ; Wed, 31 Mar 2010 10:12:56 -0700 (PDT) Message-ID: <4BB380BB.8000600@codemonkey.ws> Date: Wed, 31 Mar 2010 12:04:59 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord' References: <689f24e27d483de0e3201a9386c772dc241d4178.1270022701.git.shaharh@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: Shahar Havivi , qemu-devel@nongnu.org On 03/31/2010 05:20 AM, Juan Quintela wrote: > Shahar Havivi 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 :) > Please split out this bit into a qemu_activate_keyboard_handler() and plumb it with the usb device such that it's only used when a guest loads a driver for it. It should be very symmetric to how the mouse driver works. Regards, Anthony Liguori >> + 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. > > Later, Juan. > > >