From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nwv2T-00024X-02 for qemu-devel@nongnu.org; Wed, 31 Mar 2010 06:20:45 -0400 Received: from [140.186.70.92] (port=34528 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nwv2Q-00022o-0O for qemu-devel@nongnu.org; Wed, 31 Mar 2010 06:20:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nwv2H-0002Ph-0J for qemu-devel@nongnu.org; Wed, 31 Mar 2010 06:20:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7903) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nwv2G-0002Pb-LJ for qemu-devel@nongnu.org; Wed, 31 Mar 2010 06:20:32 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2VAKVeP019414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 31 Mar 2010 06:20:31 -0400 From: Juan Quintela In-Reply-To: <689f24e27d483de0e3201a9386c772dc241d4178.1270022701.git.shaharh@redhat.com> (Shahar Havivi's message of "Wed, 31 Mar 2010 11:16:49 +0300") References: <689f24e27d483de0e3201a9386c772dc241d4178.1270022701.git.shaharh@redhat.com> Date: Wed, 31 Mar 2010 12:20:28 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord' List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Shahar Havivi Cc: qemu-devel@nongnu.org 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 :) > + 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.