[PATCH evemu 01/16] python: add InputEvent.matches(type, code) for comparisons

Peter Hutterer peter.hutterer at who-t.net
Wed Aug 13 15:45:25 PDT 2014


On Tue, Aug 12, 2014 at 01:47:37PM -0400, Benjamin Tissoires wrote:
> On Mon, Aug 11, 2014 at 9:34 PM, Peter Hutterer
> <peter.hutterer at who-t.net> wrote:
> > Allows for:
> >
> >         if e.matches("EV_REL", "REL_X"):
> >            print("Relative X events")
> 
> It should be nice to also have
>   if e.matches("EV_REL", 0):
>     print("Relative 0 events")
> 
> (not quite sure it would be a benefit and not dumb, but we allow both
> string and event code anywhere else).

fair enough. I skipped it at first because if you have the numeric value
already you can just compare e.type and e.code, but it'd be nice for
consistency. Having said that, the current internal APIs make this more
convoluted than necessary, so I'll hold this patch back until your
libevdev-integration patch is in.

Cheers,
   Peter



More information about the Input-tools mailing list