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: Thu, 6 Nov 2014 23:01:11 +0800
User-agent: Mutt/1.5.23 (2014-03-12)

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.
 
> NACK this patch.
> 
> Thanks.
>  
> > > 'input-send-event' has a parameter to assign special console,
> > > so we should enable strict checking in finding handler.
> > 
> > I don't think we want do that by default.  It only matters in case of a
> > multiseat setup where you actually have multiple input devices of the
> > same kind.  Which isn't a very typical use case.
> > 
> > Options I see are:
> > 
> >   (a) Turn console into an optional parameter, do strict checking in
> >       case it is present.
> >   (b) Add a optional 'strict' parameter.
> 
> -- 
>                       Amos.

From Markus:
> 
> Current behavior (please correct misunderstandings):
> 
>     The guest must be running.
>     input-send-event parameter 'console' is mandatory.
>     The console identified by its value must exist.
>     If this console can accept the event, send it there.
>     Else, a console that can accept the event must exist.  Send it
>     to
>     one of them.  Which one exactly isn't specified.
> 
> Behavior with (a):
> 
>     The guest must be running.
>     input-send-event parameter 'console' is optional.
>     If it's present, the console identified by its value must exist,
>     and
>     must be able to accept the event.  Send it there.
>     Else, a console that can accept the event must exist.  Send it
>     to
>     one of them.  Which one exactly isn't specified.
> 
> "Must" means "or else command fails".
> 
> I think that's a clear improvement.  It's actually what I expected
> from
> the command documentation, until I read the code.

Thanks for your clear description, I now agree with Gerd's option (a),
(a) is better than (b). So we need to change QMP to support optional
console parameter and change qemu_input_find_handler() to support
strict checking (as my patch).

Gerd, I'd like to work on both of them, if you already work on it,
please let me know, thanks. 

-- 
                        Amos.

Attachment: signature.asc
Description: Digital signature


reply via email to

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