qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] ui/input: strictly check console in finding inp


From: Amos Kong
Subject: Re: [Qemu-devel] [PATCH] ui/input: strictly check console in finding input handler
Date: Fri, 7 Nov 2014 12:16:34 +0800
User-agent: Mutt/1.5.23 (2014-03-12)

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.
> > 
> > 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.
> > 
> > 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.
> 
> 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

Attachment: signature.asc
Description: Digital signature


reply via email to

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