Received: from eggs.gnu.org ([2001:4830:134:3::10]:44659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xmayc-0002Ql-8t for qemu-devel@nongnu.org; Thu, 06 Nov 2014 23:16:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmayW-0007ej-3d for qemu-devel@nongnu.org; Thu, 06 Nov 2014 23:16:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmayV-0007d0-Qf for qemu-devel@nongnu.org; Thu, 06 Nov 2014 23:16:40 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA74GbRg003408 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 6 Nov 2014 23:16:38 -0500 Date: Fri, 7 Nov 2014 12:16:34 +0800 From: Amos Kong Message-ID: <20141107041634.GB20031@air.redhat.com> References: <1415119766-9745-1-git-send-email-akong@redhat.com> <1415177267.11011.1.camel@nilsson.home.kraxel.org> <20141106063754.GF8764@air.redhat.com> <20141106150111.GA25471@air.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/NkBOFFp2J2Af1nK" Content-Disposition: inline In-Reply-To: <20141106150111.GA25471@air.redhat.com> Subject: Re: [Qemu-devel] [PATCH] ui/input: strictly check console in finding input handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: mtosatti@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com --/NkBOFFp2J2Af1nK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 06, 2014 at 11:01:11PM +0800, Amos Kong wrote: > On Thu, Nov 06, 2014 at 02:37:54PM +0800, Amos Kong wrote: > > On Wed, Nov 05, 2014 at 09:47:47AM +0100, Gerd Hoffmann wrote: > > > On Mi, 2014-11-05 at 00:49 +0800, Amos Kong wrote: > > > > qemu_input_find_handler() prefers a handler associated with con. > > > > But if none exists, it takes any. This patch added a parameter > > > > to strictly check console, in case we want to input event to > > > > special console. > >=20 > > If console is assigned, it will try to find right handler by first > > loop in qemu_input_find_handler(). The second loop is used to find > > mask matched handler if console isn't assigned. > >=20 > > If we assigned console and didn't find handler in first loop, it > > skip second loop body by 'continue', and return NULL. > > It seems my concern is wrong, we don't need this repeated parameter. >=20 > I was wrong, if we don't assign the console for qemu_input_find_handler(), > it has chance to get an arbitrary console (mask matched). So the > original issue this patch try to fix truely exists. The 'console' in my mind was the input destination, so I thgouth we need to distinguish the console with strictly checking. The 'QemuConsole' is the input source for handler, we share some input handlers to process the input events from different QemuConsole. Normally we only have one set of keyboard, mouse, usbtablet, etc. The devices have different mask, it's fine to just checking mask to insure that the handler has the ability to process the event. I saw we try to bind console to handler in usb/dev-hid.c, but display always isn't available at that time. If we have multiseat setup (as Gerd said), we only have 'problem' in this case. Actually event from different devices have the same effect for system, it's fine to always use the first available handler without caring about the console. For send-key command, we just pass a NULL for console parameter in calling qemu_input_event_send_key(NULL, ..) Conclusion: * Generally assigning the special console is meanless, and we can't directly remove the QMP parameter for compatibility. So we can make the parameter optional. The parameter might be useful for some special condition: we have multiple devices without binding console and they all have the ability(mask) to process events, and we don't want to use the first one. Thanks. Amos --/NkBOFFp2J2Af1nK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUXEeiAAoJELxSv6I5vP9jss8P/34pqHe+iliQt+njkdtAMTWZ wE+beBe5nsALG8VgZstkRZYFTKycVvhqAxnOAHrIGOhfuhQmwDmclrJgoeOdnHnT FI2OOK24tl+Fuy5VjqzW+3kMd/KKVQqMA1+F10TTMh9TzabHkD97BLEsPusd2lnx e1rhHgEsnX4pTT4dnCjajsFLPxHCoKAtJPZvh7H44Ka4623fT3cMlAQWbmmg8Vbz Q+LFHEqeJmnOQo0HHtHxl/nW40oS26kZnAOH3wK8zdUCbSWZ44ghQOvHT9/BU6Xg WzxYoZcd8o+5zG4sNRHb01eXkseKpu6viKmqNWYUrVRCaxuD6wbHM8Y1gt1/rByu EyyD+PnzOjBi+vdc7sEXiidoxFdz8Vt92k/mFPxISqAAvaZEVF0nK3AYy/jzBRxo 51URYEGghZVnlt9bE9vjBBywP/LGl3MLgAAd/6NXE3ITvMhf+lx7O2rqYXHm8iYu pjbDtKocoNCZTewaSarVOpICQMtlP1fKh2ZSX3WtugzmFWdasCEcihBXJA/2ma5q VydN9cLo3SvryEZv0F47O6buimxYceaVeaOw3zBXzZZbjX70MHppexERRF/SLM1w +WX64HmHADmWU6cONnXLX2diUNJYvdTW1kjHpuHJlni3Owz7z0dI7Ba7qTSsUKb2 IySh8lxmcoukF6kbqwTq =v3gV -----END PGP SIGNATURE----- --/NkBOFFp2J2Af1nK--